Skip to contentSkip to conversation

linux: fix processor handling in presence of external control

PATCH New Jan Beulich 1 participant 1 message Sep 19, 2008 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux: fix processor handling in presence of external control

- avoid leaking stuff in acpi_processor_remove()
- remove a pointless change to native code in acpi_processor_hotplug() (struct acpi_processor's id field is unsigned)
- don't set up processor_extcntl_ops when nothing controlled by Xen (thus processor_cntl_external() will always return false, allowing ACPI code to retain native behavior)

As usual, written and tested on 2.6.27-rc6 and made apply to the 2.6.18 tree without further testing.

arch/i386/kernel/acpi/processor_extcntl_xen.c +2 -0
Index: head-2008-09-15/arch/i386/kernel/acpi/processor_extcntl_xen.c
===================================================================
@@ -215,6 +215,8 @@ void arch_acpi_processor_init_extcntl(co
 {
 	unsigned int pmbits = (xen_start_info->flags & SIF_PM_MASK) >> 8;
 
+	if (!pmbits)
+		return;
 	if (pmbits & XEN_PROCESSOR_PM_CX)
 		xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier;
 	if (pmbits & XEN_PROCESSOR_PM_PX)
drivers/acpi/processor_core.c +1 -6
Index: head-2008-09-15/drivers/acpi/processor_core.c
===================================================================
@@ -661,7 +661,7 @@ static int acpi_processor_remove(struct 
 
 	pr = (struct acpi_processor *)acpi_driver_data(device);
 
-	if (pr->id >= NR_CPUS) {
+	if (!processor_cntl_external() && pr->id >= NR_CPUS) {
 		kfree(pr);
 		return 0;
 	}
@@ -831,12 +831,7 @@ static void __ref acpi_processor_hotplug
 			return;
 		}
 
-#ifdef CONFIG_XEN
-		if ((pr->id >= 0) && (pr->id < NR_CPUS)
-		    && (cpu_present(pr->id)))
-#else
 		if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
-#endif /* CONFIG_XEN */
 			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
 
 		if (processor_cntl_external())