linux/drivers/acpi
Ingo Molnar e4233dec74 [PATCH] ACPI: fix cpufreq regression
Recently cpufreq support on my laptop (Lenovo T60) broke completely: when
it's plugged into AC it would never go higher than 1 GHz - neither 1.3 GHz
nor 1.83 GHz is possible - no matter which governor (userspace, speed or
ondemand) is used.

After some cpufreq debugging i tracked the regression back to the following
(totally correct) bug-fix commit:

   commit 0916bd3ebb
   Author: Dave Jones <davej@redhat.com>
   Date:   Wed Nov 22 20:42:01 2006 -0500

    [PATCH] Correct bound checking from the value returned from _PPC method.

This bugfix, which makes other laptops work, made a previously hidden
(BIOS) bug visible on my laptop.

The bug is the following: if the _PPC (Performance Present Capabilities)
optional ACPI object is queried /after/ bootup then the BIOS reports an
incorrect value of '2'.

My laptop (Lenovo T60) has the following performance states supported:

   0: 1833000
   1: 1333000
   2: 1000000

Per ACPI specification, a _PPC value of '0' means that all 3 performance
states are usable.  A _PPC value of '1' means states 1 ..  2 are usable, a
value of '2' means only state '2' (slowest) is usable.

now, the _PPC object is optional, and it also comes with notification.
Furthermore, when a CPU object is initialized, the _PPC object is
initialized as well.  So the following evaluation of the _PPC object is
superfluous:

 [<c028ba5f>] acpi_processor_get_platform_limit+0xa1/0xaf
 [<c028c040>] acpi_processor_register_performance+0x3b9/0x3ef
 [<c0111a85>] acpi_cpufreq_cpu_init+0xb7/0x596
 [<c03dab74>] cpufreq_add_dev+0x160/0x4a8
 [<c02bed90>] sysdev_driver_register+0x5a/0xa0
 [<c03d9c4c>] cpufreq_register_driver+0xb4/0x176
 [<c068ac08>] acpi_cpufreq_init+0xe5/0xeb
 [<c010056e>] init+0x14f/0x3dd

And this is the point where my laptop's BIOS returns the incorrect value of
'2'.  Note that it has not sent any notification event, so the value is
probably not really intentional (possibly spurious), and Windows likely
doesnt query it after bootup either.  Maybe the value is kept at '2'
normally, and is only set to the real value when a true asynchronous event
(such as AC plug event, battery switch, etc.) occurs.

So i /think/ this is a grey area of the ACPI spec: per the letter of the
spec the _PPC value only changes when notified, so there's no reason to
query it after the system has booted up.  So in my opinion the best (and
most compatible) strategy would be to do the change below, and to not
evaluate the _PPC object in the acpi_processor_get_performance_info() call,
but only evaluate it if _PPC is present during CPU object init, or if it's
notified during an asynchronous event.  This change is more permissive than
the previous logic, so it definitely shouldnt break any existing system.

This also happens to fix my laptop, which is merrily chugging along at
1.83 GHz now. Yay!

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Dave Jones <davej@redhat.com>
Acked-by: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-01-26 13:50:58 -08:00
..
dispatcher ACPI: ACPICA 20060707 2006-07-09 15:15:40 -04:00
events ACPI: Get rid of 'unused variable' warning in acpi_ev_global_lock_handler() 2006-11-06 15:14:56 -05:00
executer ACPI: avoid gcc warnings in ACPI mutex debug code 2006-10-21 01:19:33 -04:00
hardware ACPI: Allow setting SCI_EN bit in PM1_CONTROL register 2006-10-10 17:14:44 -07:00
namespace ACPI: Add support for acpi_load_table/acpi_unload_table_id 2006-12-20 01:51:14 -05:00
parser ACPI: acpi_os_allocate() fixes 2006-07-10 02:37:22 -04:00
resources ACPI: ACPICA 20060526 2006-06-14 02:44:35 -04:00
sleep ACPI: update comment 2006-11-06 15:19:51 -05:00
tables ACPI: Add support for acpi_load_table/acpi_unload_table_id 2006-12-20 01:51:14 -05:00
utilities ACPI: avoid gcc warnings in ACPI mutex debug code 2006-10-21 01:19:33 -04:00
ac.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
acpi_memhotplug.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
asus_acpi.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
battery.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
blacklist.c [PATCH] x86_64: Clean up and tweak ACPI blacklist year code 2006-03-25 09:10:54 -08:00
bus.c ACPI: Altix: ACPI _PRT support 2007-01-04 12:18:19 -05:00
button.c ACPI: button: register with input layer 2006-11-09 03:20:19 -05:00
cm_sbs.c [PATCH] acpi NULL noise removal 2006-10-10 15:37:22 -07:00
container.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
debug.c ACPI: delete tracing macros from drivers/acpi/*.c 2006-06-27 00:41:40 -04:00
dock.c Pull style into test branch 2006-12-16 01:04:27 -05:00
ec.c ACPI: ec: enable printk on cmdline use 2007-01-06 00:02:07 -05:00
event.c ACPI: add 'const' to several ACPI file_operations 2006-07-10 00:04:29 -04:00
fan.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
glue.c Pull style into test branch 2006-12-16 01:04:27 -05:00
hotkey.c ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpi 2006-10-14 01:51:07 -04:00
i2c_ec.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
i2c_ec.h ACPI: add support for Smart Battery 2006-07-01 16:36:14 -04:00
ibm_acpi.c Revert "ACPI: ibm-acpi: make non-generic bay support optional" 2007-01-11 02:58:15 -05:00
Kconfig Revert "ACPI: ibm-acpi: make non-generic bay support optional" 2007-01-11 02:58:15 -05:00
Makefile Revert "Revert "ACPI: dock driver"" 2006-07-09 17:22:28 -04:00
motherboard.c ACPI: update comments in motherboard.c 2006-10-14 01:56:27 -04:00
numa.c ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpi 2006-10-14 01:51:07 -04:00
osl.c Pull bugfix into test branch 2006-12-20 02:52:50 -05:00
pci_bind.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
pci_irq.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
pci_link.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
pci_root.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
power.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
processor_core.c ACPI: delete two spurious ACPI messages 2007-01-10 23:16:36 -05:00
processor_idle.c Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2006-12-22 18:46:56 -08:00
processor_perflib.c [PATCH] ACPI: fix cpufreq regression 2007-01-26 13:50:58 -08:00
processor_thermal.c ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpi 2006-10-14 01:51:07 -04:00
processor_throttling.c ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpi 2006-10-14 01:51:07 -04:00
sbs.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
scan.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
system.c ACPI: add 'const' to several ACPI file_operations 2006-07-10 00:04:29 -04:00
tables.c ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpi 2006-10-14 01:51:07 -04:00
thermal.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
toshiba_acpi.c [PATCH] fix the toshiba_acpi write_lcd return value 2007-01-05 23:55:29 -08:00
utils.c ACPI: replace kmalloc+memset with kzalloc 2006-12-20 16:54:54 -05:00
video.c [PATCH] acpi: remove "video device notify" message 2007-01-23 07:52:07 -08:00