x86 cpuidle: check whether cpu is online in cpu idle control
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Aug 2010 18:32:37 +0000 (19:32 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Aug 2010 18:32:37 +0000 (19:32 +0100)
We observed a 2.6.18.8 dom0 kernel crash when Xen has maxcpus < num
of physical cores (maxcpus=3D4 for a 12-core system). It appeared that
hypervisor doesn't check whether CPU is online or not. This small
patch fixed the issue.

Signed-off-by: Uwe Dannowski <uwe.dannowski@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
xen/arch/x86/acpi/cpuidle_menu.c

index c050972a9fcace927b017310f1bf0347e2c6a85d..38a5543c00fc4f41e2f0123d121d963faabf9a72 100644 (file)
@@ -270,9 +270,10 @@ static void menu_reflect(struct acpi_processor_power *power)
 
 static int menu_enable_device(struct acpi_processor_power *power)
 {
-    struct menu_device *data = &per_cpu(menu_devices, power->cpu);
+    if (!cpu_online(power->cpu))
+        return -1;
 
-    memset(data, 0, sizeof(struct menu_device));
+    memset(&per_cpu(menu_devices, power->cpu), 0, sizeof(struct menu_device));
 
     return 0;
 }