From 75cbfb97a156dd3dabdc81295fb8144576332366 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Wed, 26 May 2010 17:03:33 +0200 Subject: [PATCH 1/2] ACPI: Do not try to set up acpi processor stuff on cores exceeding maxcpus= Patch is against latest Linus master branch and is expected to be safe bug fix. You get: ACPI: HARDWARE addr space,NOT supported yet for each ACPI defined CPU which status is active, but exceeds maxcpus= count. As these "not booted" CPUs do not run an idle routine and echo X >/proc/acpi/processor/*/throttling did not work I couldn't find a way to really access not onlined/booted machines. Still this should get fixed and /proc/acpi/processor/X dirs of cores exceeding maxcpus should not show up. I wonder whether this could get cleaned up by truncating possible cpu mask and nr_cpu_ids to setup_max_cpus early some day (and not exporting setup_max_cpus anymore then). But this needs touching of a lot other places... Signed-off-by: Thomas Renninger CC: travis@sgi.com CC: linux-acpi@vger.kernel.org CC: lenb@kernel.org Signed-off-by: Len Brown --- drivers/acpi/processor_driver.c | 5 +++++ init/main.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index b1034a9ada4e..38ea0cc6dc49 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -581,6 +581,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) return 0; } +#ifdef CONFIG_SMP + if (pr->id >= setup_max_cpus && pr->id != 0) + return 0; +#endif + BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); /* diff --git a/init/main.c b/init/main.c index 3bdb152f412f..ac2e4a5f59ee 100644 --- a/init/main.c +++ b/init/main.c @@ -125,7 +125,9 @@ static char *ramdisk_execute_command; #ifdef CONFIG_SMP /* Setup configured maximum number of CPUs to activate */ -unsigned int __initdata setup_max_cpus = NR_CPUS; +unsigned int setup_max_cpus = NR_CPUS; +EXPORT_SYMBOL(setup_max_cpus); + /* * Setup routine for controlling SMP activation From 934231de706d2579fae14f5857fcd8de991009ff Mon Sep 17 00:00:00 2001 From: Liang Li Date: Thu, 10 Jun 2010 13:42:49 +0800 Subject: [PATCH 2/2] ACPI: fan: fix unbalanced code block The code block braced with CONFIG_ACPI_PROCFS is unblanced. When CONFIG_ACPI_PROCFS=n, kernel trace will be produced like: Call Trace: [] ? remove_proc_entry+0x20d/0x290 [] ? remove_proc_entry+0x20d/0x290 [] warn_slowpath_common+0x6c/0xc0 [] ? remove_proc_entry+0x20d/0x290 [] warn_slowpath_fmt+0x26/0x30 [] remove_proc_entry+0x20d/0x290 [] ? proc_register+0x117/0x1f0 [] ? proc_mkdir_mode+0x33/0x50 [] ? acpi_fan_init+0x0/0x2c [] acpi_fan_init+0x23/0x2c [] do_one_initcall+0x23/0x180 [] ? init_irq_proc+0x67/0x80 [] kernel_init+0x13c/0x20e [] ? schedule_tail+0x20/0x90 [] ? syscall_exit+0x5/0x16 [] ? kernel_init+0x0/0x20e [] ? kernel_init+0x0/0x20e [] kernel_thread_helper+0x6/0x30 ---[ end trace a7919e7f17c0a725 ]--- Then also bracket later error checking code with ACPI_PROCFS option to avoid mismatch problem. Signed-off-by: Liang Li Signed-off-by: Len Brown --- drivers/acpi/fan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index acf2ab249842..8a3b840c0bb2 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -347,7 +347,6 @@ static int __init acpi_fan_init(void) { int result = 0; - #ifdef CONFIG_ACPI_PROCFS acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); if (!acpi_fan_dir) @@ -356,7 +355,9 @@ static int __init acpi_fan_init(void) result = acpi_bus_register_driver(&acpi_fan_driver); if (result < 0) { +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); +#endif return -ENODEV; }