ia64/xen-unstable

changeset 8803:99e7b8f9122e

Fix x86_64 CPU hotplug by paravirtualizing the play_dead() function.

Also fix the i386 play_dead() function to call idle_task_exit(),
which ensures the CPU exits while running the init_mm. Otherwise
other tasks may get stuck.

Signed-off-by: Ryan Grimm <grimm@us.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Feb 09 00:27:52 2006 +0100 (2006-02-09)
parents 6789ae50ce7f
children 66260f1a9bde
files buildconfigs/linux-defconfig_xenU_x86_64 buildconfigs/linux-defconfig_xen_x86_64 linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c
line diff
     1.1 --- a/buildconfigs/linux-defconfig_xenU_x86_64	Thu Feb 09 00:22:38 2006 +0100
     1.2 +++ b/buildconfigs/linux-defconfig_xenU_x86_64	Thu Feb 09 00:27:52 2006 +0100
     1.3 @@ -127,7 +127,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
     1.4  # CONFIG_SPARSEMEM_STATIC is not set
     1.5  CONFIG_SPLIT_PTLOCK_CPUS=4096
     1.6  CONFIG_NR_CPUS=8
     1.7 -# CONFIG_HOTPLUG_CPU is not set
     1.8 +CONFIG_HOTPLUG_CPU=y
     1.9  CONFIG_SWIOTLB=y
    1.10  # CONFIG_CRASH_DUMP is not set
    1.11  CONFIG_PHYSICAL_START=0x100000
     2.1 --- a/buildconfigs/linux-defconfig_xen_x86_64	Thu Feb 09 00:22:38 2006 +0100
     2.2 +++ b/buildconfigs/linux-defconfig_xen_x86_64	Thu Feb 09 00:27:52 2006 +0100
     2.3 @@ -130,7 +130,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
     2.4  # CONFIG_SPARSEMEM_STATIC is not set
     2.5  CONFIG_SPLIT_PTLOCK_CPUS=4096
     2.6  CONFIG_NR_CPUS=8
     2.7 -# CONFIG_HOTPLUG_CPU is not set
     2.8 +CONFIG_HOTPLUG_CPU=y
     2.9  CONFIG_SWIOTLB=y
    2.10  # CONFIG_CRASH_DUMP is not set
    2.11  CONFIG_PHYSICAL_START=0x100000
     3.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c	Thu Feb 09 00:22:38 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c	Thu Feb 09 00:27:52 2006 +0100
     3.3 @@ -126,6 +126,7 @@ EXPORT_SYMBOL(default_idle);
     3.4  #ifdef CONFIG_HOTPLUG_CPU
     3.5  static inline void play_dead(void)
     3.6  {
     3.7 +	idle_task_exit();
     3.8  	HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
     3.9  	local_irq_enable();
    3.10  }
     4.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c	Thu Feb 09 00:22:38 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c	Thu Feb 09 00:27:52 2006 +0100
     4.3 @@ -53,6 +53,7 @@
     4.4  #include <asm/kdebug.h>
     4.5  #include <xen/interface/dom0_ops.h>
     4.6  #include <xen/interface/physdev.h>
     4.7 +#include <xen/interface/vcpu.h>
     4.8  #include <asm/desc.h>
     4.9  #include <asm/proto.h>
    4.10  #include <asm/hardirq.h>
    4.11 @@ -144,21 +145,7 @@ DECLARE_PER_CPU(int, cpu_state);
    4.12  static inline void play_dead(void)
    4.13  {
    4.14  	idle_task_exit();
    4.15 -	wbinvd();
    4.16 -	mb();
    4.17 -	/* Ack it */
    4.18 -	__get_cpu_var(cpu_state) = CPU_DEAD;
    4.19 -
    4.20 -	/* We shouldn't have to disable interrupts while dead, but
    4.21 -	 * some interrupts just don't seem to go away, and this makes
    4.22 -	 * it "work" for testing purposes. */
    4.23 -	/* Death loop */
    4.24 -	while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
    4.25 -		HYPERVISOR_sched_op(SCHEDOP_yield, 0);
    4.26 -
    4.27 -	local_irq_disable();
    4.28 -	__flush_tlb_all();
    4.29 -	cpu_set(smp_processor_id(), cpu_online_map);
    4.30 +	HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
    4.31  	local_irq_enable();
    4.32  }
    4.33  #else