From 1b02ab5fd585f88b65379b81874c75f66eec6492 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Wed, 22 Feb 2012 14:49:20 +0800 Subject: [PATCH] cpufreq: introduce hotplug governor port from ti. --- Documentation/cpu-freq/governors.txt | 27 +++++++++++++++++++++++ drivers/cpufreq/Kconfig | 33 ++++++++++++++++++++++++++++ drivers/cpufreq/Makefile | 1 + include/linux/cpufreq.h | 3 +++ 4 files changed, 64 insertions(+) diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt index 51b1cd360c33..46abbcb28b7c 100644 --- a/Documentation/cpu-freq/governors.txt +++ b/Documentation/cpu-freq/governors.txt @@ -231,6 +231,33 @@ is 85. timer_rate: Sample rate for reevaluating cpu load when the system is not idle. Default is 30000 uS. +2.7 Hotplug +----------- + +The CPUfreq governor "hotplug" operates similary to "ondemand" and +"conservative". It's decisions are based primarily on CPU load. Like +"ondemand" the "hotplug" governor will ramp up to the highest frequency +once the run-time tunable "up_threshold" parameter is crossed. Like +"conservative", the "hotplug" governor exports a "down_threshold" +parameter that is also tunable at run-time. When the "down_threshold" +is crossed the CPU transitions to the next lowest frequency in the +CPUfreq frequency table instead of decrementing the frequency based on a +percentage of maximum load. + +The main reason "hotplug" governor exists is for architectures requiring +that only the master CPU be online in order to hit low-power states +(C-states). OMAP4 is one such example of this. The "hotplug" governor +is also helpful in reducing thermal output in devices with tight thermal +constraints. + +Auxillary CPUs are onlined/offline based on CPU load, but the decision +to do so is made after averaging several sampling windows. This is to +reduce CPU hotplug "thrashing", which can be caused by normal system +entropy and leads to lots of spurious plug-in and plug-out transitions. +The number of sampling periods averaged together is tunable via the +"hotplug_in_sampling_periods" and "hotplug_out_sampling_periods" +run-time tunable parameters. + 3. The Governor Interface in the CPUfreq Core ============================================= diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 194708850ede..f2f64a0b72c5 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -109,6 +109,19 @@ config CPU_FREQ_DEFAULT_GOV_INTERACTIVE loading your cpufreq low-level hardware driver, using the 'interactive' governor for latency-sensitive workloads. +config CPU_FREQ_DEFAULT_GOV_HOTPLUG + bool "hotplug" + select CPU_FREQ_GOV_HOTPLUG + select CPU_FREQ_GOV_PERFORMANCE + help + Use the CPUFreq governor 'hotplug' as default. This allows you + to get a full dynamic frequency capable system with CPU + hotplug support by simply loading your cpufreq low-level + hardware driver. Be aware that not all cpufreq drivers + support the hotplug governor. If unsure have a look at + the help section of the driver. Fallback governor will be the + performance governor. + endchoice config CPU_FREQ_GOV_PERFORMANCE @@ -211,5 +224,25 @@ depends on X86 source "drivers/cpufreq/Kconfig.x86" endmenu +config CPU_FREQ_GOV_HOTPLUG + tristate "'hotplug' cpufreq governor" + depends on CPU_FREQ && NO_HZ && HOTPLUG_CPU + help + 'hotplug' - this driver mimics the frequency scaling behavior + in 'ondemand', but with several key differences. First is + that frequency transitions use the CPUFreq table directly, + instead of incrementing in a percentage of the maximum + available frequency. Second 'hotplug' will offline auxillary + CPUs when the system is idle, and online those CPUs once the + system becomes busy again. This last feature is needed for + architectures which transition to low power states when only + the "master" CPU is online, or for thermally constrained + devices. + + If you don't have one of these architectures or devices, use + 'ondemand' instead. + + If in doubt, say N. + endif endmenu diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index c044060a4b07..1a5e64d6fcf3 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o obj-$(CONFIG_CPU_FREQ_GOV_INTERACTIVE) += cpufreq_interactive.o +obj-$(CONFIG_CPU_FREQ_GOV_HOTPLUG) += cpufreq_hotplug.o # CPUfreq cross-arch helpers obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ae06dc9a0cda..6f492ea8a1ac 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -361,6 +361,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative; #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE) extern struct cpufreq_governor cpufreq_gov_interactive; #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_interactive) +#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG) +extern struct cpufreq_governor cpufreq_gov_hotplug; +#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_hotplug) #endif -- 2.34.1