# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 651267a6933e08c726857db742aa0c4a4638bd1a
# Parent 83127ceb792f06a5b30547f342ff57a500d89c47
Set up and tear down phys_proc_id, cpu_core_id, cpu_sibling_map
and cpu_core_map when CPUs come online and go offline.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
xen-unstable changeset: 9962:d8954fc3b76b6bdbe0cd301924b51dffa43409d1
xen-unstable date: Wed May 10 15:44:56 2006 +0100
---
linux-2.6-xen-sparse/drivers/xen/core/smpboot.c | 42 ++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
diff -r 83127ceb792f -r 651267a6933e
linux-2.6-xen-sparse/drivers/xen/core/smpboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c Wed May 10 13:42:10
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c Wed May 10 15:46:08
2006 +0100
@@ -107,6 +107,18 @@ void __init smp_alloc_memory(void)
{
}
+static inline void
+set_cpu_sibling_map(int cpu)
+{
+ phys_proc_id[cpu] = cpu;
+ cpu_core_id[cpu] = 0;
+
+ cpu_sibling_map[cpu] = cpumask_of_cpu(cpu);
+ cpu_core_map[cpu] = cpumask_of_cpu(cpu);
+
+ cpu_data[cpu].booted_cores = 1;
+}
+
static void xen_smp_intr_init(unsigned int cpu)
{
sprintf(resched_name[cpu], "resched%d", cpu);
@@ -230,14 +242,20 @@ void __init smp_prepare_cpus(unsigned in
struct Xgt_desc_struct *gdt_descr;
#endif
+ boot_cpu_data.apicid = 0;
cpu_data[0] = boot_cpu_data;
cpu_2_logical_apicid[0] = 0;
x86_cpu_to_apicid[0] = 0;
current_thread_info()->cpu = 0;
- cpu_sibling_map[0] = cpumask_of_cpu(0);
- cpu_core_map[0] = cpumask_of_cpu(0);
+
+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
+ cpus_clear(cpu_sibling_map[cpu]);
+ cpus_clear(cpu_core_map[cpu]);
+ }
+
+ set_cpu_sibling_map(0);
xen_smp_intr_init(0);
@@ -262,6 +280,8 @@ void __init smp_prepare_cpus(unsigned in
XENFEAT_writable_descriptor_tables);
cpu_data[cpu] = boot_cpu_data;
+ cpu_data[cpu].apicid = cpu;
+
cpu_2_logical_apicid[cpu] = cpu;
x86_cpu_to_apicid[cpu] = cpu;
@@ -470,6 +490,18 @@ void smp_resume(void)
vcpu_hotplug(i);
}
+static void
+remove_siblinginfo(int cpu)
+{
+ phys_proc_id[cpu] = BAD_APICID;
+ cpu_core_id[cpu] = BAD_APICID;
+
+ cpus_clear(cpu_sibling_map[cpu]);
+ cpus_clear(cpu_core_map[cpu]);
+
+ cpu_data[cpu].booted_cores = 0;
+}
+
int __cpu_disable(void)
{
cpumask_t map = cpu_online_map;
@@ -477,6 +509,8 @@ int __cpu_disable(void)
if (cpu == 0)
return -EBUSY;
+
+ remove_siblinginfo(cpu);
cpu_clear(cpu, map);
fixup_irqs(map);
@@ -549,6 +583,10 @@ int __devinit __cpu_up(unsigned int cpu)
prepare_for_smp();
#endif
+ /* This must be done before setting cpu_online_map */
+ set_cpu_sibling_map(cpu);
+ wmb();
+
xen_smp_intr_init(cpu);
cpu_set(cpu, cpu_online_map);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|