2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* acpi_processor.c - ACPI Processor Driver ($Revision: 71 $)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
|
|
|
|
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
|
|
|
* Copyright (C) 2004 Dominik Brodowski <linux@brodo.de>
|
|
|
|
* Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
|
|
|
|
* - Added processor hotplug support
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
* TBD:
|
|
|
|
* 1. Make # power states dynamic.
|
|
|
|
* 2. Support duty_cycle values that span bit 4.
|
|
|
|
* 3. Optimize by having scheduler determine business instead of
|
|
|
|
* having us try to calculate it here.
|
|
|
|
* 4. Need C1 timing -- must modify kernel (IRQ handler) to get this.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/pm.h>
|
|
|
|
#include <linux/cpufreq.h>
|
|
|
|
#include <linux/cpu.h>
|
|
|
|
#include <linux/dmi.h>
|
|
|
|
#include <linux/moduleparam.h>
|
cpuidle: consolidate 2.6.22 cpuidle branch into one patch
commit e5a16b1f9eec0af7cfa0830304b41c1c0833cf9f
Author: Len Brown <len.brown@intel.com>
Date: Tue Oct 2 23:44:44 2007 -0400
cpuidle: shrink diff
processor_idle.c | 440 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 429 insertions(+), 11 deletions(-)
Signed-off-by: Len Brown <len.brown@intel.com>
commit dfbb9d5aedfb18848a3e0d6f6e3e4969febb209c
Author: Len Brown <len.brown@intel.com>
Date: Wed Sep 26 02:17:55 2007 -0400
cpuidle: reduce diff size
Reduces the cpuidle processor_idle.c diff vs 2.6.22 from this
processor_idle.c | 2006 ++++++++++++++++++++++++++-----------------
1 file changed, 1219 insertions(+), 787 deletions(-)
to this:
processor_idle.c | 502 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 458 insertions(+), 44 deletions(-)
...for the purpose of making the cpuilde patch less invasive
and easier to review.
no functional changes. build tested only.
Signed-off-by: Len Brown <len.brown@intel.com>
commit 889172fc915f5a7fe20f35b133cbd205ce69bf6c
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Sep 13 13:40:05 2007 -0700
cpuidle: Retain old ACPI policy for !CONFIG_CPU_IDLE
Retain the old policy in processor_idle, so that when CPU_IDLE is not
configured, old C-state policy will still be used. This provides a
clean gradual migration path from old ACPI policy to new cpuidle
based policy.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 9544a8181edc7ecc33b3bfd69271571f98ed08bc
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Sep 13 13:39:17 2007 -0700
cpuidle: Configure governors by default
Quoting Len "Do not give an option to users to shoot themselves in the foot".
Remove the configurability of ladder and menu governors as they are
needed for default policy of cpuidle. That way users will not be able to
have cpuidle without any policy loosing all C-state power savings.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 8975059a2c1e56cfe83d1bcf031bcf4cb39be743
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:27:07 2007 -0400
CPUIDLE: load ACPI properly when CPUIDLE is disabled
Change the registration return codes for when CPUIDLE
support is not compiled into the kernel. As a result, the ACPI
processor driver will load properly even if CPUIDLE is unavailable.
However, it may be possible to cleanup the ACPI processor driver further
and eliminate some dead code paths.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit e0322e2b58dd1b12ec669bf84693efe0dc2414a8
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:26:06 2007 -0400
CPUIDLE: remove cpuidle_get_bm_activity()
Remove cpuidle_get_bm_activity() and updates governors
accordingly.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 18a6e770d5c82ba26653e53d240caa617e09e9ab
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:25:58 2007 -0400
CPUIDLE: max_cstate fix
Currently max_cstate is limited to 0, resulting in no idle processor
power management on ACPI platforms. This patch restores the value to
the array size.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 1fdc0887286179b40ce24bcdbde663172e205ef0
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:25:40 2007 -0400
CPUIDLE: handle BM detection inside the ACPI Processor driver
Update the ACPI processor driver to detect BM activity and
limit state entry depth internally, rather than exposing such
requirements to CPUIDLE. As a result, CPUIDLE can drop this
ACPI-specific interface and become more platform independent. BM
activity is now handled much more aggressively than it was in the
original implementation, so some testing coverage may be needed to
verify that this doesn't introduce any DMA buffer under-run issues.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0ef38840db666f48e3cdd2b769da676c57228dd9
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:25:14 2007 -0400
CPUIDLE: menu governor updates
Tweak the menu governor to more effectively handle non-timer
break events. Non-timer break events are detected by comparing the
actual sleep time to the expected sleep time. In future revisions, it
may be more reliable to use the timer data structures directly.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit bb4d74fca63fa96cf3ace644b15ae0f12b7df5a1
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:24:40 2007 -0400
CPUIDLE: fix 'current_governor' sysfs entry
Allow the "current_governor" sysfs entry to properly handle
input terminated with '\n'.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit df3c71559bb69b125f1a48971bf0d17f78bbdf47
Author: Len Brown <len.brown@intel.com>
Date: Sun Aug 12 02:00:45 2007 -0400
cpuidle: fix IA64 build (again)
Signed-off-by: Len Brown <len.brown@intel.com>
commit a02064579e3f9530fd31baae16b1fc46b5a7bca8
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Sun Aug 12 01:39:27 2007 -0400
cpuidle: Remove support for runtime changing of max_cstate
Remove support for runtime changeability of max_cstate. Drivers can use
use latency APIs.
max_cstate can still be used as a boot time option and dmi override.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0912a44b13adf22f5e3f607d263aed23b4910d7e
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Sun Aug 12 01:39:16 2007 -0400
cpuidle: Remove ACPI cstate_limit calls from ipw2100
ipw2100 already has code to use accetable_latency interfaces to limit the
C-state. Remove the calls to acpi_set_cstate_limit and acpi_get_cstate_limit
as they are redundant.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit c649a76e76be6bff1fd770d0a775798813a3f6e0
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Sun Aug 12 01:35:39 2007 -0400
cpuidle: compile fix for pause and resume functions
Fix the compilation failure when cpuidle is not compiled in.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Acked-by: Adam Belay <adam.belay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 2305a5920fb8ee6ccec1c62ade05aa8351091d71
Author: Adam Belay <abelay@novell.com>
Date: Thu Jul 19 00:49:00 2007 -0400
cpuidle: re-write
Some portions have been rewritten to make the code cleaner and lighter
weight. The following is a list of changes:
1.) the state name is now included in the sysfs interface
2.) detection, hotplug, and available state modifications are handled by
CPUIDLE drivers directly
3.) the CPUIDLE idle handler is only ever installed when at least one
cpuidle_device is enabled and ready
4.) the menu governor BM code no longer overflows
5.) the sysfs attributes are now printed as unsigned integers, avoiding
negative values
6.) a variety of other small cleanups
Also, Idle drivers are no longer swappable during runtime through the
CPUIDLE sysfs inteface. On i386 and x86_64 most idle handlers (e.g.
poll, mwait, halt, etc.) don't benefit from an infrastructure that
supports multiple states, so I think using a more general case idle
handler selection mechanism would be cleaner.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Acked-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit df25b6b56955714e6e24b574d88d1fd11f0c3ee5
Author: Len Brown <len.brown@intel.com>
Date: Tue Jul 24 17:08:21 2007 -0400
cpuidle: fix IA64 buid
Signed-off-by: Len Brown <len.brown@intel.com>
commit fd6ada4c14488755ff7068860078c437431fbccd
Author: Adrian Bunk <bunk@stusta.de>
Date: Mon Jul 9 11:33:13 2007 -0700
cpuidle: static
make cpuidle_replace_governor() static
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit c1d4a2cebcadf2429c0c72e1d29aa2a9684c32e0
Author: Adrian Bunk <bunk@stusta.de>
Date: Tue Jul 3 00:54:40 2007 -0400
cpuidle: static
This patch makes the needlessly global struct menu_governor static.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit dbf8780c6e8d572c2c273da97ed1cca7608fd999
Author: Andrew Morton <akpm@linux-foundation.org>
Date: Tue Jul 3 00:49:14 2007 -0400
export symbol tick_nohz_get_sleep_length
ERROR: "tick_nohz_get_sleep_length" [drivers/cpuidle/governors/menu.ko] undefined!
ERROR: "tick_nohz_get_idle_jiffies" [drivers/cpuidle/governors/menu.ko] undefined!
And please be sure to get your changes to core kernel suitably reviewed.
Cc: Adam Belay <abelay@novell.com>
Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 29f0e248e7017be15f99febf9143a2cef00b2961
Author: Andrew Morton <akpm@linux-foundation.org>
Date: Tue Jul 3 00:43:04 2007 -0400
tick.h needs hrtimer.h
It uses hrtimers.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit e40cede7d63a029e92712a3fe02faee60cc38fb4
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:40:34 2007 -0400
cpuidle: first round of documentation updates
Documentation changes based on Pavel's feedback.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 83b42be2efece386976507555c29e7773a0dfcd1
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:39:25 2007 -0400
cpuidle: add rating to the governors and pick the one with highest rating by default
Introduce a governor rating scheme to pick the right governor by default.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit d2a74b8c5e8f22def4709330d4bfc4a29209b71c
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:38:08 2007 -0400
cpuidle: make cpuidle sysfs driver governor switch off by default
Make default cpuidle sysfs to show current_governor and current_driver in
read-only mode. More elaborate available_governors and available_drivers with
writeable current_governor and current_driver interface only appear with
"cpuidle_sysfs_switch" boot parameter.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 1f60a0e80bf83cf6b55c8845bbe5596ed8f6307b
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:37:00 2007 -0400
cpuidle: menu governor: change the early break condition
Change the C-state early break out algorithm in menu governor.
We only look at early breakouts that result in wakeups shorter than idle
state's target_residency. If such a breakout is frequent enough, eliminate
the particular idle state upto a timeout period.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 45a42095cf64b003b4a69be3ce7f434f97d7af51
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:35:38 2007 -0400
cpuidle: fix uninitialized variable in sysfs routine
Fix the uninitialized usage of ret.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 80dca7cdba3e6ee13eae277660873ab9584eb3be
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:34:16 2007 -0400
cpuidle: reenable /proc/acpi//power interface for the time being
Keep /proc/acpi/processor/CPU*/power around for a while as powertop depends
on it. It will be marked deprecated and removed in future. powertop can use
cpuidle interfaces instead.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 589c37c2646c5e3813a51255a5ee1159cb4c33fc
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:32:37 2007 -0400
cpuidle: menu governor and hrtimer compile fix
Compile fix for menu governor.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0ba80bd9ab3ed304cb4f19b722e4cc6740588b5e
Author: Len Brown <len.brown@intel.com>
Date: Thu May 31 22:51:43 2007 -0400
cpuidle: build fix - cpuidle vs ipw2100 module
ERROR: "acpi_set_cstate_limit" [drivers/net/wireless/ipw2100.ko] undefined!
Signed-off-by: Len Brown <len.brown@intel.com>
commit d7d8fa7f96a7f7682be7c6cc0cc53fa7a18c3b58
Author: Adam Belay <abelay@novell.com>
Date: Sat Mar 24 03:47:07 2007 -0400
cpuidle: add the 'menu' governor
Here is my first take at implementing an idle PM governor that takes
full advantage of NO_HZ. I call it the 'menu' governor because it
considers the full list of idle states before each entry.
I've kept the implementation fairly simple. It attempts to guess the
next residency time and then chooses a state that would meet at least
the break-even point between power savings and entry cost. To this end,
it selects the deepest idle state that satisfies the following
constraints:
1. If the idle time elapsed since bus master activity was detected
is below a threshold (currently 20 ms), then limit the selection
to C2-type or above.
2. Do not choose a state with a break-even residency that exceeds
the expected time remaining until the next timer interrupt.
3. Do not choose a state with a break-even residency that exceeds
the elapsed time between the last pair of break events,
excluding timer interrupts.
This governor has an advantage over "ladder" governor because it
proactively checks how much time remains until the next timer interrupt
using the tick infrastructure. Also, it handles device interrupt
activity more intelligently by not including timer interrupts in break
event calculations. Finally, it doesn't make policy decisions using the
number of state entries, which can have variable residency times (NO_HZ
makes these potentially very large), and instead only considers sleep
time deltas.
The menu governor can be selected during runtime using the cpuidle sysfs
interface like so:
"echo "menu" > /sys/devices/system/cpu/cpuidle/current_governor"
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit a4bec7e65aa3b7488b879d971651cc99a6c410fe
Author: Adam Belay <abelay@novell.com>
Date: Sat Mar 24 03:47:03 2007 -0400
cpuidle: export time until next timer interrupt using NO_HZ
Expose information about the time remaining until the next
timer interrupt expires by utilizing the dynticks infrastructure.
Also modify the main idle loop to allow dynticks to handle
non-interrupt break events (e.g. DMA). Finally, expose sleep ticks
information to external code. Thomas Gleixner is responsible for much
of the code in this patch. However, I've made some additional changes,
so I'm probably responsible if there are any bugs or oversights :)
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 2929d8996fbc77f41a5ff86bb67cdde3ca7d2d72
Author: Adam Belay <abelay@novell.com>
Date: Sat Mar 24 03:46:58 2007 -0400
cpuidle: governor API changes
This patch prepares cpuidle for the menu governor. It adds an optional
stage after idle state entry to give the governor an opportunity to
check why the state was exited. Also it makes sure the idle loop
returns after each state entry, allowing the appropriate dynticks code
to run.
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 3a7fd42f9825c3b03e364ca59baa751bb350775f
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Apr 26 00:03:59 2007 -0700
cpuidle: hang fix
Prevent hang on x86-64, when ACPI processor driver is added as a module on
a system that does not support C-states.
x86-64 expects all idle handlers to enable interrupts before returning from
idle handler. This is due to enter_idle(), exit_idle() races. Make
cpuidle_idle_call() confirm to this when there is no pm_idle_old.
Also, cpuidle look at the return values of attch_driver() and set
current_driver to NULL if attach fails on all CPUs.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 4893339a142afbd5b7c01ffadfd53d14746e858e
Author: Shaohua Li <shaohua.li@intel.com>
Date: Thu Apr 26 10:40:09 2007 +0800
cpuidle: add support for max_cstate limit
With CPUIDLE framework, the max_cstate (to limit max cpu c-state)
parameter is ingored. Some systems require it to ignore C2/C3
and some drivers like ipw require it too.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 43bbbbe1cb998cbd2df656f55bb3bfe30f30e7d1
Author: Shaohua Li <shaohua.li@intel.com>
Date: Thu Apr 26 10:40:13 2007 +0800
cpuidle: add cpuidle_fore_redetect_devices API
add cpuidle_force_redetect_devices API,
which forces all CPU redetect idle states.
Next patch will use it.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit d1edadd608f24836def5ec483d2edccfb37b1d19
Author: Shaohua Li <shaohua.li@intel.com>
Date: Thu Apr 26 10:40:01 2007 +0800
cpuidle: fix sysfs related issue
Fix the cpuidle sysfs issue.
a. make kobject dynamicaly allocated
b. fixed sysfs init issue to avoid suspend/resume issue
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 7169a5cc0d67b263978859672e86c13c23a5570d
Author: Randy Dunlap <randy.dunlap@oracle.com>
Date: Wed Mar 28 22:52:53 2007 -0400
cpuidle: 1-bit field must be unsigned
A 1-bit bitfield has no room for a sign bit.
drivers/cpuidle/governors/ladder.c:54:16: error: dubious bitfield without explicit `signed' or `unsigned'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 4658620158dc2fbd9e4bcb213c5b6fb5d05ba7d4
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Wed Mar 28 22:52:41 2007 -0400
cpuidle: fix boot hang
Patch for cpuidle boot hang reported by Larry Finger here.
http://www.ussg.iu.edu/hypermail/linux/kernel/0703.2/2025.html
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Larry Finger <larry.finger@lwfinger.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit c17e168aa6e5fe3851baaae8df2fbc1cf11443a9
Author: Len Brown <len.brown@intel.com>
Date: Wed Mar 7 04:37:53 2007 -0500
cpuidle: ladder does not depend on ACPI
build fix for CONFIG_ACPI=n
In file included from drivers/cpuidle/governors/ladder.c:21:
include/acpi/processor.h:88: error: expected specifier-qualifier-list before âacpi_integerâ
include/acpi/processor.h:106: error: expected specifier-qualifier-list before âacpi_integerâ
include/acpi/processor.h:168: error: expected specifier-qualifier-list before âacpi_handleâ
Signed-off-by: Len Brown <len.brown@intel.com>
commit 8c91d958246bde68db0c3f0c57b535962ce861cb
Author: Adrian Bunk <bunk@stusta.de>
Date: Tue Mar 6 02:29:40 2007 -0800
cpuidle: make code static
This patch makes the following needlessly global code static:
- driver.c: __cpuidle_find_driver()
- governor.c: __cpuidle_find_governor()
- ladder.c: struct ladder_governor
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Adam Belay <abelay@novell.com>
Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0c39dc3187094c72c33ab65a64d2017b21f372d2
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Wed Mar 7 02:38:22 2007 -0500
cpu_idle: fix build break
This patch fixes a build breakage with !CONFIG_HOTPLUG_CPU and
CONFIG_CPU_IDLE.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 8112e3b115659b07df340ef170515799c0105f82
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Mar 6 02:29:39 2007 -0800
cpuidle: build fix for !CPU_IDLE
Fix the compile issues when CPU_IDLE is not configured.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Adam Belay <abelay@novell.com>
Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 1eb4431e9599cd25e0d9872f3c2c8986821839dd
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Feb 22 13:54:57 2007 -0800
cpuidle take2: Basic documentation for cpuidle
Documentation for cpuidle infrastructure
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit ef5f15a8b79123a047285ec2e3899108661df779
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Feb 22 13:54:03 2007 -0800
cpuidle take2: Hookup ACPI C-states driver with cpuidle
Hookup ACPI C-states onto generic cpuidle infrastructure.
drivers/acpi/procesor_idle.c is now a ACPI C-states driver that registers as
a driver in cpuidle infrastructure and the policy part is removed from
drivers/acpi/processor_idle.c. We use governor in cpuidle instead.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 987196fa82d4db52c407e8c9d5dec884ba602183
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Feb 22 13:52:57 2007 -0800
cpuidle take2: Core cpuidle infrastructure
Announcing 'cpuidle', a new CPU power management infrastructure to manage
idle CPUs in a clean and efficient manner.
cpuidle separates out the drivers that can provide support for multiple types
of idle states and policy governors that decide on what idle state to use
at run time.
A cpuidle driver can support multiple idle states based on parameters like
varying power consumption, wakeup latency, etc (ACPI C-states for example).
A cpuidle governor can be usage model specific (laptop, server,
laptop on battery etc).
Main advantage of the infrastructure being, it allows independent development
of drivers and governors and allows for better CPU power management.
A huge thanks to Adam Belay and Shaohua Li who were part of this mini-project
since its beginning and are greatly responsible for this patchset.
This patch:
Core cpuidle infrastructure.
Introduces a new abstraction layer for cpuidle:
* which manages drivers that can support multiple idles states. Drivers
can be generic or particular to specific hardware/platform
* allows pluging in multiple policy governors that can take idle state policy
decision
* The core also has a set of sysfs interfaces with which administrato can know
about supported drivers and governors and switch them at run time.
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-04 06:58:00 +08:00
|
|
|
#include <linux/cpuidle.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2012-11-21 07:42:27 +08:00
|
|
|
#include <linux/acpi.h>
|
2013-02-23 08:33:29 +08:00
|
|
|
#include <linux/memory_hotplug.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/cpu.h>
|
|
|
|
#include <asm/delay.h>
|
|
|
|
#include <asm/uaccess.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/smp.h>
|
|
|
|
#include <asm/acpi.h>
|
|
|
|
|
|
|
|
#include <acpi/acpi_bus.h>
|
|
|
|
#include <acpi/acpi_drivers.h>
|
|
|
|
#include <acpi/processor.h>
|
|
|
|
|
2009-07-29 04:45:54 +08:00
|
|
|
#define PREFIX "ACPI: "
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define ACPI_PROCESSOR_CLASS "processor"
|
|
|
|
#define ACPI_PROCESSOR_DEVICE_NAME "Processor"
|
|
|
|
#define ACPI_PROCESSOR_FILE_INFO "info"
|
|
|
|
#define ACPI_PROCESSOR_FILE_THROTTLING "throttling"
|
|
|
|
#define ACPI_PROCESSOR_FILE_LIMIT "limit"
|
|
|
|
#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
|
|
|
|
#define ACPI_PROCESSOR_NOTIFY_POWER 0x81
|
2007-05-26 22:49:58 +08:00
|
|
|
#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
|
2012-03-20 03:08:02 +08:00
|
|
|
#define ACPI_PROCESSOR_DEVICE_HID "ACPI0007"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define ACPI_PROCESSOR_LIMIT_USER 0
|
|
|
|
#define ACPI_PROCESSOR_LIMIT_THERMAL 1
|
|
|
|
|
|
|
|
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
|
2010-02-23 03:11:08 +08:00
|
|
|
ACPI_MODULE_NAME("processor_driver");
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-02-13 11:42:12 +08:00
|
|
|
MODULE_AUTHOR("Paul Diefenbaugh");
|
2007-02-13 12:50:02 +08:00
|
|
|
MODULE_DESCRIPTION("ACPI Processor Driver");
|
2005-04-17 06:20:36 +08:00
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static int acpi_processor_add(struct acpi_device *device);
|
2013-01-24 07:24:48 +08:00
|
|
|
static int acpi_processor_remove(struct acpi_device *device);
|
2009-03-31 01:48:24 +08:00
|
|
|
static void acpi_processor_notify(struct acpi_device *device, u32 event);
|
2012-01-18 05:40:07 +08:00
|
|
|
static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr);
|
2005-04-17 06:20:36 +08:00
|
|
|
static int acpi_processor_handle_eject(struct acpi_processor *pr);
|
2012-01-20 01:18:43 +08:00
|
|
|
static int acpi_processor_start(struct acpi_processor *pr);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-07-23 20:44:41 +08:00
|
|
|
static const struct acpi_device_id processor_device_ids[] = {
|
2008-11-05 05:52:55 +08:00
|
|
|
{ACPI_PROCESSOR_OBJECT_HID, 0},
|
2012-03-20 03:08:02 +08:00
|
|
|
{ACPI_PROCESSOR_DEVICE_HID, 0},
|
2007-07-23 20:44:41 +08:00
|
|
|
{"", 0},
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(acpi, processor_device_ids);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static struct acpi_driver acpi_processor_driver = {
|
2007-02-13 12:33:40 +08:00
|
|
|
.name = "processor",
|
2005-08-05 12:44:28 +08:00
|
|
|
.class = ACPI_PROCESSOR_CLASS,
|
2007-07-23 20:44:41 +08:00
|
|
|
.ids = processor_device_ids,
|
2005-08-05 12:44:28 +08:00
|
|
|
.ops = {
|
|
|
|
.add = acpi_processor_add,
|
|
|
|
.remove = acpi_processor_remove,
|
2009-03-31 01:48:24 +08:00
|
|
|
.notify = acpi_processor_notify,
|
2005-08-05 12:44:28 +08:00
|
|
|
},
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define INSTALL_NOTIFY_HANDLER 1
|
|
|
|
#define UNINSTALL_NOTIFY_HANDLER 2
|
|
|
|
|
2008-06-10 07:22:23 +08:00
|
|
|
DEFINE_PER_CPU(struct acpi_processor *, processors);
|
2009-12-18 04:18:27 +08:00
|
|
|
EXPORT_PER_CPU_SYMBOL(processors);
|
|
|
|
|
2006-06-23 17:04:27 +08:00
|
|
|
struct acpi_processor_errata errata __read_mostly;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
Errata Handling
|
|
|
|
-------------------------------------------------------------------------- */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static int acpi_processor_errata_piix4(struct pci_dev *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
u8 value1 = 0;
|
|
|
|
u8 value2 = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
if (!dev)
|
2006-06-27 12:41:40 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Note that 'dev' references the PIIX4 ACPI Controller.
|
|
|
|
*/
|
|
|
|
|
2007-06-09 06:46:36 +08:00
|
|
|
switch (dev->revision) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case 0:
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n"));
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n"));
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n"));
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n"));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-06-09 06:46:36 +08:00
|
|
|
switch (dev->revision) {
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
case 0: /* PIIX4 A-step */
|
|
|
|
case 1: /* PIIX4 B-step */
|
|
|
|
/*
|
|
|
|
* See specification changes #13 ("Manual Throttle Duty Cycle")
|
|
|
|
* and #14 ("Enabling and Disabling Manual Throttle"), plus
|
|
|
|
* erratum #5 ("STPCLK# Deassertion Time") from the January
|
|
|
|
* 2002 PIIX4 specification update. Applies to only older
|
|
|
|
* PIIX4 models.
|
|
|
|
*/
|
|
|
|
errata.piix4.throttle = 1;
|
|
|
|
|
|
|
|
case 2: /* PIIX4E */
|
|
|
|
case 3: /* PIIX4M */
|
|
|
|
/*
|
|
|
|
* See erratum #18 ("C3 Power State/BMIDE and Type-F DMA
|
|
|
|
* Livelock") from the January 2002 PIIX4 specification update.
|
|
|
|
* Applies to all PIIX4 models.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BM-IDE
|
|
|
|
* ------
|
|
|
|
* Find the PIIX4 IDE Controller and get the Bus Master IDE
|
|
|
|
* Status register address. We'll use this later to read
|
|
|
|
* each IDE controller's DMA status to make sure we catch all
|
|
|
|
* DMA activity.
|
|
|
|
*/
|
|
|
|
dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
|
2005-08-05 12:44:28 +08:00
|
|
|
PCI_DEVICE_ID_INTEL_82371AB,
|
|
|
|
PCI_ANY_ID, PCI_ANY_ID, NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (dev) {
|
|
|
|
errata.piix4.bmisx = pci_resource_start(dev, 4);
|
|
|
|
pci_dev_put(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type-F DMA
|
|
|
|
* ----------
|
|
|
|
* Find the PIIX4 ISA Controller and read the Motherboard
|
|
|
|
* DMA controller's status to see if Type-F (Fast) DMA mode
|
|
|
|
* is enabled (bit 7) on either channel. Note that we'll
|
|
|
|
* disable C3 support if this is enabled, as some legacy
|
|
|
|
* devices won't operate well if fast DMA is disabled.
|
|
|
|
*/
|
|
|
|
dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
|
2005-08-05 12:44:28 +08:00
|
|
|
PCI_DEVICE_ID_INTEL_82371AB_0,
|
|
|
|
PCI_ANY_ID, PCI_ANY_ID, NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (dev) {
|
|
|
|
pci_read_config_byte(dev, 0x76, &value1);
|
|
|
|
pci_read_config_byte(dev, 0x77, &value2);
|
|
|
|
if ((value1 & 0x80) || (value2 & 0x80))
|
|
|
|
errata.piix4.fdma = 1;
|
|
|
|
pci_dev_put(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (errata.piix4.bmisx)
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
2005-08-05 12:44:28 +08:00
|
|
|
"Bus master activity detection (BM-IDE) erratum enabled\n"));
|
2005-04-17 06:20:36 +08:00
|
|
|
if (errata.piix4.fdma)
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
2005-08-05 12:44:28 +08:00
|
|
|
"Type-F DMA livelock erratum (C3 disabled)\n"));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-09-03 05:16:48 +08:00
|
|
|
static int acpi_processor_errata(struct acpi_processor *pr)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
int result = 0;
|
|
|
|
struct pci_dev *dev = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
if (!pr)
|
2006-06-27 12:41:40 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* PIIX4
|
|
|
|
*/
|
|
|
|
dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
|
2005-08-05 12:44:28 +08:00
|
|
|
PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID,
|
|
|
|
PCI_ANY_ID, NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (dev) {
|
|
|
|
result = acpi_processor_errata_piix4(dev);
|
|
|
|
pci_dev_put(dev);
|
|
|
|
}
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return result;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
Driver Interface
|
|
|
|
-------------------------------------------------------------------------- */
|
|
|
|
|
2008-11-05 05:53:00 +08:00
|
|
|
static int acpi_processor_get_info(struct acpi_device *device)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = 0;
|
|
|
|
union acpi_object object = { 0 };
|
|
|
|
struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
|
2008-11-05 05:53:00 +08:00
|
|
|
struct acpi_processor *pr;
|
|
|
|
int cpu_index, device_declaration = 0;
|
2005-08-05 12:44:28 +08:00
|
|
|
static int cpu0_initialized;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-11-05 05:53:00 +08:00
|
|
|
pr = acpi_driver_data(device);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!pr)
|
2006-06-27 12:41:40 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (num_online_cpus() > 1)
|
|
|
|
errata.smp = TRUE;
|
|
|
|
|
|
|
|
acpi_processor_errata(pr);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if we have bus mastering arbitration control. This
|
|
|
|
* is required for proper C3 usage (to maintain cache coherency).
|
|
|
|
*/
|
2007-02-03 00:48:22 +08:00
|
|
|
if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) {
|
2005-04-17 06:20:36 +08:00
|
|
|
pr->flags.bm_control = 1;
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
2005-08-05 12:44:28 +08:00
|
|
|
"Bus mastering arbitration control present\n"));
|
|
|
|
} else
|
2005-04-17 06:20:36 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
2005-08-05 12:44:28 +08:00
|
|
|
"No bus mastering arbitration control\n"));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-04-28 06:33:41 +08:00
|
|
|
if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
|
|
|
|
/* Declared with "Processor" statement; match ProcessorID */
|
|
|
|
status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2012-11-21 07:42:27 +08:00
|
|
|
dev_err(&device->dev,
|
|
|
|
"Failed to evaluate processor object (0x%x)\n",
|
|
|
|
status);
|
2009-04-28 06:33:41 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
|
|
|
|
* >>> 'acpi_get_processor_id(acpi_id, &id)' in
|
|
|
|
* arch/xxx/acpi.c
|
|
|
|
*/
|
|
|
|
pr->acpi_id = object.processor.proc_id;
|
|
|
|
} else {
|
2008-11-05 05:53:00 +08:00
|
|
|
/*
|
|
|
|
* Declared with "Device" statement; match _UID.
|
|
|
|
* Note that we don't handle string _UIDs yet.
|
|
|
|
*/
|
2008-10-10 14:22:59 +08:00
|
|
|
unsigned long long value;
|
2007-02-03 00:48:23 +08:00
|
|
|
status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
|
|
|
|
NULL, &value);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2012-11-21 07:42:27 +08:00
|
|
|
dev_err(&device->dev,
|
|
|
|
"Failed to evaluate processor _UID (0x%x)\n",
|
|
|
|
status);
|
2007-02-03 00:48:23 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
2008-11-05 05:53:00 +08:00
|
|
|
device_declaration = 1;
|
2007-02-03 00:48:23 +08:00
|
|
|
pr->acpi_id = value;
|
|
|
|
}
|
2010-02-23 03:11:19 +08:00
|
|
|
cpu_index = acpi_get_cpuid(pr->handle, device_declaration, pr->acpi_id);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
/* Handle UP system running SMP kernel, with no LAPIC in MADT */
|
2006-03-29 06:04:00 +08:00
|
|
|
if (!cpu0_initialized && (cpu_index == -1) &&
|
2005-08-05 12:44:28 +08:00
|
|
|
(num_online_cpus() == 1)) {
|
|
|
|
cpu_index = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
cpu0_initialized = 1;
|
|
|
|
|
|
|
|
pr->id = cpu_index;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Extra Processor objects may be enumerated on MP systems with
|
|
|
|
* less than the max # of CPUs. They should be ignored _iff
|
|
|
|
* they are physically not present.
|
|
|
|
*/
|
2007-02-03 00:48:23 +08:00
|
|
|
if (pr->id == -1) {
|
2012-01-18 05:40:07 +08:00
|
|
|
if (ACPI_FAILURE(acpi_processor_hotadd_init(pr)))
|
2006-06-27 12:41:40 +08:00
|
|
|
return -ENODEV;
|
2005-08-05 12:44:28 +08:00
|
|
|
}
|
2009-06-24 11:46:44 +08:00
|
|
|
/*
|
|
|
|
* On some boxes several processors use the same processor bus id.
|
|
|
|
* But they are located in different scope. For example:
|
|
|
|
* \_SB.SCK0.CPU0
|
|
|
|
* \_SB.SCK1.CPU0
|
|
|
|
* Rename the processor device bus id. And the new bus id will be
|
|
|
|
* generated as the following format:
|
|
|
|
* CPU+CPU ID.
|
|
|
|
*/
|
|
|
|
sprintf(acpi_device_bid(device), "CPU%X", pr->id);
|
2005-04-17 06:20:36 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
|
2005-08-05 12:44:28 +08:00
|
|
|
pr->acpi_id));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!object.processor.pblk_address)
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n"));
|
|
|
|
else if (object.processor.pblk_length != 6)
|
2012-11-21 07:42:27 +08:00
|
|
|
dev_err(&device->dev, "Invalid PBLK length [%d]\n",
|
2006-06-27 11:41:38 +08:00
|
|
|
object.processor.pblk_length);
|
2005-04-17 06:20:36 +08:00
|
|
|
else {
|
|
|
|
pr->throttling.address = object.processor.pblk_address;
|
2007-02-03 00:48:22 +08:00
|
|
|
pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset;
|
|
|
|
pr->throttling.duty_width = acpi_gbl_FADT.duty_width;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
pr->pblk = object.processor.pblk_address;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We don't care about error returns - we just try to mark
|
|
|
|
* these reserved so that nobody else is confused into thinking
|
|
|
|
* that this region might be unused..
|
|
|
|
*
|
|
|
|
* (In particular, allocating the IO range for Cardbus)
|
|
|
|
*/
|
|
|
|
request_region(pr->throttling.address, 6, "ACPI CPU throttle");
|
|
|
|
}
|
|
|
|
|
2008-04-30 06:05:29 +08:00
|
|
|
/*
|
|
|
|
* If ACPI describes a slot number for this CPU, we can use it
|
|
|
|
* ensure we get the right value in the "physical id" field
|
|
|
|
* of /proc/cpuinfo
|
|
|
|
*/
|
|
|
|
status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer);
|
|
|
|
if (ACPI_SUCCESS(status))
|
|
|
|
arch_fix_phys_package_id(pr->id, object.integer.value);
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-06-10 07:22:23 +08:00
|
|
|
static DEFINE_PER_CPU(void *, processor_device_array);
|
2005-10-22 07:22:00 +08:00
|
|
|
|
2009-03-31 01:48:24 +08:00
|
|
|
static void acpi_processor_notify(struct acpi_device *device, u32 event)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-03-31 01:48:24 +08:00
|
|
|
struct acpi_processor *pr = acpi_driver_data(device);
|
2007-11-21 08:23:32 +08:00
|
|
|
int saved;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!pr)
|
2006-06-27 12:41:40 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
switch (event) {
|
|
|
|
case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
|
2007-11-21 08:23:32 +08:00
|
|
|
saved = pr->performance_platform_limit;
|
2009-10-16 09:20:41 +08:00
|
|
|
acpi_processor_ppc_has_changed(pr, 1);
|
2007-11-21 08:23:32 +08:00
|
|
|
if (saved == pr->performance_platform_limit)
|
|
|
|
break;
|
2007-08-24 03:20:26 +08:00
|
|
|
acpi_bus_generate_proc_event(device, event,
|
2005-08-05 12:44:28 +08:00
|
|
|
pr->performance_platform_limit);
|
2007-08-23 01:24:31 +08:00
|
|
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
ACPI: struct device - replace bus_id with dev_name(), dev_set_name()
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".
To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.
We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.
We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-10-30 08:18:59 +08:00
|
|
|
dev_name(&device->dev), event,
|
2007-08-23 01:24:31 +08:00
|
|
|
pr->performance_platform_limit);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
case ACPI_PROCESSOR_NOTIFY_POWER:
|
|
|
|
acpi_processor_cst_has_changed(pr);
|
2007-08-24 03:20:26 +08:00
|
|
|
acpi_bus_generate_proc_event(device, event, 0);
|
2007-08-23 01:24:31 +08:00
|
|
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
ACPI: struct device - replace bus_id with dev_name(), dev_set_name()
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".
To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.
We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.
We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-10-30 08:18:59 +08:00
|
|
|
dev_name(&device->dev), event, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2007-05-26 22:49:58 +08:00
|
|
|
case ACPI_PROCESSOR_NOTIFY_THROTTLING:
|
|
|
|
acpi_processor_tstate_has_changed(pr);
|
2007-08-24 03:20:26 +08:00
|
|
|
acpi_bus_generate_proc_event(device, event, 0);
|
2007-08-23 01:24:31 +08:00
|
|
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
ACPI: struct device - replace bus_id with dev_name(), dev_set_name()
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".
To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.
We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.
We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-10-30 08:18:59 +08:00
|
|
|
dev_name(&device->dev), event, 0);
|
2012-10-26 07:05:56 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
default:
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
2005-08-05 12:44:28 +08:00
|
|
|
"Unsupported event [0x%x]\n", event));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2007-09-16 21:36:43 +08:00
|
|
|
static int acpi_cpu_soft_notify(struct notifier_block *nfb,
|
|
|
|
unsigned long action, void *hcpu)
|
|
|
|
{
|
|
|
|
unsigned int cpu = (unsigned long)hcpu;
|
2008-06-10 07:22:23 +08:00
|
|
|
struct acpi_processor *pr = per_cpu(processors, cpu);
|
2007-09-16 21:36:43 +08:00
|
|
|
|
|
|
|
if (action == CPU_ONLINE && pr) {
|
2012-01-20 01:18:43 +08:00
|
|
|
/* CPU got physically hotplugged and onlined the first time:
|
|
|
|
* Initialize missing things
|
|
|
|
*/
|
|
|
|
if (pr->flags.need_hotplug_init) {
|
2012-11-21 07:42:27 +08:00
|
|
|
pr_info("Will online and init hotplugged CPU: %d\n",
|
|
|
|
pr->id);
|
2012-01-20 01:18:43 +08:00
|
|
|
WARN(acpi_processor_start(pr), "Failed to start CPU:"
|
|
|
|
" %d\n", pr->id);
|
|
|
|
pr->flags.need_hotplug_init = 0;
|
|
|
|
/* Normal CPU soft online event */
|
|
|
|
} else {
|
|
|
|
acpi_processor_ppc_has_changed(pr, 0);
|
2012-07-31 12:44:43 +08:00
|
|
|
acpi_processor_hotplug(pr);
|
2012-01-20 01:18:43 +08:00
|
|
|
acpi_processor_reevaluate_tstate(pr, action);
|
|
|
|
acpi_processor_tstate_has_changed(pr);
|
|
|
|
}
|
2007-09-16 21:36:43 +08:00
|
|
|
}
|
2011-01-10 16:35:45 +08:00
|
|
|
if (action == CPU_DEAD && pr) {
|
|
|
|
/* invalidate the flag.throttling after one CPU is offline */
|
|
|
|
acpi_processor_reevaluate_tstate(pr, action);
|
|
|
|
}
|
2007-09-16 21:36:43 +08:00
|
|
|
return NOTIFY_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct notifier_block acpi_cpu_notifier =
|
|
|
|
{
|
|
|
|
.notifier_call = acpi_cpu_soft_notify,
|
|
|
|
};
|
|
|
|
|
2012-01-20 01:18:43 +08:00
|
|
|
/*
|
|
|
|
* acpi_processor_start() is called by the cpu_hotplug_notifier func:
|
|
|
|
* acpi_cpu_soft_notify(). Getting it __cpuinit{data} is difficult, the
|
|
|
|
* root cause seem to be that acpi_processor_uninstall_hotplug_notify()
|
|
|
|
* is in the module_exit (__exit) func. Allowing acpi_processor_start()
|
|
|
|
* to not be in __cpuinit section, but being called from __cpuinit funcs
|
|
|
|
* via __ref looks like the right thing to do here.
|
|
|
|
*/
|
|
|
|
static __ref int acpi_processor_start(struct acpi_processor *pr)
|
ACPI processor hotplug: Split up acpi_processor_add
No functional change.
This is needed because:
When a CPU gets hotplugged, it's totally uninitialized
and offline. cpuinfo_x86 struct (cpu_data(cpu)) is mostly
zero (CPU feature flags, model, family,..).
When a CPU gets hotplugged, struct processor is alloc'd,
some sysfs files are set up but acpi_processor_add()
must not try to access a MSR on this CPU or try to read
out CPU feature,family, etc.
This must be done in acpi_processor_start().
The next patch will delay the call of acpi_processor_start()
for physically hotpluggedcores, to the time when they are onlined
the first time. There it is safe then to access cpu_data(cpu)
cpuinfo_x86 struct or access MSRs which is needed to
set up cpuidle, throttling and other features.
Tested and
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2012-01-20 01:18:42 +08:00
|
|
|
{
|
|
|
|
struct acpi_device *device = per_cpu(processor_device_array, pr->id);
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_FREQ
|
|
|
|
acpi_processor_ppc_has_changed(pr, 0);
|
2012-02-08 03:45:57 +08:00
|
|
|
acpi_processor_load_module(pr);
|
ACPI processor hotplug: Split up acpi_processor_add
No functional change.
This is needed because:
When a CPU gets hotplugged, it's totally uninitialized
and offline. cpuinfo_x86 struct (cpu_data(cpu)) is mostly
zero (CPU feature flags, model, family,..).
When a CPU gets hotplugged, struct processor is alloc'd,
some sysfs files are set up but acpi_processor_add()
must not try to access a MSR on this CPU or try to read
out CPU feature,family, etc.
This must be done in acpi_processor_start().
The next patch will delay the call of acpi_processor_start()
for physically hotpluggedcores, to the time when they are onlined
the first time. There it is safe then to access cpu_data(cpu)
cpuinfo_x86 struct or access MSRs which is needed to
set up cpuidle, throttling and other features.
Tested and
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2012-01-20 01:18:42 +08:00
|
|
|
#endif
|
|
|
|
acpi_processor_get_throttling_info(pr);
|
|
|
|
acpi_processor_get_limit_info(pr);
|
|
|
|
|
|
|
|
if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
|
2012-09-16 04:42:54 +08:00
|
|
|
acpi_processor_power_init(pr);
|
ACPI processor hotplug: Split up acpi_processor_add
No functional change.
This is needed because:
When a CPU gets hotplugged, it's totally uninitialized
and offline. cpuinfo_x86 struct (cpu_data(cpu)) is mostly
zero (CPU feature flags, model, family,..).
When a CPU gets hotplugged, struct processor is alloc'd,
some sysfs files are set up but acpi_processor_add()
must not try to access a MSR on this CPU or try to read
out CPU feature,family, etc.
This must be done in acpi_processor_start().
The next patch will delay the call of acpi_processor_start()
for physically hotpluggedcores, to the time when they are onlined
the first time. There it is safe then to access cpu_data(cpu)
cpuinfo_x86 struct or access MSRs which is needed to
set up cpuidle, throttling and other features.
Tested and
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2012-01-20 01:18:42 +08:00
|
|
|
|
|
|
|
pr->cdev = thermal_cooling_device_register("Processor", device,
|
|
|
|
&processor_cooling_ops);
|
|
|
|
if (IS_ERR(pr->cdev)) {
|
|
|
|
result = PTR_ERR(pr->cdev);
|
|
|
|
goto err_power_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_dbg(&device->dev, "registered as cooling_device%d\n",
|
|
|
|
pr->cdev->id);
|
|
|
|
|
|
|
|
result = sysfs_create_link(&device->dev.kobj,
|
|
|
|
&pr->cdev->device.kobj,
|
|
|
|
"thermal_cooling");
|
|
|
|
if (result) {
|
2012-11-21 07:42:27 +08:00
|
|
|
dev_err(&device->dev,
|
|
|
|
"Failed to create sysfs link 'thermal_cooling'\n");
|
ACPI processor hotplug: Split up acpi_processor_add
No functional change.
This is needed because:
When a CPU gets hotplugged, it's totally uninitialized
and offline. cpuinfo_x86 struct (cpu_data(cpu)) is mostly
zero (CPU feature flags, model, family,..).
When a CPU gets hotplugged, struct processor is alloc'd,
some sysfs files are set up but acpi_processor_add()
must not try to access a MSR on this CPU or try to read
out CPU feature,family, etc.
This must be done in acpi_processor_start().
The next patch will delay the call of acpi_processor_start()
for physically hotpluggedcores, to the time when they are onlined
the first time. There it is safe then to access cpu_data(cpu)
cpuinfo_x86 struct or access MSRs which is needed to
set up cpuidle, throttling and other features.
Tested and
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2012-01-20 01:18:42 +08:00
|
|
|
goto err_thermal_unregister;
|
|
|
|
}
|
|
|
|
result = sysfs_create_link(&pr->cdev->device.kobj,
|
|
|
|
&device->dev.kobj,
|
|
|
|
"device");
|
|
|
|
if (result) {
|
2012-11-21 07:42:27 +08:00
|
|
|
dev_err(&pr->cdev->device,
|
|
|
|
"Failed to create sysfs link 'device'\n");
|
ACPI processor hotplug: Split up acpi_processor_add
No functional change.
This is needed because:
When a CPU gets hotplugged, it's totally uninitialized
and offline. cpuinfo_x86 struct (cpu_data(cpu)) is mostly
zero (CPU feature flags, model, family,..).
When a CPU gets hotplugged, struct processor is alloc'd,
some sysfs files are set up but acpi_processor_add()
must not try to access a MSR on this CPU or try to read
out CPU feature,family, etc.
This must be done in acpi_processor_start().
The next patch will delay the call of acpi_processor_start()
for physically hotpluggedcores, to the time when they are onlined
the first time. There it is safe then to access cpu_data(cpu)
cpuinfo_x86 struct or access MSRs which is needed to
set up cpuidle, throttling and other features.
Tested and
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2012-01-20 01:18:42 +08:00
|
|
|
goto err_remove_sysfs_thermal;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_remove_sysfs_thermal:
|
|
|
|
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
|
|
|
|
err_thermal_unregister:
|
|
|
|
thermal_cooling_device_unregister(pr->cdev);
|
|
|
|
err_power_exit:
|
2012-09-16 04:42:54 +08:00
|
|
|
acpi_processor_power_exit(pr);
|
ACPI processor hotplug: Split up acpi_processor_add
No functional change.
This is needed because:
When a CPU gets hotplugged, it's totally uninitialized
and offline. cpuinfo_x86 struct (cpu_data(cpu)) is mostly
zero (CPU feature flags, model, family,..).
When a CPU gets hotplugged, struct processor is alloc'd,
some sysfs files are set up but acpi_processor_add()
must not try to access a MSR on this CPU or try to read
out CPU feature,family, etc.
This must be done in acpi_processor_start().
The next patch will delay the call of acpi_processor_start()
for physically hotpluggedcores, to the time when they are onlined
the first time. There it is safe then to access cpu_data(cpu)
cpuinfo_x86 struct or access MSRs which is needed to
set up cpuidle, throttling and other features.
Tested and
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2012-01-20 01:18:42 +08:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-01-20 01:18:43 +08:00
|
|
|
/*
|
|
|
|
* Do not put anything in here which needs the core to be online.
|
|
|
|
* For example MSR access or setting up things which check for cpuinfo_x86
|
|
|
|
* (cpu_data(cpu)) values, like CPU feature flags, family, model, etc.
|
|
|
|
* Such things have to be put in and set up above in acpi_processor_start()
|
|
|
|
*/
|
2009-11-06 05:51:40 +08:00
|
|
|
static int __cpuinit acpi_processor_add(struct acpi_device *device)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_processor *pr = NULL;
|
2009-06-23 04:41:19 +08:00
|
|
|
int result = 0;
|
2011-12-22 06:29:42 +08:00
|
|
|
struct device *dev;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-12-20 04:56:11 +08:00
|
|
|
pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!pr)
|
2006-06-27 12:41:40 +08:00
|
|
|
return -ENOMEM;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-06-07 05:51:36 +08:00
|
|
|
if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
|
2012-03-15 16:32:05 +08:00
|
|
|
result = -ENOMEM;
|
|
|
|
goto err_free_pr;
|
2009-01-01 10:08:47 +08:00
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
pr->handle = device->handle;
|
|
|
|
strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
|
|
|
|
strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
|
2008-09-23 05:37:34 +08:00
|
|
|
device->driver_data = pr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-11-05 05:53:00 +08:00
|
|
|
result = acpi_processor_get_info(device);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (result) {
|
|
|
|
/* Processor is physically not present */
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-05-26 23:03:33 +08:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
if (pr->id >= setup_max_cpus && pr->id != 0)
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
|
2013-02-27 12:27:30 +08:00
|
|
|
BUG_ON(pr->id >= nr_cpu_ids);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-10-22 07:22:00 +08:00
|
|
|
/*
|
|
|
|
* Buggy BIOS check
|
|
|
|
* ACPI id of processors can be reported wrongly by the BIOS.
|
|
|
|
* Don't trust it blindly
|
|
|
|
*/
|
2008-06-10 07:22:23 +08:00
|
|
|
if (per_cpu(processor_device_array, pr->id) != NULL &&
|
|
|
|
per_cpu(processor_device_array, pr->id) != device) {
|
2012-11-21 07:42:27 +08:00
|
|
|
dev_warn(&device->dev,
|
|
|
|
"BIOS reported wrong ACPI id %d for the processor\n",
|
|
|
|
pr->id);
|
2009-06-23 04:41:19 +08:00
|
|
|
result = -ENODEV;
|
|
|
|
goto err_free_cpumask;
|
2005-10-22 07:22:00 +08:00
|
|
|
}
|
2008-06-10 07:22:23 +08:00
|
|
|
per_cpu(processor_device_array, pr->id) = device;
|
2005-10-22 07:22:00 +08:00
|
|
|
|
2008-06-10 07:22:23 +08:00
|
|
|
per_cpu(processors, pr->id) = pr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-12-22 06:29:42 +08:00
|
|
|
dev = get_cpu_device(pr->id);
|
|
|
|
if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) {
|
2009-06-23 04:41:09 +08:00
|
|
|
result = -EFAULT;
|
2012-03-15 16:32:05 +08:00
|
|
|
goto err_clear_processor;
|
2009-06-23 04:41:09 +08:00
|
|
|
}
|
2008-04-29 14:36:07 +08:00
|
|
|
|
2012-01-20 01:18:43 +08:00
|
|
|
/*
|
|
|
|
* Do not start hotplugged CPUs now, but when they
|
|
|
|
* are onlined the first time
|
|
|
|
*/
|
|
|
|
if (pr->flags.need_hotplug_init)
|
|
|
|
return 0;
|
2008-04-11 10:09:24 +08:00
|
|
|
|
ACPI processor hotplug: Split up acpi_processor_add
No functional change.
This is needed because:
When a CPU gets hotplugged, it's totally uninitialized
and offline. cpuinfo_x86 struct (cpu_data(cpu)) is mostly
zero (CPU feature flags, model, family,..).
When a CPU gets hotplugged, struct processor is alloc'd,
some sysfs files are set up but acpi_processor_add()
must not try to access a MSR on this CPU or try to read
out CPU feature,family, etc.
This must be done in acpi_processor_start().
The next patch will delay the call of acpi_processor_start()
for physically hotpluggedcores, to the time when they are onlined
the first time. There it is safe then to access cpu_data(cpu)
cpuinfo_x86 struct or access MSRs which is needed to
set up cpuidle, throttling and other features.
Tested and
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2012-01-20 01:18:42 +08:00
|
|
|
result = acpi_processor_start(pr);
|
|
|
|
if (result)
|
2009-06-23 04:41:09 +08:00
|
|
|
goto err_remove_sysfs;
|
2008-01-17 15:51:23 +08:00
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2009-06-23 04:41:09 +08:00
|
|
|
|
|
|
|
err_remove_sysfs:
|
2011-11-18 06:37:00 +08:00
|
|
|
sysfs_remove_link(&device->dev.kobj, "sysdev");
|
2012-03-15 16:32:05 +08:00
|
|
|
err_clear_processor:
|
|
|
|
/*
|
|
|
|
* processor_device_array is not cleared to allow checks for buggy BIOS
|
|
|
|
*/
|
|
|
|
per_cpu(processors, pr->id) = NULL;
|
2009-06-23 04:41:19 +08:00
|
|
|
err_free_cpumask:
|
|
|
|
free_cpumask_var(pr->throttling.shared_cpu_map);
|
2012-03-15 16:32:05 +08:00
|
|
|
err_free_pr:
|
|
|
|
kfree(pr);
|
2006-06-27 12:41:40 +08:00
|
|
|
return result;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2013-01-24 07:24:48 +08:00
|
|
|
static int acpi_processor_remove(struct acpi_device *device)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_processor *pr = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
if (!device || !acpi_driver_data(device))
|
2006-06-27 12:41:40 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-10-01 06:28:50 +08:00
|
|
|
pr = acpi_driver_data(device);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-01-01 10:08:47 +08:00
|
|
|
if (pr->id >= nr_cpu_ids)
|
|
|
|
goto free;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-01-24 07:24:48 +08:00
|
|
|
if (device->removal_type == ACPI_BUS_REMOVAL_EJECT) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (acpi_processor_handle_eject(pr))
|
2006-06-27 12:41:40 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:42:54 +08:00
|
|
|
acpi_processor_power_exit(pr);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-04-29 14:36:07 +08:00
|
|
|
sysfs_remove_link(&device->dev.kobj, "sysdev");
|
|
|
|
|
2008-02-15 08:34:37 +08:00
|
|
|
if (pr->cdev) {
|
|
|
|
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
|
|
|
|
sysfs_remove_link(&pr->cdev->device.kobj, "device");
|
|
|
|
thermal_cooling_device_unregister(pr->cdev);
|
|
|
|
pr->cdev = NULL;
|
|
|
|
}
|
2008-01-17 15:51:23 +08:00
|
|
|
|
2008-06-10 07:22:23 +08:00
|
|
|
per_cpu(processors, pr->id) = NULL;
|
|
|
|
per_cpu(processor_device_array, pr->id) = NULL;
|
2013-02-23 08:33:29 +08:00
|
|
|
try_offline_node(cpu_to_node(pr->id));
|
2009-01-01 10:08:47 +08:00
|
|
|
|
|
|
|
free:
|
|
|
|
free_cpumask_var(pr->throttling.shared_cpu_map);
|
2005-04-17 06:20:36 +08:00
|
|
|
kfree(pr);
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
|
|
|
/****************************************************************************
|
|
|
|
* Acpi processor hotplug support *
|
|
|
|
****************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static int is_processor_present(acpi_handle handle)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2008-10-10 14:22:59 +08:00
|
|
|
unsigned long long sta = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
|
2008-01-09 15:17:47 +08:00
|
|
|
|
|
|
|
if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT))
|
|
|
|
return 1;
|
|
|
|
|
2008-02-23 14:53:09 +08:00
|
|
|
/*
|
|
|
|
* _STA is mandatory for a processor that supports hot plug
|
|
|
|
*/
|
|
|
|
if (status == AE_NOT_FOUND)
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
|
|
"Processor does not support hot plug\n"));
|
|
|
|
else
|
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Processor Device is not present"));
|
2008-01-09 15:17:47 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2011-02-18 00:33:53 +08:00
|
|
|
static void acpi_processor_hotplug_notify(acpi_handle handle,
|
|
|
|
u32 event, void *data)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_device *device = NULL;
|
2012-11-01 22:42:13 +08:00
|
|
|
struct acpi_eject_event *ej_event = NULL;
|
2012-05-24 10:25:21 +08:00
|
|
|
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
|
ACPI / hotplug: Fix concurrency issues and memory leaks
This changeset is aimed at fixing a few different but related
problems in the ACPI hotplug infrastructure.
First of all, since notify handlers may be run in parallel with
acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
and some of them are installed for ACPI handles that have no struct
acpi_device objects attached (i.e. before those objects are created),
those notify handlers have to take acpi_scan_lock to prevent races
from taking place (e.g. a struct acpi_device is found to be present
for the given ACPI handle, but right after that it is removed by
acpi_bus_trim() running in parallel to the given notify handler).
Moreover, since some of them call acpi_bus_scan() and
acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
should be acquired by the callers of these two funtions rather by
these functions themselves.
For these reasons, make all notify handlers that can handle device
addition and eject events take acpi_scan_lock and remove the
acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
Accordingly, update all of their users to make sure that they
are always called under acpi_scan_lock.
Furthermore, since eject operations are carried out asynchronously
with respect to the notify events that trigger them, with the help
of acpi_bus_hot_remove_device(), even if notify handlers take the
ACPI scan lock, it still is possible that, for example,
acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
the notify handler that scheduled its execution and that
acpi_bus_trim() will remove the device node passed to
acpi_bus_hot_remove_device() for ejection. In that case, the struct
acpi_device object obtained by acpi_bus_hot_remove_device() will be
invalid and not-so-funny things will ensue. To protect agaist that,
make the users of acpi_bus_hot_remove_device() run get_device() on
ACPI device node objects that are about to be passed to it and make
acpi_bus_hot_remove_device() run put_device() on them and check if
their ACPI handles are not NULL (make acpi_device_unregister() clear
the device nodes' ACPI handles for that check to work).
Finally, observe that acpi_os_hotplug_execute() actually can fail,
in which case its caller ought to free memory allocated for the
context object to prevent leaks from happening. It also needs to
run put_device() on the device node that it ran get_device() on
previously in that case. Modify the code accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
2013-02-13 21:36:47 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08:00
|
|
|
int result;
|
|
|
|
|
ACPI / hotplug: Fix concurrency issues and memory leaks
This changeset is aimed at fixing a few different but related
problems in the ACPI hotplug infrastructure.
First of all, since notify handlers may be run in parallel with
acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
and some of them are installed for ACPI handles that have no struct
acpi_device objects attached (i.e. before those objects are created),
those notify handlers have to take acpi_scan_lock to prevent races
from taking place (e.g. a struct acpi_device is found to be present
for the given ACPI handle, but right after that it is removed by
acpi_bus_trim() running in parallel to the given notify handler).
Moreover, since some of them call acpi_bus_scan() and
acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
should be acquired by the callers of these two funtions rather by
these functions themselves.
For these reasons, make all notify handlers that can handle device
addition and eject events take acpi_scan_lock and remove the
acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
Accordingly, update all of their users to make sure that they
are always called under acpi_scan_lock.
Furthermore, since eject operations are carried out asynchronously
with respect to the notify events that trigger them, with the help
of acpi_bus_hot_remove_device(), even if notify handlers take the
ACPI scan lock, it still is possible that, for example,
acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
the notify handler that scheduled its execution and that
acpi_bus_trim() will remove the device node passed to
acpi_bus_hot_remove_device() for ejection. In that case, the struct
acpi_device object obtained by acpi_bus_hot_remove_device() will be
invalid and not-so-funny things will ensue. To protect agaist that,
make the users of acpi_bus_hot_remove_device() run get_device() on
ACPI device node objects that are about to be passed to it and make
acpi_bus_hot_remove_device() run put_device() on them and check if
their ACPI handles are not NULL (make acpi_device_unregister() clear
the device nodes' ACPI handles for that check to work).
Finally, observe that acpi_os_hotplug_execute() actually can fail,
in which case its caller ought to free memory allocated for the
context object to prevent leaks from happening. It also needs to
run put_device() on the device node that it ran get_device() on
previously in that case. Modify the code accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
2013-02-13 21:36:47 +08:00
|
|
|
acpi_scan_lock_acquire();
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
switch (event) {
|
|
|
|
case ACPI_NOTIFY_BUS_CHECK:
|
|
|
|
case ACPI_NOTIFY_DEVICE_CHECK:
|
2008-03-05 07:06:36 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
|
|
"Processor driver received %s event\n",
|
2005-08-05 12:44:28 +08:00
|
|
|
(event == ACPI_NOTIFY_BUS_CHECK) ?
|
2008-03-05 07:06:36 +08:00
|
|
|
"ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!is_processor_present(handle))
|
|
|
|
break;
|
|
|
|
|
2012-05-24 10:25:21 +08:00
|
|
|
if (!acpi_bus_get_device(handle, &device))
|
|
|
|
break;
|
|
|
|
|
2013-01-19 08:27:35 +08:00
|
|
|
result = acpi_bus_scan(handle);
|
2012-05-24 10:25:21 +08:00
|
|
|
if (result) {
|
2012-11-21 07:42:27 +08:00
|
|
|
acpi_handle_err(handle, "Unable to add the device\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
2012-12-21 07:36:49 +08:00
|
|
|
result = acpi_bus_get_device(handle, &device);
|
|
|
|
if (result) {
|
|
|
|
acpi_handle_err(handle, "Missing device object\n");
|
|
|
|
break;
|
|
|
|
}
|
2012-05-24 10:25:21 +08:00
|
|
|
ost_code = ACPI_OST_SC_SUCCESS;
|
2005-08-05 12:44:28 +08:00
|
|
|
break;
|
2012-05-24 10:25:21 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_NOTIFY_EJECT_REQUEST:
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
|
|
"received ACPI_NOTIFY_EJECT_REQUEST\n"));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (acpi_bus_get_device(handle, &device)) {
|
2012-11-21 07:42:27 +08:00
|
|
|
acpi_handle_err(handle,
|
|
|
|
"Device don't exist, dropping EJECT\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
2012-11-01 22:42:13 +08:00
|
|
|
if (!acpi_driver_data(device)) {
|
2012-11-21 07:42:27 +08:00
|
|
|
acpi_handle_err(handle,
|
|
|
|
"Driver data is NULL, dropping EJECT\n");
|
2012-05-24 10:25:21 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2012-05-24 10:25:21 +08:00
|
|
|
|
2012-11-01 22:42:13 +08:00
|
|
|
ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
|
|
|
|
if (!ej_event) {
|
2012-11-21 07:42:27 +08:00
|
|
|
acpi_handle_err(handle, "No memory, dropping EJECT\n");
|
2012-11-01 22:42:13 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
ACPI / hotplug: Fix concurrency issues and memory leaks
This changeset is aimed at fixing a few different but related
problems in the ACPI hotplug infrastructure.
First of all, since notify handlers may be run in parallel with
acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
and some of them are installed for ACPI handles that have no struct
acpi_device objects attached (i.e. before those objects are created),
those notify handlers have to take acpi_scan_lock to prevent races
from taking place (e.g. a struct acpi_device is found to be present
for the given ACPI handle, but right after that it is removed by
acpi_bus_trim() running in parallel to the given notify handler).
Moreover, since some of them call acpi_bus_scan() and
acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
should be acquired by the callers of these two funtions rather by
these functions themselves.
For these reasons, make all notify handlers that can handle device
addition and eject events take acpi_scan_lock and remove the
acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
Accordingly, update all of their users to make sure that they
are always called under acpi_scan_lock.
Furthermore, since eject operations are carried out asynchronously
with respect to the notify events that trigger them, with the help
of acpi_bus_hot_remove_device(), even if notify handlers take the
ACPI scan lock, it still is possible that, for example,
acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
the notify handler that scheduled its execution and that
acpi_bus_trim() will remove the device node passed to
acpi_bus_hot_remove_device() for ejection. In that case, the struct
acpi_device object obtained by acpi_bus_hot_remove_device() will be
invalid and not-so-funny things will ensue. To protect agaist that,
make the users of acpi_bus_hot_remove_device() run get_device() on
ACPI device node objects that are about to be passed to it and make
acpi_bus_hot_remove_device() run put_device() on them and check if
their ACPI handles are not NULL (make acpi_device_unregister() clear
the device nodes' ACPI handles for that check to work).
Finally, observe that acpi_os_hotplug_execute() actually can fail,
in which case its caller ought to free memory allocated for the
context object to prevent leaks from happening. It also needs to
run put_device() on the device node that it ran get_device() on
previously in that case. Modify the code accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
2013-02-13 21:36:47 +08:00
|
|
|
get_device(&device->dev);
|
2013-01-12 06:40:41 +08:00
|
|
|
ej_event->device = device;
|
2012-11-01 22:42:13 +08:00
|
|
|
ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
|
ACPI / hotplug: Fix concurrency issues and memory leaks
This changeset is aimed at fixing a few different but related
problems in the ACPI hotplug infrastructure.
First of all, since notify handlers may be run in parallel with
acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
and some of them are installed for ACPI handles that have no struct
acpi_device objects attached (i.e. before those objects are created),
those notify handlers have to take acpi_scan_lock to prevent races
from taking place (e.g. a struct acpi_device is found to be present
for the given ACPI handle, but right after that it is removed by
acpi_bus_trim() running in parallel to the given notify handler).
Moreover, since some of them call acpi_bus_scan() and
acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
should be acquired by the callers of these two funtions rather by
these functions themselves.
For these reasons, make all notify handlers that can handle device
addition and eject events take acpi_scan_lock and remove the
acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
Accordingly, update all of their users to make sure that they
are always called under acpi_scan_lock.
Furthermore, since eject operations are carried out asynchronously
with respect to the notify events that trigger them, with the help
of acpi_bus_hot_remove_device(), even if notify handlers take the
ACPI scan lock, it still is possible that, for example,
acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
the notify handler that scheduled its execution and that
acpi_bus_trim() will remove the device node passed to
acpi_bus_hot_remove_device() for ejection. In that case, the struct
acpi_device object obtained by acpi_bus_hot_remove_device() will be
invalid and not-so-funny things will ensue. To protect agaist that,
make the users of acpi_bus_hot_remove_device() run get_device() on
ACPI device node objects that are about to be passed to it and make
acpi_bus_hot_remove_device() run put_device() on them and check if
their ACPI handles are not NULL (make acpi_device_unregister() clear
the device nodes' ACPI handles for that check to work).
Finally, observe that acpi_os_hotplug_execute() actually can fail,
in which case its caller ought to free memory allocated for the
context object to prevent leaks from happening. It also needs to
run put_device() on the device node that it ran get_device() on
previously in that case. Modify the code accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
2013-02-13 21:36:47 +08:00
|
|
|
/* The eject is carried out asynchronously. */
|
|
|
|
status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
|
|
|
|
ej_event);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
put_device(&device->dev);
|
|
|
|
kfree(ej_event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
goto out;
|
2012-05-24 10:25:21 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
default:
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
2005-08-05 12:44:28 +08:00
|
|
|
"Unsupported event [0x%x]\n", event));
|
2012-05-24 10:25:21 +08:00
|
|
|
|
|
|
|
/* non-hotplug event; possibly handled by other handler */
|
ACPI / hotplug: Fix concurrency issues and memory leaks
This changeset is aimed at fixing a few different but related
problems in the ACPI hotplug infrastructure.
First of all, since notify handlers may be run in parallel with
acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
and some of them are installed for ACPI handles that have no struct
acpi_device objects attached (i.e. before those objects are created),
those notify handlers have to take acpi_scan_lock to prevent races
from taking place (e.g. a struct acpi_device is found to be present
for the given ACPI handle, but right after that it is removed by
acpi_bus_trim() running in parallel to the given notify handler).
Moreover, since some of them call acpi_bus_scan() and
acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
should be acquired by the callers of these two funtions rather by
these functions themselves.
For these reasons, make all notify handlers that can handle device
addition and eject events take acpi_scan_lock and remove the
acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
Accordingly, update all of their users to make sure that they
are always called under acpi_scan_lock.
Furthermore, since eject operations are carried out asynchronously
with respect to the notify events that trigger them, with the help
of acpi_bus_hot_remove_device(), even if notify handlers take the
ACPI scan lock, it still is possible that, for example,
acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
the notify handler that scheduled its execution and that
acpi_bus_trim() will remove the device node passed to
acpi_bus_hot_remove_device() for ejection. In that case, the struct
acpi_device object obtained by acpi_bus_hot_remove_device() will be
invalid and not-so-funny things will ensue. To protect agaist that,
make the users of acpi_bus_hot_remove_device() run get_device() on
ACPI device node objects that are about to be passed to it and make
acpi_bus_hot_remove_device() run put_device() on them and check if
their ACPI handles are not NULL (make acpi_device_unregister() clear
the device nodes' ACPI handles for that check to work).
Finally, observe that acpi_os_hotplug_execute() actually can fail,
in which case its caller ought to free memory allocated for the
context object to prevent leaks from happening. It also needs to
run put_device() on the device node that it ran get_device() on
previously in that case. Modify the code accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
2013-02-13 21:36:47 +08:00
|
|
|
goto out;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-05-24 10:25:21 +08:00
|
|
|
/* Inform firmware that the hotplug operation has completed */
|
|
|
|
(void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
|
ACPI / hotplug: Fix concurrency issues and memory leaks
This changeset is aimed at fixing a few different but related
problems in the ACPI hotplug infrastructure.
First of all, since notify handlers may be run in parallel with
acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
and some of them are installed for ACPI handles that have no struct
acpi_device objects attached (i.e. before those objects are created),
those notify handlers have to take acpi_scan_lock to prevent races
from taking place (e.g. a struct acpi_device is found to be present
for the given ACPI handle, but right after that it is removed by
acpi_bus_trim() running in parallel to the given notify handler).
Moreover, since some of them call acpi_bus_scan() and
acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
should be acquired by the callers of these two funtions rather by
these functions themselves.
For these reasons, make all notify handlers that can handle device
addition and eject events take acpi_scan_lock and remove the
acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
Accordingly, update all of their users to make sure that they
are always called under acpi_scan_lock.
Furthermore, since eject operations are carried out asynchronously
with respect to the notify events that trigger them, with the help
of acpi_bus_hot_remove_device(), even if notify handlers take the
ACPI scan lock, it still is possible that, for example,
acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
the notify handler that scheduled its execution and that
acpi_bus_trim() will remove the device node passed to
acpi_bus_hot_remove_device() for ejection. In that case, the struct
acpi_device object obtained by acpi_bus_hot_remove_device() will be
invalid and not-so-funny things will ensue. To protect agaist that,
make the users of acpi_bus_hot_remove_device() run get_device() on
ACPI device node objects that are about to be passed to it and make
acpi_bus_hot_remove_device() run put_device() on them and check if
their ACPI handles are not NULL (make acpi_device_unregister() clear
the device nodes' ACPI handles for that check to work).
Finally, observe that acpi_os_hotplug_execute() actually can fail,
in which case its caller ought to free memory allocated for the
context object to prevent leaks from happening. It also needs to
run put_device() on the device node that it ran get_device() on
previously in that case. Modify the code accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
2013-02-13 21:36:47 +08:00
|
|
|
|
|
|
|
out:
|
|
|
|
acpi_scan_lock_release();
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-03-20 03:08:02 +08:00
|
|
|
static acpi_status is_processor_device(acpi_handle handle)
|
|
|
|
{
|
|
|
|
struct acpi_device_info *info;
|
|
|
|
char *hid;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
status = acpi_get_object_info(handle, &info);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return status;
|
|
|
|
|
|
|
|
if (info->type == ACPI_TYPE_PROCESSOR) {
|
|
|
|
kfree(info);
|
|
|
|
return AE_OK; /* found a processor object */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(info->valid & ACPI_VALID_HID)) {
|
|
|
|
kfree(info);
|
|
|
|
return AE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
hid = info->hardware_id.string;
|
|
|
|
if ((hid == NULL) || strcmp(hid, ACPI_PROCESSOR_DEVICE_HID)) {
|
|
|
|
kfree(info);
|
|
|
|
return AE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
kfree(info);
|
|
|
|
return AE_OK; /* found a processor device object */
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static acpi_status
|
|
|
|
processor_walk_namespace_cb(acpi_handle handle,
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 lvl, void *context, void **rv)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08:00
|
|
|
int *action = context;
|
|
|
|
|
2012-03-20 03:08:02 +08:00
|
|
|
status = is_processor_device(handle);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (ACPI_FAILURE(status))
|
2012-03-20 03:08:02 +08:00
|
|
|
return AE_OK; /* not a processor; continue to walk */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
switch (*action) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case INSTALL_NOTIFY_HANDLER:
|
|
|
|
acpi_install_notify_handler(handle,
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SYSTEM_NOTIFY,
|
|
|
|
acpi_processor_hotplug_notify,
|
|
|
|
NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
case UNINSTALL_NOTIFY_HANDLER:
|
|
|
|
acpi_remove_notify_handler(handle,
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SYSTEM_NOTIFY,
|
|
|
|
acpi_processor_hotplug_notify);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-20 03:08:02 +08:00
|
|
|
/* found a processor; skip walking underneath */
|
|
|
|
return AE_CTRL_DEPTH;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-01-18 05:40:07 +08:00
|
|
|
static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-01-18 05:40:07 +08:00
|
|
|
acpi_handle handle = pr->handle;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!is_processor_present(handle)) {
|
2006-06-27 12:41:40 +08:00
|
|
|
return AE_ERROR;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-01-18 05:40:07 +08:00
|
|
|
if (acpi_map_lsapic(handle, &pr->id))
|
2006-06-27 12:41:40 +08:00
|
|
|
return AE_ERROR;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-01-18 05:40:07 +08:00
|
|
|
if (arch_register_cpu(pr->id)) {
|
|
|
|
acpi_unmap_lsapic(pr->id);
|
2006-06-27 12:41:40 +08:00
|
|
|
return AE_ERROR;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-01-20 01:18:43 +08:00
|
|
|
/* CPU got hot-plugged, but cpu_data is not initialized yet
|
|
|
|
* Set flag to delay cpu_idle/throttling initialization
|
|
|
|
* in:
|
|
|
|
* acpi_processor_add()
|
|
|
|
* acpi_processor_get_info()
|
|
|
|
* and do it when the CPU gets online the first time
|
|
|
|
* TBD: Cleanup above functions and try to do this more elegant.
|
|
|
|
*/
|
2012-11-21 07:42:27 +08:00
|
|
|
pr_info("CPU %d got hotplugged\n", pr->id);
|
2012-01-20 01:18:43 +08:00
|
|
|
pr->flags.need_hotplug_init = 1;
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return AE_OK;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static int acpi_processor_handle_eject(struct acpi_processor *pr)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2008-04-29 14:35:56 +08:00
|
|
|
if (cpu_online(pr->id))
|
|
|
|
cpu_down(pr->id);
|
|
|
|
|
2012-10-23 07:30:54 +08:00
|
|
|
get_online_cpus();
|
|
|
|
/*
|
|
|
|
* The cpu might become online again at this point. So we check whether
|
|
|
|
* the cpu has been onlined or not. If the cpu became online, it means
|
|
|
|
* that someone wants to use the cpu. So acpi_processor_handle_eject()
|
|
|
|
* returns -EAGAIN.
|
|
|
|
*/
|
|
|
|
if (unlikely(cpu_online(pr->id))) {
|
|
|
|
put_online_cpus();
|
|
|
|
pr_warn("Failed to remove CPU %d, because other task "
|
|
|
|
"brought the CPU back online\n", pr->id);
|
|
|
|
return -EAGAIN;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
arch_unregister_cpu(pr->id);
|
|
|
|
acpi_unmap_lsapic(pr->id);
|
2012-10-23 07:30:54 +08:00
|
|
|
put_online_cpus();
|
2005-08-05 12:44:28 +08:00
|
|
|
return (0);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
#else
|
2012-01-18 05:40:07 +08:00
|
|
|
static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
return AE_ERROR;
|
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
static int acpi_processor_handle_eject(struct acpi_processor *pr)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
return (-EINVAL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static
|
|
|
|
void acpi_processor_install_hotplug_notify(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
|
|
|
int action = INSTALL_NOTIFY_HANDLER;
|
2012-03-20 03:08:02 +08:00
|
|
|
acpi_walk_namespace(ACPI_TYPE_ANY,
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_ROOT_OBJECT,
|
|
|
|
ACPI_UINT32_MAX,
|
2009-11-13 10:06:08 +08:00
|
|
|
processor_walk_namespace_cb, NULL, &action, NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
2007-09-16 21:36:43 +08:00
|
|
|
register_hotcpu_notifier(&acpi_cpu_notifier);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
void acpi_processor_uninstall_hotplug_notify(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
|
|
|
int action = UNINSTALL_NOTIFY_HANDLER;
|
2012-03-20 03:08:02 +08:00
|
|
|
acpi_walk_namespace(ACPI_TYPE_ANY,
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_ROOT_OBJECT,
|
|
|
|
ACPI_UINT32_MAX,
|
2009-11-13 10:06:08 +08:00
|
|
|
processor_walk_namespace_cb, NULL, &action, NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
2007-09-16 21:36:43 +08:00
|
|
|
unregister_hotcpu_notifier(&acpi_cpu_notifier);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We keep the driver loaded even when ACPI is not running.
|
|
|
|
* This is needed for the powernow-k8 driver, that works even without
|
|
|
|
* ACPI, but needs symbols from this driver
|
|
|
|
*/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static int __init acpi_processor_init(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
int result = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-08-27 05:29:26 +08:00
|
|
|
if (acpi_disabled)
|
|
|
|
return 0;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
result = acpi_bus_register_driver(&acpi_processor_driver);
|
cpuidle: consolidate 2.6.22 cpuidle branch into one patch
commit e5a16b1f9eec0af7cfa0830304b41c1c0833cf9f
Author: Len Brown <len.brown@intel.com>
Date: Tue Oct 2 23:44:44 2007 -0400
cpuidle: shrink diff
processor_idle.c | 440 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 429 insertions(+), 11 deletions(-)
Signed-off-by: Len Brown <len.brown@intel.com>
commit dfbb9d5aedfb18848a3e0d6f6e3e4969febb209c
Author: Len Brown <len.brown@intel.com>
Date: Wed Sep 26 02:17:55 2007 -0400
cpuidle: reduce diff size
Reduces the cpuidle processor_idle.c diff vs 2.6.22 from this
processor_idle.c | 2006 ++++++++++++++++++++++++++-----------------
1 file changed, 1219 insertions(+), 787 deletions(-)
to this:
processor_idle.c | 502 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 458 insertions(+), 44 deletions(-)
...for the purpose of making the cpuilde patch less invasive
and easier to review.
no functional changes. build tested only.
Signed-off-by: Len Brown <len.brown@intel.com>
commit 889172fc915f5a7fe20f35b133cbd205ce69bf6c
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Sep 13 13:40:05 2007 -0700
cpuidle: Retain old ACPI policy for !CONFIG_CPU_IDLE
Retain the old policy in processor_idle, so that when CPU_IDLE is not
configured, old C-state policy will still be used. This provides a
clean gradual migration path from old ACPI policy to new cpuidle
based policy.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 9544a8181edc7ecc33b3bfd69271571f98ed08bc
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Sep 13 13:39:17 2007 -0700
cpuidle: Configure governors by default
Quoting Len "Do not give an option to users to shoot themselves in the foot".
Remove the configurability of ladder and menu governors as they are
needed for default policy of cpuidle. That way users will not be able to
have cpuidle without any policy loosing all C-state power savings.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 8975059a2c1e56cfe83d1bcf031bcf4cb39be743
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:27:07 2007 -0400
CPUIDLE: load ACPI properly when CPUIDLE is disabled
Change the registration return codes for when CPUIDLE
support is not compiled into the kernel. As a result, the ACPI
processor driver will load properly even if CPUIDLE is unavailable.
However, it may be possible to cleanup the ACPI processor driver further
and eliminate some dead code paths.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit e0322e2b58dd1b12ec669bf84693efe0dc2414a8
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:26:06 2007 -0400
CPUIDLE: remove cpuidle_get_bm_activity()
Remove cpuidle_get_bm_activity() and updates governors
accordingly.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 18a6e770d5c82ba26653e53d240caa617e09e9ab
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:25:58 2007 -0400
CPUIDLE: max_cstate fix
Currently max_cstate is limited to 0, resulting in no idle processor
power management on ACPI platforms. This patch restores the value to
the array size.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 1fdc0887286179b40ce24bcdbde663172e205ef0
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:25:40 2007 -0400
CPUIDLE: handle BM detection inside the ACPI Processor driver
Update the ACPI processor driver to detect BM activity and
limit state entry depth internally, rather than exposing such
requirements to CPUIDLE. As a result, CPUIDLE can drop this
ACPI-specific interface and become more platform independent. BM
activity is now handled much more aggressively than it was in the
original implementation, so some testing coverage may be needed to
verify that this doesn't introduce any DMA buffer under-run issues.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0ef38840db666f48e3cdd2b769da676c57228dd9
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:25:14 2007 -0400
CPUIDLE: menu governor updates
Tweak the menu governor to more effectively handle non-timer
break events. Non-timer break events are detected by comparing the
actual sleep time to the expected sleep time. In future revisions, it
may be more reliable to use the timer data structures directly.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit bb4d74fca63fa96cf3ace644b15ae0f12b7df5a1
Author: Adam Belay <abelay@novell.com>
Date: Tue Aug 21 18:24:40 2007 -0400
CPUIDLE: fix 'current_governor' sysfs entry
Allow the "current_governor" sysfs entry to properly handle
input terminated with '\n'.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit df3c71559bb69b125f1a48971bf0d17f78bbdf47
Author: Len Brown <len.brown@intel.com>
Date: Sun Aug 12 02:00:45 2007 -0400
cpuidle: fix IA64 build (again)
Signed-off-by: Len Brown <len.brown@intel.com>
commit a02064579e3f9530fd31baae16b1fc46b5a7bca8
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Sun Aug 12 01:39:27 2007 -0400
cpuidle: Remove support for runtime changing of max_cstate
Remove support for runtime changeability of max_cstate. Drivers can use
use latency APIs.
max_cstate can still be used as a boot time option and dmi override.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0912a44b13adf22f5e3f607d263aed23b4910d7e
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Sun Aug 12 01:39:16 2007 -0400
cpuidle: Remove ACPI cstate_limit calls from ipw2100
ipw2100 already has code to use accetable_latency interfaces to limit the
C-state. Remove the calls to acpi_set_cstate_limit and acpi_get_cstate_limit
as they are redundant.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit c649a76e76be6bff1fd770d0a775798813a3f6e0
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Sun Aug 12 01:35:39 2007 -0400
cpuidle: compile fix for pause and resume functions
Fix the compilation failure when cpuidle is not compiled in.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Acked-by: Adam Belay <adam.belay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 2305a5920fb8ee6ccec1c62ade05aa8351091d71
Author: Adam Belay <abelay@novell.com>
Date: Thu Jul 19 00:49:00 2007 -0400
cpuidle: re-write
Some portions have been rewritten to make the code cleaner and lighter
weight. The following is a list of changes:
1.) the state name is now included in the sysfs interface
2.) detection, hotplug, and available state modifications are handled by
CPUIDLE drivers directly
3.) the CPUIDLE idle handler is only ever installed when at least one
cpuidle_device is enabled and ready
4.) the menu governor BM code no longer overflows
5.) the sysfs attributes are now printed as unsigned integers, avoiding
negative values
6.) a variety of other small cleanups
Also, Idle drivers are no longer swappable during runtime through the
CPUIDLE sysfs inteface. On i386 and x86_64 most idle handlers (e.g.
poll, mwait, halt, etc.) don't benefit from an infrastructure that
supports multiple states, so I think using a more general case idle
handler selection mechanism would be cleaner.
Signed-off-by: Adam Belay <abelay@novell.com>
Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Acked-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit df25b6b56955714e6e24b574d88d1fd11f0c3ee5
Author: Len Brown <len.brown@intel.com>
Date: Tue Jul 24 17:08:21 2007 -0400
cpuidle: fix IA64 buid
Signed-off-by: Len Brown <len.brown@intel.com>
commit fd6ada4c14488755ff7068860078c437431fbccd
Author: Adrian Bunk <bunk@stusta.de>
Date: Mon Jul 9 11:33:13 2007 -0700
cpuidle: static
make cpuidle_replace_governor() static
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit c1d4a2cebcadf2429c0c72e1d29aa2a9684c32e0
Author: Adrian Bunk <bunk@stusta.de>
Date: Tue Jul 3 00:54:40 2007 -0400
cpuidle: static
This patch makes the needlessly global struct menu_governor static.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit dbf8780c6e8d572c2c273da97ed1cca7608fd999
Author: Andrew Morton <akpm@linux-foundation.org>
Date: Tue Jul 3 00:49:14 2007 -0400
export symbol tick_nohz_get_sleep_length
ERROR: "tick_nohz_get_sleep_length" [drivers/cpuidle/governors/menu.ko] undefined!
ERROR: "tick_nohz_get_idle_jiffies" [drivers/cpuidle/governors/menu.ko] undefined!
And please be sure to get your changes to core kernel suitably reviewed.
Cc: Adam Belay <abelay@novell.com>
Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 29f0e248e7017be15f99febf9143a2cef00b2961
Author: Andrew Morton <akpm@linux-foundation.org>
Date: Tue Jul 3 00:43:04 2007 -0400
tick.h needs hrtimer.h
It uses hrtimers.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit e40cede7d63a029e92712a3fe02faee60cc38fb4
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:40:34 2007 -0400
cpuidle: first round of documentation updates
Documentation changes based on Pavel's feedback.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 83b42be2efece386976507555c29e7773a0dfcd1
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:39:25 2007 -0400
cpuidle: add rating to the governors and pick the one with highest rating by default
Introduce a governor rating scheme to pick the right governor by default.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit d2a74b8c5e8f22def4709330d4bfc4a29209b71c
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:38:08 2007 -0400
cpuidle: make cpuidle sysfs driver governor switch off by default
Make default cpuidle sysfs to show current_governor and current_driver in
read-only mode. More elaborate available_governors and available_drivers with
writeable current_governor and current_driver interface only appear with
"cpuidle_sysfs_switch" boot parameter.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 1f60a0e80bf83cf6b55c8845bbe5596ed8f6307b
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:37:00 2007 -0400
cpuidle: menu governor: change the early break condition
Change the C-state early break out algorithm in menu governor.
We only look at early breakouts that result in wakeups shorter than idle
state's target_residency. If such a breakout is frequent enough, eliminate
the particular idle state upto a timeout period.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 45a42095cf64b003b4a69be3ce7f434f97d7af51
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:35:38 2007 -0400
cpuidle: fix uninitialized variable in sysfs routine
Fix the uninitialized usage of ret.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 80dca7cdba3e6ee13eae277660873ab9584eb3be
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:34:16 2007 -0400
cpuidle: reenable /proc/acpi//power interface for the time being
Keep /proc/acpi/processor/CPU*/power around for a while as powertop depends
on it. It will be marked deprecated and removed in future. powertop can use
cpuidle interfaces instead.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 589c37c2646c5e3813a51255a5ee1159cb4c33fc
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Jul 3 00:32:37 2007 -0400
cpuidle: menu governor and hrtimer compile fix
Compile fix for menu governor.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0ba80bd9ab3ed304cb4f19b722e4cc6740588b5e
Author: Len Brown <len.brown@intel.com>
Date: Thu May 31 22:51:43 2007 -0400
cpuidle: build fix - cpuidle vs ipw2100 module
ERROR: "acpi_set_cstate_limit" [drivers/net/wireless/ipw2100.ko] undefined!
Signed-off-by: Len Brown <len.brown@intel.com>
commit d7d8fa7f96a7f7682be7c6cc0cc53fa7a18c3b58
Author: Adam Belay <abelay@novell.com>
Date: Sat Mar 24 03:47:07 2007 -0400
cpuidle: add the 'menu' governor
Here is my first take at implementing an idle PM governor that takes
full advantage of NO_HZ. I call it the 'menu' governor because it
considers the full list of idle states before each entry.
I've kept the implementation fairly simple. It attempts to guess the
next residency time and then chooses a state that would meet at least
the break-even point between power savings and entry cost. To this end,
it selects the deepest idle state that satisfies the following
constraints:
1. If the idle time elapsed since bus master activity was detected
is below a threshold (currently 20 ms), then limit the selection
to C2-type or above.
2. Do not choose a state with a break-even residency that exceeds
the expected time remaining until the next timer interrupt.
3. Do not choose a state with a break-even residency that exceeds
the elapsed time between the last pair of break events,
excluding timer interrupts.
This governor has an advantage over "ladder" governor because it
proactively checks how much time remains until the next timer interrupt
using the tick infrastructure. Also, it handles device interrupt
activity more intelligently by not including timer interrupts in break
event calculations. Finally, it doesn't make policy decisions using the
number of state entries, which can have variable residency times (NO_HZ
makes these potentially very large), and instead only considers sleep
time deltas.
The menu governor can be selected during runtime using the cpuidle sysfs
interface like so:
"echo "menu" > /sys/devices/system/cpu/cpuidle/current_governor"
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit a4bec7e65aa3b7488b879d971651cc99a6c410fe
Author: Adam Belay <abelay@novell.com>
Date: Sat Mar 24 03:47:03 2007 -0400
cpuidle: export time until next timer interrupt using NO_HZ
Expose information about the time remaining until the next
timer interrupt expires by utilizing the dynticks infrastructure.
Also modify the main idle loop to allow dynticks to handle
non-interrupt break events (e.g. DMA). Finally, expose sleep ticks
information to external code. Thomas Gleixner is responsible for much
of the code in this patch. However, I've made some additional changes,
so I'm probably responsible if there are any bugs or oversights :)
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 2929d8996fbc77f41a5ff86bb67cdde3ca7d2d72
Author: Adam Belay <abelay@novell.com>
Date: Sat Mar 24 03:46:58 2007 -0400
cpuidle: governor API changes
This patch prepares cpuidle for the menu governor. It adds an optional
stage after idle state entry to give the governor an opportunity to
check why the state was exited. Also it makes sure the idle loop
returns after each state entry, allowing the appropriate dynticks code
to run.
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 3a7fd42f9825c3b03e364ca59baa751bb350775f
Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Apr 26 00:03:59 2007 -0700
cpuidle: hang fix
Prevent hang on x86-64, when ACPI processor driver is added as a module on
a system that does not support C-states.
x86-64 expects all idle handlers to enable interrupts before returning from
idle handler. This is due to enter_idle(), exit_idle() races. Make
cpuidle_idle_call() confirm to this when there is no pm_idle_old.
Also, cpuidle look at the return values of attch_driver() and set
current_driver to NULL if attach fails on all CPUs.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 4893339a142afbd5b7c01ffadfd53d14746e858e
Author: Shaohua Li <shaohua.li@intel.com>
Date: Thu Apr 26 10:40:09 2007 +0800
cpuidle: add support for max_cstate limit
With CPUIDLE framework, the max_cstate (to limit max cpu c-state)
parameter is ingored. Some systems require it to ignore C2/C3
and some drivers like ipw require it too.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 43bbbbe1cb998cbd2df656f55bb3bfe30f30e7d1
Author: Shaohua Li <shaohua.li@intel.com>
Date: Thu Apr 26 10:40:13 2007 +0800
cpuidle: add cpuidle_fore_redetect_devices API
add cpuidle_force_redetect_devices API,
which forces all CPU redetect idle states.
Next patch will use it.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit d1edadd608f24836def5ec483d2edccfb37b1d19
Author: Shaohua Li <shaohua.li@intel.com>
Date: Thu Apr 26 10:40:01 2007 +0800
cpuidle: fix sysfs related issue
Fix the cpuidle sysfs issue.
a. make kobject dynamicaly allocated
b. fixed sysfs init issue to avoid suspend/resume issue
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 7169a5cc0d67b263978859672e86c13c23a5570d
Author: Randy Dunlap <randy.dunlap@oracle.com>
Date: Wed Mar 28 22:52:53 2007 -0400
cpuidle: 1-bit field must be unsigned
A 1-bit bitfield has no room for a sign bit.
drivers/cpuidle/governors/ladder.c:54:16: error: dubious bitfield without explicit `signed' or `unsigned'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 4658620158dc2fbd9e4bcb213c5b6fb5d05ba7d4
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Wed Mar 28 22:52:41 2007 -0400
cpuidle: fix boot hang
Patch for cpuidle boot hang reported by Larry Finger here.
http://www.ussg.iu.edu/hypermail/linux/kernel/0703.2/2025.html
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Larry Finger <larry.finger@lwfinger.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit c17e168aa6e5fe3851baaae8df2fbc1cf11443a9
Author: Len Brown <len.brown@intel.com>
Date: Wed Mar 7 04:37:53 2007 -0500
cpuidle: ladder does not depend on ACPI
build fix for CONFIG_ACPI=n
In file included from drivers/cpuidle/governors/ladder.c:21:
include/acpi/processor.h:88: error: expected specifier-qualifier-list before âacpi_integerâ
include/acpi/processor.h:106: error: expected specifier-qualifier-list before âacpi_integerâ
include/acpi/processor.h:168: error: expected specifier-qualifier-list before âacpi_handleâ
Signed-off-by: Len Brown <len.brown@intel.com>
commit 8c91d958246bde68db0c3f0c57b535962ce861cb
Author: Adrian Bunk <bunk@stusta.de>
Date: Tue Mar 6 02:29:40 2007 -0800
cpuidle: make code static
This patch makes the following needlessly global code static:
- driver.c: __cpuidle_find_driver()
- governor.c: __cpuidle_find_governor()
- ladder.c: struct ladder_governor
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Adam Belay <abelay@novell.com>
Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 0c39dc3187094c72c33ab65a64d2017b21f372d2
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Wed Mar 7 02:38:22 2007 -0500
cpu_idle: fix build break
This patch fixes a build breakage with !CONFIG_HOTPLUG_CPU and
CONFIG_CPU_IDLE.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 8112e3b115659b07df340ef170515799c0105f82
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Tue Mar 6 02:29:39 2007 -0800
cpuidle: build fix for !CPU_IDLE
Fix the compile issues when CPU_IDLE is not configured.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Adam Belay <abelay@novell.com>
Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 1eb4431e9599cd25e0d9872f3c2c8986821839dd
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Feb 22 13:54:57 2007 -0800
cpuidle take2: Basic documentation for cpuidle
Documentation for cpuidle infrastructure
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit ef5f15a8b79123a047285ec2e3899108661df779
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Feb 22 13:54:03 2007 -0800
cpuidle take2: Hookup ACPI C-states driver with cpuidle
Hookup ACPI C-states onto generic cpuidle infrastructure.
drivers/acpi/procesor_idle.c is now a ACPI C-states driver that registers as
a driver in cpuidle infrastructure and the policy part is removed from
drivers/acpi/processor_idle.c. We use governor in cpuidle instead.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
commit 987196fa82d4db52c407e8c9d5dec884ba602183
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Thu Feb 22 13:52:57 2007 -0800
cpuidle take2: Core cpuidle infrastructure
Announcing 'cpuidle', a new CPU power management infrastructure to manage
idle CPUs in a clean and efficient manner.
cpuidle separates out the drivers that can provide support for multiple types
of idle states and policy governors that decide on what idle state to use
at run time.
A cpuidle driver can support multiple idle states based on parameters like
varying power consumption, wakeup latency, etc (ACPI C-states for example).
A cpuidle governor can be usage model specific (laptop, server,
laptop on battery etc).
Main advantage of the infrastructure being, it allows independent development
of drivers and governors and allows for better CPU power management.
A huge thanks to Adam Belay and Shaohua Li who were part of this mini-project
since its beginning and are greatly responsible for this patchset.
This patch:
Core cpuidle infrastructure.
Introduces a new abstraction layer for cpuidle:
* which manages drivers that can support multiple idles states. Drivers
can be generic or particular to specific hardware/platform
* allows pluging in multiple policy governors that can take idle state policy
decision
* The core also has a set of sysfs interfaces with which administrato can know
about supported drivers and governors and switch them at run time.
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-04 06:58:00 +08:00
|
|
|
if (result < 0)
|
2011-10-28 18:50:42 +08:00
|
|
|
return result;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-05-03 03:54:37 +08:00
|
|
|
acpi_processor_syscore_init();
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
acpi_processor_install_hotplug_notify();
|
|
|
|
|
|
|
|
acpi_thermal_cpufreq_init();
|
|
|
|
|
|
|
|
acpi_processor_ppc_init();
|
|
|
|
|
2008-01-28 13:53:42 +08:00
|
|
|
acpi_processor_throttling_init();
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static void __exit acpi_processor_exit(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-08-27 05:29:26 +08:00
|
|
|
if (acpi_disabled)
|
|
|
|
return;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
acpi_processor_ppc_exit();
|
|
|
|
|
|
|
|
acpi_thermal_cpufreq_exit();
|
|
|
|
|
|
|
|
acpi_processor_uninstall_hotplug_notify();
|
|
|
|
|
2013-05-03 03:54:37 +08:00
|
|
|
acpi_processor_syscore_exit();
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
acpi_bus_unregister_driver(&acpi_processor_driver);
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(acpi_processor_init);
|
|
|
|
module_exit(acpi_processor_exit);
|
|
|
|
|
|
|
|
MODULE_ALIAS("processor");
|