From: "Jan Beulich" Subject: [PATCH] linux: fix processor handling in presence of external control Date: Fri, 19 Sep 2008 14:21:12 +0100 Message-ID: <48D3C368.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org - 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. Signed-off-by: Jan Beulich Index: head-2008-09-15/arch/i386/kernel/acpi/processor_extcntl_xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2008-09-15.orig/arch/i386/kernel/acpi/processor_extcntl_xen.c = 2008-09-19 12:54:32.000000000 +0200 +++ head-2008-09-15/arch/i386/kernel/acpi/processor_extcntl_xen.c = 2008-09-19 12:55:29.000000000 +0200 @@ -215,6 +215,8 @@ void arch_acpi_processor_init_extcntl(co { unsigned int pmbits =3D (xen_start_info->flags & SIF_PM_MASK) >> = 8; =20 + if (!pmbits) + return; if (pmbits & XEN_PROCESSOR_PM_CX) xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] =3D xen_cx_notifier; if (pmbits & XEN_PROCESSOR_PM_PX) Index: head-2008-09-15/drivers/acpi/processor_core.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2008-09-15.orig/drivers/acpi/processor_core.c 2008-09-19 = 12:55:04.000000000 +0200 +++ head-2008-09-15/drivers/acpi/processor_core.c 2008-09-19 = 12:13:42.000000000 +0200 @@ -661,7 +661,7 @@ static int acpi_processor_remove(struct=20 =20 pr =3D (struct acpi_processor *)acpi_driver_data(device); =20 - if (pr->id >=3D NR_CPUS) { + if (!processor_cntl_external() && pr->id >=3D NR_CPUS) { kfree(pr); return 0; } @@ -831,12 +831,7 @@ static void __ref acpi_processor_hotplug return; } =20 -#ifdef CONFIG_XEN - if ((pr->id >=3D 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); =20 if (processor_cntl_external())