From 5cc9eeef9a9567acdfc2f6943f24381bf460f008 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Mon, 17 Oct 2005 16:43:31 -0700 Subject: [PATCH] Fix /proc/acpi/events around suspend Fix -EIO on /proc/acpi/events after suspends. This actually breaks suspending by power button in many setups. Signed-off-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/event.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index bfa8b76de40..2dbb1b0f11d 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c @@ -58,9 +58,8 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, return_VALUE(-EAGAIN); result = acpi_bus_receive_event(&event); - if (result) { - return_VALUE(-EIO); - } + if (result) + return_VALUE(result); chars_remaining = sprintf(str, "%s %s %08x %08x\n", event.device_class ? event. -- cgit v1.2.3 From 51b190b304bbeb1090ba20b0623d39917fa62997 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 19 Oct 2005 22:45:14 -0700 Subject: [PATCH] `unaligned access' in acpi get_root_bridge_busnr() In drivers/acpi/glue.c the address of an integer is cast to the address of an unsigned long. This breaks on systems where a long is larger than an int --- for a start the int can be misaligned; for a second the assignment through the pointer will overwrite part of the next variable. Signed-off-by: Peter Chubb Acked-by: "Brown, Len" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/glue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index e36c5da2b31..3937adf4e5e 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -96,7 +96,7 @@ struct acpi_find_pci_root { static acpi_status do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) { - int *busnr = (int *)data; + unsigned long *busnr = (unsigned long *)data; struct acpi_resource_address64 address; if (resource->id != ACPI_RSTYPE_ADDRESS16 && @@ -115,13 +115,13 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) static int get_root_bridge_busnr(acpi_handle handle) { acpi_status status; - int bus, bbn; + unsigned long bus, bbn; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, - (unsigned long *)&bbn); + &bbn); if (status == AE_NOT_FOUND) { /* Assume bus = 0 */ printk(KERN_INFO PREFIX @@ -153,7 +153,7 @@ static int get_root_bridge_busnr(acpi_handle handle) } exit: acpi_os_free(buffer.pointer); - return bbn; + return (int)bbn; } static acpi_status -- cgit v1.2.3 From 0b0acbec1bed75ec1e1daa7f7006323a2a2b2844 Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Sat, 29 Oct 2005 18:16:55 -0700 Subject: [PATCH] memory hotplug: move section_mem_map alloc to sparse.c This basically keeps up from having to extern __kmalloc_section_memmap(). The vaddr_in_vmalloc_area() helper could go in a vmalloc header, but that header gets hard to work with, because it needs some arch-specific macros. Just stick it in here for now, instead of creating another header. Signed-off-by: Dave Hansen Signed-off-by: Lion Vollnhals Signed-off-by: Jiri Slaby Signed-off-by: Yasunori Goto Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/acpi_memhotplug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 01a1bd23926..2143609d293 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -200,8 +200,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) * Note: Assume that this function returns zero on success */ result = add_memory(mem_device->start_addr, - (mem_device->end_addr - mem_device->start_addr) + 1, - mem_device->read_write_attribute); + (mem_device->end_addr - mem_device->start_addr) + 1); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); mem_device->state = MEMORY_INVALID_STATE; @@ -259,7 +258,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) * Ask the VM to offline this memory range. * Note: Assume that this function returns zero on success */ - result = remove_memory(start, len, attr); + result = remove_memory(start, len); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Hot-Remove failed.\n")); return_VALUE(result); -- cgit v1.2.3 From eb9289eb20df6b54214c45ac7c6bf5179a149026 Mon Sep 17 00:00:00 2001 From: Shaohua Li Date: Sun, 30 Oct 2005 15:00:01 -0800 Subject: [PATCH] introduce .valid callback for pm_ops Add pm_ops.valid callback, so only the available pm states show in /sys/power/state. And this also makes an earlier states error report at enter_state before we do actual suspend/resume. Signed-off-by: Shaohua Li Acked-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/sleep/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index aee50b45326..930427fc0c4 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c @@ -158,7 +158,15 @@ int acpi_suspend(u32 acpi_state) return -EINVAL; } +static int acpi_pm_state_valid(suspend_state_t pm_state) +{ + u32 acpi_state = acpi_suspend_states[pm_state]; + + return sleep_states[acpi_state]; +} + static struct pm_ops acpi_pm_ops = { + .valid = acpi_pm_state_valid, .prepare = acpi_pm_prepare, .enter = acpi_pm_enter, .finish = acpi_pm_finish, -- cgit v1.2.3 From 4e57b6817880946a3a78d5d8cad1ace363f7e449 Mon Sep 17 00:00:00 2001 From: Tim Schmielau Date: Sun, 30 Oct 2005 15:03:48 -0800 Subject: [PATCH] fix missing includes I recently picked up my older work to remove unnecessary #includes of sched.h, starting from a patch by Dave Jones to not include sched.h from module.h. This reduces the number of indirect includes of sched.h by ~300. Another ~400 pointless direct includes can be removed after this disentangling (patch to follow later). However, quite a few indirect includes need to be fixed up for this. In order to feed the patches through -mm with as little disturbance as possible, I've split out the fixes I accumulated up to now (complete for i386 and x86_64, more archs to follow later) and post them before the real patch. This way this large part of the patch is kept simple with only adding #includes, and all hunks are independent of each other. So if any hunk rejects or gets in the way of other patches, just drop it. My scripts will pick it up again in the next round. Signed-off-by: Tim Schmielau Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/processor_idle.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 26a3a401611..161db4acfb9 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -37,6 +37,7 @@ #include #include #include +#include /* need_resched() */ #include #include -- cgit v1.2.3 From 01a527ec7c62efea601a39f0cd8e6a8517259014 Mon Sep 17 00:00:00 2001 From: Nishanth Aravamudan Date: Mon, 7 Nov 2005 01:01:14 -0800 Subject: [PATCH] drivers/acpi: fix-up schedule_timeout() usage Use schedule_timeout_interruptible() instead of set_current_state()/schedule_timeout() to reduce kernel size. Also use msecs_to_jiffies() instead of direct HZ division to avoid rounding errors. Signed-off-by: Nishanth Aravamudan Cc: "Brown, Len" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/osl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index d528c750a38..e3cd0b16031 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -313,8 +313,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) void acpi_os_sleep(acpi_integer ms) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(((signed long)ms * HZ) / 1000); + schedule_timeout_interruptible(msecs_to_jiffies(ms)); } EXPORT_SYMBOL(acpi_os_sleep); @@ -838,8 +837,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) ret = down_trylock(sem); for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); + schedule_timeout_interruptible(1); ret = down_trylock(sem); } -- cgit v1.2.3 From 6044ec8882c726e325017bd948aa0cd94ad33abc Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 7 Nov 2005 01:01:32 -0800 Subject: [PATCH] kfree cleanup: misc remaining drivers This is the remaining misc drivers/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in misc files in drivers/. Signed-off-by: Jesper Juhl Acked-by: Aristeu Sergio Rozanski Filho Acked-by: Roland Dreier Acked-by: Pierre Ossman Acked-by: Jean Delvare Acked-by: Greg Kroah-Hartman Acked-by: Len Brown Acked-by: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/container.c | 6 ++---- drivers/acpi/scan.c | 6 ++---- drivers/acpi/video.c | 12 ++++-------- 3 files changed, 8 insertions(+), 16 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 10dd695a1dd..27ec12c1fab 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -118,11 +118,9 @@ static int acpi_container_remove(struct acpi_device *device, int type) { acpi_status status = AE_OK; struct acpi_container *pc = NULL; - pc = (struct acpi_container *)acpi_driver_data(device); - - if (pc) - kfree(pc); + pc = (struct acpi_container *)acpi_driver_data(device); + kfree(pc); return status; } diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index c6db591479d..23e2c6968a1 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -28,8 +28,7 @@ static int acpi_bus_trim(struct acpi_device *start, int rmdevice); static void acpi_device_release(struct kobject *kobj) { struct acpi_device *dev = container_of(kobj, struct acpi_device, kobj); - if (dev->pnp.cid_list) - kfree(dev->pnp.cid_list); + kfree(dev->pnp.cid_list); kfree(dev); } @@ -1117,8 +1116,7 @@ acpi_add_single_object(struct acpi_device **child, if (!result) *child = device; else { - if (device->pnp.cid_list) - kfree(device->pnp.cid_list); + kfree(device->pnp.cid_list); kfree(device); } diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index e383d6109ae..f051b151580 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -334,8 +334,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, return_VALUE(0); err: - if (buffer.pointer) - kfree(buffer.pointer); + kfree(buffer.pointer); return_VALUE(status); } @@ -1488,8 +1487,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) } active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; - if (video->attached_array) - kfree(video->attached_array); + kfree(video->attached_array); video->attached_array = active_device_list; video->attached_count = count; @@ -1645,8 +1643,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) printk(KERN_WARNING PREFIX "hhuuhhuu bug in acpi video driver.\n"); - if (data->brightness) - kfree(data->brightness); + kfree(data->brightness); kfree(data); } @@ -1831,8 +1828,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) acpi_video_bus_put_devices(video); acpi_video_bus_remove_fs(device); - if (video->attached_array) - kfree(video->attached_array); + kfree(video->attached_array); kfree(video); return_VALUE(0); -- cgit v1.2.3 From 64c7c8f88559624abdbe12b5da6502e8879f8d28 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Tue, 8 Nov 2005 21:39:04 -0800 Subject: [PATCH] sched: resched and cpu_idle rework Make some changes to the NEED_RESCHED and POLLING_NRFLAG to reduce confusion, and make their semantics rigid. Improves efficiency of resched_task and some cpu_idle routines. * In resched_task: - TIF_NEED_RESCHED is only cleared with the task's runqueue lock held, and as we hold it during resched_task, then there is no need for an atomic test and set there. The only other time this should be set is when the task's quantum expires, in the timer interrupt - this is protected against because the rq lock is irq-safe. - If TIF_NEED_RESCHED is set, then we don't need to do anything. It won't get unset until the task get's schedule()d off. - If we are running on the same CPU as the task we resched, then set TIF_NEED_RESCHED and no further action is required. - If we are running on another CPU, and TIF_POLLING_NRFLAG is *not* set after TIF_NEED_RESCHED has been set, then we need to send an IPI. Using these rules, we are able to remove the test and set operation in resched_task, and make clear the previously vague semantics of POLLING_NRFLAG. * In idle routines: - Enter cpu_idle with preempt disabled. When the need_resched() condition becomes true, explicitly call schedule(). This makes things a bit clearer (IMO), but haven't updated all architectures yet. - Many do a test and clear of TIF_NEED_RESCHED for some reason. According to the resched_task rules, this isn't needed (and actually breaks the assumption that TIF_NEED_RESCHED is only cleared with the runqueue lock held). So remove that. Generally one less locked memory op when switching to the idle thread. - Many idle routines clear TIF_POLLING_NRFLAG, and only set it in the inner most polling idle loops. The above resched_task semantics allow it to be set until before the last time need_resched() is checked before going into a halt requiring interrupt wakeup. Many idle routines simply never enter such a halt, and so POLLING_NRFLAG can be always left set, completely eliminating resched IPIs when rescheduling the idle task. POLLING_NRFLAG width can be increased, to reduce the chance of resched IPIs. Signed-off-by: Nick Piggin Cc: Ingo Molnar Cc: Con Kolivas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/processor_idle.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 161db4acfb9..573b6a97bb1 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -167,6 +167,19 @@ acpi_processor_power_activate(struct acpi_processor *pr, return; } +static void acpi_safe_halt(void) +{ + int polling = test_thread_flag(TIF_POLLING_NRFLAG); + if (polling) { + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); + } + if (!need_resched()) + safe_halt(); + if (polling) + set_thread_flag(TIF_POLLING_NRFLAG); +} + static atomic_t c3_cpu_count; static void acpi_processor_idle(void) @@ -177,7 +190,7 @@ static void acpi_processor_idle(void) int sleep_ticks = 0; u32 t1, t2 = 0; - pr = processors[raw_smp_processor_id()]; + pr = processors[smp_processor_id()]; if (!pr) return; @@ -197,8 +210,13 @@ static void acpi_processor_idle(void) } cx = pr->power.state; - if (!cx) - goto easy_out; + if (!cx) { + if (pm_idle_save) + pm_idle_save(); + else + acpi_safe_halt(); + return; + } /* * Check BM Activity @@ -278,7 +296,8 @@ static void acpi_processor_idle(void) if (pm_idle_save) pm_idle_save(); else - safe_halt(); + acpi_safe_halt(); + /* * TBD: Can't get time duration while in C1, as resumes * go to an ISR rather than here. Need to instrument @@ -414,16 +433,6 @@ static void acpi_processor_idle(void) */ if (next_state != pr->power.state) acpi_processor_power_activate(pr, next_state); - - return; - - easy_out: - /* do C1 instead of busy loop */ - if (pm_idle_save) - pm_idle_save(); - else - safe_halt(); - return; } static int acpi_processor_set_power_policy(struct acpi_processor *pr) -- cgit v1.2.3 From a3a45ec8f8edaf088449e37fe81c99cbf580b9bd Mon Sep 17 00:00:00 2001 From: "rajesh.shah@intel.com" Date: Mon, 31 Oct 2005 16:20:12 -0800 Subject: [PATCH] pciehp: clean-up how we request control of hotplug hardware This patch further tweaks how we request control of hotplug controller hardware from BIOS. We first search the ACPI namespace corresponding to a specific hotplug controller looking for an _OSC or OSHP method. On failure, we successively move to the ACPI parent object, till we hit the highest level host bridge in the hierarchy. This allows for different types of BIOS's which place the _OSC/OSHP methods at various places in the acpi namespace, while still not encroaching on the namespace of some other root level host bridge. This patch also introduces a new load time option (pciehp_force) that allows us to bypass all _OSC/OSHP checking. Not supporting these methods seems to be be the most common ACPI firmware problem we've run into. This will still _not_ allow the pciehp driver to work correctly if the BIOS really doesn't support pciehp (i.e. if it doesn't generate a hotplug interrupt). Use this option with caution. Some BIOS's may deliberately not build any _OSC/OSHP methods to make sure it retains control the hotplug hardware. Using the pciehp_force parameter for such systems can lead to two separate entities trying to control the same hardware. Signed-off-by: Rajesh Shah Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/glue.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 3937adf4e5e..aa993715d64 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -203,6 +203,7 @@ acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus) acpi_get_devices(PCI_ROOT_HID_STRING, find_pci_rootbridge, &find, NULL); return find.handle; } +EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle); /* Get device's handler per its address under its parent */ struct acpi_find_child { -- cgit v1.2.3 From bca73e4bf8563d83f7856164caa44d5f42e44cca Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sun, 13 Nov 2005 16:06:25 -0800 Subject: [PATCH] move pm_register/etc. to CONFIG_PM_LEGACY, pm_legacy.h Since few people need the support anymore, this moves the legacy pm_xxx functions to CONFIG_PM_LEGACY, and include/linux/pm_legacy.h. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 6a4da417c16..606f8733a77 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #ifdef CONFIG_X86 @@ -754,7 +755,7 @@ static int __init acpi_init(void) result = acpi_bus_init(); if (!result) { -#ifdef CONFIG_PM +#ifdef CONFIG_PM_LEGACY if (!PM_IS_ACTIVE()) pm_active = 1; else { -- cgit v1.2.3 From 2203d6ed448ff3b777ee6bb614a53e686b483e5b Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 18 Nov 2005 07:29:51 -0800 Subject: Fix ACPI processor power block initialization Properly clear the memory, and set "pr->flags.power" only if a C2 or deeper state is valid (to make the code match both the comment and previous behaviour). This fixes a boot-time lockup reported by Maneesh Soni when using "maxcpus=1". Acked-by: Maneesh Soni Signed-off-by: Linus Torvalds --- drivers/acpi/processor_idle.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 573b6a97bb1..70d8a6ec092 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -514,8 +514,6 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) { - int i; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); if (!pr) @@ -524,8 +522,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) if (!pr->pblk) return_VALUE(-ENODEV); - for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); + memset(pr->power.states, 0, sizeof(pr->power.states)); /* if info is obtained from pblk/fadt, type equals state */ pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; @@ -555,13 +552,9 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) { - int i; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); - for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(&(pr->power.states[i]), 0, - sizeof(struct acpi_processor_cx)); + memset(pr->power.states, 0, sizeof(pr->power.states)); /* if info is obtained from pblk/fadt, type equals state */ pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; @@ -873,7 +866,8 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { if (pr->power.states[i].valid) { pr->power.count = i; - pr->flags.power = 1; + if (pr->power.states[i].type >= ACPI_STATE_C2) + pr->flags.power = 1; } } -- cgit v1.2.3 From 6d93c64803a5fea84839789aae13290419c62d92 Mon Sep 17 00:00:00 2001 From: Venkatesh Pallipadi Date: Thu, 15 Sep 2005 12:19:00 -0400 Subject: [ACPI] Prefer _CST over FADT for C-state capabilities Note: This ACPI standard compliance may cause regression on some system, if they have _CST present, but _CST value is bogus. "nocst" module parameter should workaround that regression. http://bugzilla.kernel.org/show_bug.cgi?id=5165 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown (cherry picked from 883baf7f7e81cca26f4683ae0d25ba48f094cc08 commit) --- drivers/acpi/processor_idle.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 70d8a6ec092..5b6a9865300 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -690,7 +690,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) /* Validate number of power states discovered */ if (pr->power.count < 2) - status = -ENODEV; + status = -EFAULT; end: acpi_os_free(buffer.pointer); @@ -841,11 +841,11 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) * this function */ result = acpi_processor_get_power_info_cst(pr); - if ((result) || (acpi_processor_power_verify(pr) < 2)) { + if (result == -ENODEV) result = acpi_processor_get_power_info_fadt(pr); - if ((result) || (acpi_processor_power_verify(pr) < 2)) - result = acpi_processor_get_power_info_default_c1(pr); - } + + if ((result) || (acpi_processor_power_verify(pr) < 2)) + result = acpi_processor_get_power_info_default_c1(pr); /* * Set Default Policy -- cgit v1.2.3 From 4c0335526c95d90a1d958e0059f40a5745fc7c5d Mon Sep 17 00:00:00 2001 From: Venkatesh Pallipadi Date: Thu, 15 Sep 2005 12:20:00 -0400 Subject: [ACPI] Add support for FADT P_LVL2_UP flag which tells us if C2 is valid for UP-only, or SMP. As there is no separate bit for C3, use P_LVL2_UP bit to cover both C2 and C3. http://bugzilla.kernel.org/show_bug.cgi?id=5165 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown (cherry picked from 28b86b368af3944eb383078fc5797caf2dc8ce44 commit) --- drivers/acpi/processor_idle.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 5b6a9865300..83fd1b6c10c 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -280,6 +280,16 @@ static void acpi_processor_idle(void) cx->usage++; +#ifdef CONFIG_HOTPLUG_CPU + /* + * Check for P_LVL2_UP flag before entering C2 and above on + * an SMP system. We do it here instead of doing it at _CST/P_LVL + * detection phase, to work cleanly with logical CPU hotplug. + */ + if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && + !pr->flags.has_cst && acpi_fadt.plvl2_up) + cx->type = ACPI_STATE_C1; +#endif /* * Sleep: * ------ @@ -534,6 +544,15 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) pr->power.states[ACPI_STATE_C0].valid = 1; pr->power.states[ACPI_STATE_C1].valid = 1; +#ifndef CONFIG_HOTPLUG_CPU + /* + * Check for P_LVL2_UP flag before entering C2 and above on + * an SMP system. + */ + if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up) + return_VALUE(-ENODEV); +#endif + /* determine C2 and C3 address from pblk */ pr->power.states[ACPI_STATE_C2].address = pr->pblk + 4; pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5; -- cgit v1.2.3 From bd7ce5b5ff930c29b1c0405051e9c9388660b785 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Mon, 3 Oct 2005 10:39:00 -0700 Subject: [ACPI] fix HP nx8220 boot hang regression This patch reverts the acpi_bus_find_driver() return value check that came in via the PCI tree via 3fb02738b0fd36f47710a2bf207129efd2f5daa2 [PATCH] acpi bridge hotadd: Allow ACPI .add and .start operations to be done independently This particular change broke booting of some HP/Compaq laptops unless acpi=noirq is used. http://bugzilla.kernel.org/show_bug.cgi?id=5221 https://bugzilla.novell.com/show_bug.cgi?id=116763 Signed-off-by: Thomas Renninger Cc: Rajesh Shah Signed-off-by: Len Brown --- drivers/acpi/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 23e2c6968a1..31218e1d2a1 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1110,7 +1110,7 @@ acpi_add_single_object(struct acpi_device **child, * * TBD: Assumes LDM provides driver hot-plug capability. */ - result = acpi_bus_find_driver(device); + acpi_bus_find_driver(device); end: if (!result) -- cgit v1.2.3 From 5d8e7aa6e5c21e14843404c5e4c04d4cf043e40e Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 22 Sep 2005 01:15:57 -0400 Subject: [ACPI] IA64 build: blacklist.c is used only on X86 Signed-off-by: Al Viro Signed-off-by: Len Brown (cherry picked from ef4611613657dfb8af8d336f2f61f08cfcdc9d8a commit) --- drivers/acpi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index a18243488c6..5984b4f6715 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -16,7 +16,7 @@ EXTRA_CFLAGS += $(ACPI_CFLAGS) # ACPI Boot-Time Table Parsing # obj-y += tables.o -obj-y += blacklist.o +obj-$(CONFIG_X86) += blacklist.o # # ACPI Core Subsystem (Interpreter) -- cgit v1.2.3 From 0a47c906342e2447003e207d23917dfa5c912071 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Wed, 30 Nov 2005 22:12:45 -0500 Subject: [ACPI] delete "default y" on Kconfig for ibm_acpi extras driver Signed-off-by: Borislav Petkov Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index fe1e8126fba..fce21c25752 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -197,7 +197,6 @@ config ACPI_ASUS config ACPI_IBM tristate "IBM ThinkPad Laptop Extras" depends on X86 - default y ---help--- This is a Linux ACPI driver for the IBM ThinkPad laptops. It adds support for Fn-Fx key combinations, Bluetooth control, video -- cgit v1.2.3 From 1cbf4c563c0eaaf11c552a88b374e213181c6ddd Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Thu, 16 Sep 2004 11:07:00 -0400 Subject: [ACPI] Allow return to active cooling mode once passive mode is entered http://bugzilla.kernel.org/show_bug.cgi?id=3410 https://bugzilla.novell.com/show_bug.cgi?id=131543 Signed-off-by: Thomas Renninger Signed-off-by: Konstantin Karasyov Signed-off-by: Alexey Starikovskiy Signed-off-by: Yu Luming Signed-off-by: Andrew Morton --- drivers/acpi/processor_thermal.c | 38 +++++---- drivers/acpi/thermal.c | 163 ++++++++++++++++++++------------------- 2 files changed, 108 insertions(+), 93 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 37528c3b64b..f3758401532 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -101,9 +101,7 @@ static unsigned int acpi_thermal_cpufreq_is_init = 0; static int cpu_has_cpufreq(unsigned int cpu) { struct cpufreq_policy policy; - if (!acpi_thermal_cpufreq_is_init) - return -ENODEV; - if (!cpufreq_get_policy(&policy, cpu)) + if (!acpi_thermal_cpufreq_is_init || cpufreq_get_policy(&policy, cpu)) return -ENODEV; return 0; } @@ -127,13 +125,13 @@ static int acpi_thermal_cpufreq_decrease(unsigned int cpu) if (!cpu_has_cpufreq(cpu)) return -ENODEV; - if (cpufreq_thermal_reduction_pctg[cpu] >= 20) { + if (cpufreq_thermal_reduction_pctg[cpu] > 20) cpufreq_thermal_reduction_pctg[cpu] -= 20; - cpufreq_update_policy(cpu); - return 0; - } - - return -ERANGE; + else + cpufreq_thermal_reduction_pctg[cpu] = 0; + cpufreq_update_policy(cpu); + /* We reached max freq again and can leave passive mode */ + return !cpufreq_thermal_reduction_pctg[cpu]; } static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, @@ -200,7 +198,7 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) int result = 0; struct acpi_processor *pr = NULL; struct acpi_device *device = NULL; - int tx = 0; + int tx = 0, max_tx_px = 0; ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit"); @@ -259,19 +257,27 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) /* if going down: T-states first, P-states later */ if (pr->flags.throttling) { - if (tx == 0) + if (tx == 0) { + max_tx_px = 1; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "At minimum throttling state\n")); - else { + } else { tx--; goto end; } } result = acpi_thermal_cpufreq_decrease(pr->id); - if (result == -ERANGE) + if (result) { + /* + * We only could get -ERANGE, 1 or 0. + * In the first two cases we reached max freq again. + */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "At minimum performance state\n")); + max_tx_px = 1; + } else + max_tx_px = 0; break; } @@ -290,8 +296,10 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) pr->limit.thermal.px, pr->limit.thermal.tx)); } else result = 0; - - return_VALUE(result); + if (max_tx_px) + return_VALUE(1); + else + return_VALUE(result); } int acpi_processor_get_limit_info(struct acpi_processor *pr) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index a24847c08f7..19f3ea48475 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -72,7 +72,7 @@ #define _COMPONENT ACPI_THERMAL_COMPONENT ACPI_MODULE_NAME("acpi_thermal") - MODULE_AUTHOR("Paul Diefenbaugh"); +MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_THERMAL_DRIVER_NAME); MODULE_LICENSE("GPL"); @@ -517,9 +517,9 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) return_VALUE(0); } -static int acpi_thermal_passive(struct acpi_thermal *tz) +static void acpi_thermal_passive(struct acpi_thermal *tz) { - int result = 0; + int result = 1; struct acpi_thermal_passive *passive = NULL; int trend = 0; int i = 0; @@ -527,7 +527,7 @@ static int acpi_thermal_passive(struct acpi_thermal *tz) ACPI_FUNCTION_TRACE("acpi_thermal_passive"); if (!tz || !tz->trips.passive.flags.valid) - return_VALUE(-EINVAL); + return; passive = &(tz->trips.passive); @@ -547,7 +547,7 @@ static int acpi_thermal_passive(struct acpi_thermal *tz) trend, passive->tc1, tz->temperature, tz->last_temperature, passive->tc2, tz->temperature, passive->temperature)); - tz->trips.passive.flags.enabled = 1; + passive->flags.enabled = 1; /* Heating up? */ if (trend > 0) for (i = 0; i < passive->devices.count; i++) @@ -556,12 +556,32 @@ static int acpi_thermal_passive(struct acpi_thermal *tz) handles[i], ACPI_PROCESSOR_LIMIT_INCREMENT); /* Cooling off? */ - else if (trend < 0) + else if (trend < 0) { for (i = 0; i < passive->devices.count; i++) - acpi_processor_set_thermal_limit(passive-> - devices. - handles[i], - ACPI_PROCESSOR_LIMIT_DECREMENT); + /* + * assume that we are on highest + * freq/lowest thrott and can leave + * passive mode, even in error case + */ + if (!acpi_processor_set_thermal_limit + (passive->devices.handles[i], + ACPI_PROCESSOR_LIMIT_DECREMENT)) + result = 0; + /* + * Leave cooling mode, even if the temp might + * higher than trip point This is because some + * machines might have long thermal polling + * frequencies (tsp) defined. We will fall back + * into passive mode in next cycle (probably quicker) + */ + if (result) { + passive->flags.enabled = 0; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Disabling passive cooling, still above threshold," + " but we are cooling down\n")); + } + } + return; } /* @@ -571,23 +591,21 @@ static int acpi_thermal_passive(struct acpi_thermal *tz) * and avoid thrashing around the passive trip point. Note that we * assume symmetry. */ - else if (tz->trips.passive.flags.enabled) { - for (i = 0; i < passive->devices.count; i++) - result = - acpi_processor_set_thermal_limit(passive->devices. - handles[i], - ACPI_PROCESSOR_LIMIT_DECREMENT); - if (result == 1) { - tz->trips.passive.flags.enabled = 0; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Disabling passive cooling (zone is cool)\n")); - } + if (!passive->flags.enabled) + return; + for (i = 0; i < passive->devices.count; i++) + if (!acpi_processor_set_thermal_limit + (passive->devices.handles[i], + ACPI_PROCESSOR_LIMIT_DECREMENT)) + result = 0; + if (result) { + passive->flags.enabled = 0; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Disabling passive cooling (zone is cool)\n")); } - - return_VALUE(0); } -static int acpi_thermal_active(struct acpi_thermal *tz) +static void acpi_thermal_active(struct acpi_thermal *tz) { int result = 0; struct acpi_thermal_active *active = NULL; @@ -598,74 +616,66 @@ static int acpi_thermal_active(struct acpi_thermal *tz) ACPI_FUNCTION_TRACE("acpi_thermal_active"); if (!tz) - return_VALUE(-EINVAL); + return; for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { - active = &(tz->trips.active[i]); if (!active || !active->flags.valid) break; - - /* - * Above Threshold? - * ---------------- - * If not already enabled, turn ON all cooling devices - * associated with this active threshold. - */ if (tz->temperature >= active->temperature) { + /* + * Above Threshold? + * ---------------- + * If not already enabled, turn ON all cooling devices + * associated with this active threshold. + */ if (active->temperature > maxtemp) - tz->state.active_index = i, maxtemp = - active->temperature; - if (!active->flags.enabled) { - for (j = 0; j < active->devices.count; j++) { - result = - acpi_bus_set_power(active->devices. - handles[j], - ACPI_STATE_D0); - if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'on'\n", - active-> - devices. - handles[j])); - continue; - } - active->flags.enabled = 1; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Cooling device [%p] now 'on'\n", - active->devices. - handles[j])); - } - } - } - /* - * Below Threshold? - * ---------------- - * Turn OFF all cooling devices associated with this - * threshold. - */ - else if (active->flags.enabled) { + tz->state.active_index = i; + maxtemp = active->temperature; + if (active->flags.enabled) + continue; for (j = 0; j < active->devices.count; j++) { result = acpi_bus_set_power(active->devices. handles[j], - ACPI_STATE_D3); + ACPI_STATE_D0); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'off'\n", + "Unable to turn cooling device [%p] 'on'\n", active->devices. handles[j])); continue; } - active->flags.enabled = 0; + active->flags.enabled = 1; ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Cooling device [%p] now 'off'\n", + "Cooling device [%p] now 'on'\n", active->devices.handles[j])); } + continue; + } + if (!active->flags.enabled) + continue; + /* + * Below Threshold? + * ---------------- + * Turn OFF all cooling devices associated with this + * threshold. + */ + for (j = 0; j < active->devices.count; j++) { + result = acpi_bus_set_power(active->devices.handles[j], + ACPI_STATE_D3); + if (result) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Unable to turn cooling device [%p] 'off'\n", + active->devices.handles[j])); + continue; + } + active->flags.enabled = 0; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Cooling device [%p] now 'off'\n", + active->devices.handles[j])); } } - - return_VALUE(0); } static void acpi_thermal_check(void *context); @@ -744,15 +754,12 @@ static void acpi_thermal_check(void *data) * Again, separated from the above two to allow independent policy * decisions. */ - if (tz->trips.critical.flags.enabled) - tz->state.critical = 1; - if (tz->trips.hot.flags.enabled) - tz->state.hot = 1; - if (tz->trips.passive.flags.enabled) - tz->state.passive = 1; + tz->state.critical = tz->trips.critical.flags.enabled; + tz->state.hot = tz->trips.hot.flags.enabled; + tz->state.passive = tz->trips.passive.flags.enabled; + tz->state.active = 0; for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) - if (tz->trips.active[i].flags.enabled) - tz->state.active = 1; + tz->state.active |= tz->trips.active[i].flags.enabled; /* * Calculate Sleep Time -- cgit v1.2.3 From 59d399d357a7705568f424c6e861ee8657f7f655 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Tue, 8 Nov 2005 05:27:00 -0500 Subject: [ACPI] Fix Null pointer deref in video/lcd/brightness http://bugzilla.kernel.org/show_bug.cgi?id=5571 Signed-off-by: Thomas Renninger Signed-off-by: Nishanth Aravamudan Signed-off-by: Yu Luming Cc: Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f051b151580..d10668f1469 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -812,7 +812,7 @@ acpi_video_device_write_brightness(struct file *file, ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness"); - if (!dev || count + 1 > sizeof str) + if (!dev || !dev->brightness || count + 1 > sizeof str) return_VALUE(-EINVAL); if (copy_from_user(str, buffer, count)) -- cgit v1.2.3 From cd8e2b48daee891011a4f21e2c62b210d24dcc9e Mon Sep 17 00:00:00 2001 From: Venkatesh Pallipadi Date: Fri, 21 Oct 2005 19:22:00 -0400 Subject: [ACPI] fix 2.6.13 boot hang regression on HT box w/ broken BIOS http://bugzilla.kernel.org/show_bug.cgi?id=5452 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown --- drivers/acpi/processor_core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 42179256264..0c561c571f2 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -543,6 +543,8 @@ static int acpi_processor_get_info(struct acpi_processor *pr) return_VALUE(0); } +static void *processor_device_array[NR_CPUS]; + static int acpi_processor_start(struct acpi_device *device) { int result = 0; @@ -561,6 +563,19 @@ static int acpi_processor_start(struct acpi_device *device) BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); + /* + * Buggy BIOS check + * ACPI id of processors can be reported wrongly by the BIOS. + * Don't trust it blindly + */ + if (processor_device_array[pr->id] != NULL && + processor_device_array[pr->id] != (void *)device) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id" + "for the processor\n")); + return_VALUE(-ENODEV); + } + processor_device_array[pr->id] = (void *)device; + processors[pr->id] = pr; result = acpi_processor_add_fs(device); -- cgit v1.2.3 From 2a298a35ebe060a6f2b06b20c2a34ea188ddfd37 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Fri, 2 Dec 2005 12:44:19 +1100 Subject: [PATCH] Fix TIF_POLLING_NRFLAG in ACPI idle routines Commit 64c7c8f88559624abdbe12b5da6502e8879f8d28 broke the ACPI C2 and C3 sleep states, because it left TIF_POLLING_NRFLAG active even though those states do not actually poll the reschedule flag at all. As a result, the CPU wouldn't get sent an IPI when it was to be woken up, and would only notice that it had runnable processes on the next timer tick. Signed-off-by: Linus Torvalds --- drivers/acpi/processor_idle.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 83fd1b6c10c..acd875e0cac 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -169,15 +169,11 @@ acpi_processor_power_activate(struct acpi_processor *pr, static void acpi_safe_halt(void) { - int polling = test_thread_flag(TIF_POLLING_NRFLAG); - if (polling) { - clear_thread_flag(TIF_POLLING_NRFLAG); - smp_mb__after_clear_bit(); - } + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); if (!need_resched()) safe_halt(); - if (polling) - set_thread_flag(TIF_POLLING_NRFLAG); + set_thread_flag(TIF_POLLING_NRFLAG); } static atomic_t c3_cpu_count; @@ -295,6 +291,15 @@ static void acpi_processor_idle(void) * ------ * Invoke the current Cx state to put the processor to sleep. */ + if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) { + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); + if (need_resched()) { + set_thread_flag(TIF_POLLING_NRFLAG); + return; + } + } + switch (cx->type) { case ACPI_STATE_C1: @@ -327,6 +332,7 @@ static void acpi_processor_idle(void) t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Re-enable interrupts */ local_irq_enable(); + set_thread_flag(TIF_POLLING_NRFLAG); /* Compute time (ticks) that we were actually asleep */ sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; @@ -366,6 +372,7 @@ static void acpi_processor_idle(void) /* Re-enable interrupts */ local_irq_enable(); + set_thread_flag(TIF_POLLING_NRFLAG); /* Compute time (ticks) that we were actually asleep */ sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; -- cgit v1.2.3 From af2eb17bac41a116b73d85b3fb160405c32bea5b Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 2 Dec 2005 23:09:06 -0800 Subject: Add missing "local_irq_enable()" to C2/C3 exit logic Silly bug crept in with the C2/C3 TIF_POLLING_NRFLAG fixes. Signed-off-by: Linus Torvalds --- drivers/acpi/processor_idle.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index acd875e0cac..5f51057518b 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -296,6 +296,7 @@ static void acpi_processor_idle(void) smp_mb__after_clear_bit(); if (need_resched()) { set_thread_flag(TIF_POLLING_NRFLAG); + local_irq_enable(); return; } } -- cgit v1.2.3 From 1e483969930a82e16767884449f3a121a817ef00 Mon Sep 17 00:00:00 2001 From: David Shaohua Li Date: Thu, 1 Dec 2005 17:00:00 -0500 Subject: [ACPI] correct earlier SMP deep C-states on HT patch http://bugzilla.kernel.org/show_bug.cgi?id=5165 Change polarity of test for PLVL2_UP flag. Skip promotion/demotion code when not needed. Signed-off-by: Shaohua Li Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown --- drivers/acpi/processor_idle.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 83fd1b6c10c..800f99c4c0e 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -278,8 +278,6 @@ static void acpi_processor_idle(void) } } - cx->usage++; - #ifdef CONFIG_HOTPLUG_CPU /* * Check for P_LVL2_UP flag before entering C2 and above on @@ -287,9 +285,12 @@ static void acpi_processor_idle(void) * detection phase, to work cleanly with logical CPU hotplug. */ if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && - !pr->flags.has_cst && acpi_fadt.plvl2_up) - cx->type = ACPI_STATE_C1; + !pr->flags.has_cst && !acpi_fadt.plvl2_up) + cx = &pr->power.states[ACPI_STATE_C1]; #endif + + cx->usage++; + /* * Sleep: * ------ @@ -378,6 +379,15 @@ static void acpi_processor_idle(void) next_state = pr->power.state; +#ifdef CONFIG_HOTPLUG_CPU + /* Don't do promotion/demotion */ + if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) && + !pr->flags.has_cst && !acpi_fadt.plvl2_up) { + next_state = cx; + goto end; + } +#endif + /* * Promotion? * ---------- @@ -549,7 +559,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) * Check for P_LVL2_UP flag before entering C2 and above on * an SMP system. */ - if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up) + if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) return_VALUE(-ENODEV); #endif -- cgit v1.2.3