cpufreq:boost: CPU Boost mode support
Subsystems (12)
cover cpufreq:boost: CPU Boost mode support
This patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos).
For this reason cpufreq/freq_table code has been reorganized to exclude common code.
Important design decisions:
- Boost related code is compiled-in unconditionally. I wanted to avoid situation when a lot of #ifdef CONFIG_CPU_FREQ_BOOST are scattered at cpufreq code (especially cpufreq.c large file)
- Only one cpufreq_boost instance is created at cpufreq driver file.
- Boost can manage overclocking when many policies are istalled in the system (this is a preparation for b.L)
- Boost sysfs attributies are seen only when cpufreq driver supports them. They will not show up until either CONFIG_CPU_FREQ_BOOST or device tree cpufreq "boost_mode" attribute is defined.
- No special spin_lock for Boost was created. The one from cpufreq was reused.
- Low level boost trigger function (*low_level_boost function callback) is necessary to "glue" together acpi-cpufreq boost with software based one.
Tested at: HW: Exynos 4412 3.10 linux
Compile tested x86_64 defconfig (acpi) - help with HW test
needed
Lukasz Majewski (5):
cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs
attributes
cpufreq:boost: Add support for software based CPU frequency boost cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common
boost solution
cpufreq:exynos:Extend exynos cpufreq driver to support boost cpufreq:boost:Kconfig: Enable boost support at Kconfig
drivers/cpufreq/Kconfig | 7 ++ drivers/cpufreq/acpi-cpufreq.c | 64 ++++++-------- drivers/cpufreq/cpufreq.c | 175 ++++++++++++++++++++++++++++++++++++-- drivers/cpufreq/exynos-cpufreq.c | 48 +++++++++++ drivers/cpufreq/freq_table.c | 87 ++++++++++++++++++- include/linux/cpufreq.h | 35 +++++++- 6 files changed, 369 insertions(+), 47 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/5 cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes
The cpufreq_set_drv_attr_files() function creates sysfs file entry for each available CPU. With it in place it is possible to add different set of attributes without code duplication.
--- drivers/cpufreq/cpufreq.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/cpufreq/cpufreq.c +15 -8
@@ -730,12 +730,23 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,return ret; } +static int cpufreq_set_drv_attr_files (struct cpufreq_policy *policy, +struct freq_attr **drv_attr) +{ +while ((drv_attr) && (*drv_attr)) { +if (sysfs_create_file (&policy->kobj, &((*drv_attr)->attr))) +return 1 ; + drv_attr++; + } + +return 0 ; +} +static int cpufreq_add_dev_interface (unsigned int cpu,struct cpufreq_policy *policy,struct device *dev) {struct cpufreq_policy new_policy; -struct freq_attr **drv_attr;unsigned long flags;int ret =0 ;unsigned int j;
@@ -747,13 +758,9 @@ static int cpufreq_add_dev_interface(unsigned int cpu,return ret;/* set up files for this cpu device */ - drv_attr = cpufreq_driver->attr; -while ((drv_attr) && (*drv_attr)) { - ret =sysfs_create_file (&policy->kobj, &((*drv_attr)->attr)); -if (ret) - goto err_out_kobj_put; - drv_attr++; - } +if (cpufreq_set_drv_attr_files (policy, cpufreq_driver->attr)) + goto err_out_kobj_put; +if (cpufreq_driver->get) { ret =sysfs_create_file (&policy->kobj, &cpuinfo_cur_freq.attr);if (ret)
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes
Quoted 1 line · Lukasz Majewski
Subject: cpufreq: Define
cpufreq_set_drv_attr_files()to add per CPU sysfs attributes
Its not per-cpu. We just add it for policy->cpu and other routines actually create links.
Quoted 3 lines
The
cpufreq_set_drv_attr_files()function creates sysfs file entry for each available CPU. With it in place it is possible to add different set of attributes without code duplication.
Not for each available cpu but are linked to a policy->kobj and so shows up on each policy->cpus.
Quoted 11 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>--- drivers/cpufreq/cpufreq.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)drivers/cpufreq/cpufreq.c +0
-0
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_symlink(unsigned int cpu, · line 738
Quoted 9 lines
drivers/cpufreq/cpufreq.c +6
-0@@ -730,12 +730,23 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,return ret; } +static int cpufreq_set_drv_attr_files (struct cpufreq_policy *policy, +struct freq_attr **drv_attr) +{ +while ((drv_attr) && (*drv_attr)) { +if (sysfs_create_file (&policy->kobj, &((*drv_attr)->attr))) +return 1 ;
You are changing the semantics here. We used to return error value from sysfs_create_file() and you are returning 1.
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_symlink(unsigned int cpu, · line 739
Quoted 1 line
drivers/cpufreq/cpufreq.c +1
-0+ drv_attr++;
If drv_attr was valid initially, then drv_attr++ can't make it NULL. So, we don't need to check validity of drv_attr for every loop.
Re: [PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes
Hi Viresh,
Quoted 8 lines · Lukasz Majewski
Quoted 3 lines
Subject: cpufreq: Define
cpufreq_set_drv_attr_files()to add per CPU sysfs attributesIts not per-cpu. We just add it for
policy->cpuand other routines actually create links.
Quoted 6 lines
Quoted 3 lines
The
cpufreq_set_drv_attr_files()function creates sysfs file entry for each available CPU. With it in place it is possible to add different set of attributes without code duplication.Not for each available cpu but are linked to a
policy->kobjand so shows up on eachpolicy->cpus.
Yes, you are right here. Thanks for detailed explanation. Being "per-cpu" comes from kobj embedded at policy, which has information about cpus affected.
Quoted 15 lines
Quoted 15 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>--- drivers/cpufreq/cpufreq.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)drivers/cpufreq/cpufreq.c +0
-0@@ -730,12 +730,23 @@ static int cpufreq_add_dev_symlink(unsigned int cpu, return ret; }
Quoted 11 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_symlink(unsigned int cpu, · line 738
Quoted 8 lines
drivers/cpufreq/cpufreq.c +6
-0+static int cpufreq_set_drv_attr_files (struct cpufreq_policy *policy, +struct freq_attr **drv_attr) +{ +while ((drv_attr) && (*drv_attr)) { +if (sysfs_create_file (&policy->kobj, &((*drv_attr)->attr))) +return 1 ;You are changing the semantics here. We used to return error value from
sysfs_create_file()and you are returning 1.
Yes, correct. The ret from sysfs_create_file shall be returned. Returning 1 causes information lost.
Quoted 5 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_symlink(unsigned int cpu, · line 739
Quoted 2 lines
drivers/cpufreq/cpufreq.c +1
-0+ drv_attr++;If
drv_attrwas valid initially, then drv_attr++ can't make it NULL. So, we don't need to check validity ofdrv_attrfor every loop.
I'm confused here.
So you want to check dev_attr for NULL just after:drv_attr = cpufreq_driver->attr;
if (!drv_attr)
goto error;
and skip the check at the while loop:
while ((drv_attr) && (*drv_attr))
to
while ((*drv_attr))
Am I correct?
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes
Quoted 7 lines · Lukasz Majewski
I'm confused here.
So you want to check
dev_attrfor NULL just after:drv_attr=cpufreq_driver->attr;
if (!drv_attr)goto error;
Quoted 8 lines
and skip the check at the while loop:
while ((drv_attr) && (*drv_attr))to
while ((
*drv_attr))Am I correct?
Bingo!!
Re: [PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes
Hi Viresh,
Quoted 11 lines · Lukasz Majewski
Quoted 10 lines
I'm confused here.
So you want to check
dev_attrfor NULL just after:drv_attr=cpufreq_driver->attr;
if (!drv_attr)goto error;and skip the check at the while loop:
while ((drv_attr) && (*drv_attr))
Quoted 7 lines
Quoted 5 lines
to
while ((
*drv_attr))Am I correct?
Bingo!!
Ok, no problem :-)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 2/5 cpufreq:boost: Add support for software based CPU frequency boost
In reply to Lukasz MajewskiThis commit adds support for software based frequency boosting. Exynos4 SoCs (e.g. 4x12) allow setting of frequency above its normal condition limits. This can be done for some short time.
Overclocking (boost) support came from cpufreq driver (which is platform dependent). Hence the data structure describing it is defined at its file.
To allow support for either SW and HW (Intel) based boosting, the cpufreq core code has been extended to support both solutions.
The main boost switch has been put at /sys/devices/system/cpu/cpufreq/boost.
--- drivers/cpufreq/cpufreq.c | 156 ++++++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 87 ++++++++++++++++++++++- include/linux/cpufreq.h | 35 +++++++++- 3 files changed, 275 insertions(+), 3 deletions(-)
drivers/cpufreq/cpufreq.c +156 -0
@@ -133,6 +133,11 @@ bool have_governor_per_policy(void)return cpufreq_driver->have_governor_per_policy; } +/** +* Global definition of cpufreq_boost structure +*/ +struct cpufreq_boost *cpufreq_boost; +static struct cpufreq_policy *__cpufreq_cpu_get (unsigned int cpu,bool sysfs) {struct cpufreq_policy *data;
@@ -315,6 +320,45 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost_status (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +struct cpufreq_boost *boost = cpufreq_boost; + +if (!boost) +return -ENODEV ; + +return sprintf (buf,"%d\n" , boost->status); +} + +static ssize_t store_boost_status (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count) +{ +struct cpufreq_boost *boost = cpufreq_boost; +struct cpufreq_policy *p; +int ret, enable; + +if (!boost) +return -ENODEV ; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +/* Adjust all policies to support boost */ +list_for_each_entry (p, &boost->policies, boost_list) +if (cpufreq_boost_trigger_state (p, enable)) { +pr_err ("Cannot %sable boost (policy 0x%p)!\n" , + enable ?"en" :"dis" , p); +return -EINVAL ; + } + +return count; +} + +static struct global_attr global_boost =__ATTR (boost,0644 , + show_boost_status, + store_boost_status);static struct cpufreq_governor *__find_governor (const char *str_governor) {
@@ -761,6 +805,18 @@ static int cpufreq_add_dev_interface(unsigned int cpu,if (cpufreq_set_drv_attr_files (policy, cpufreq_driver->attr)) goto err_out_kobj_put; +if (cpufreq_driver->boost) { +if (sysfs_create_file (cpufreq_global_kobject, + &(global_boost.attr))) +pr_warn ("could not register global boost sysfs file\n" ); +else +pr_debug ("registered global boost sysfs file\n" ); + +if (cpufreq_set_drv_attr_files (policy, + cpufreq_driver->boost->attr)) + goto err_out_kobj_put; + } +if (cpufreq_driver->get) { ret =sysfs_create_file (&policy->kobj, &cpuinfo_cur_freq.attr);if (ret)
@@ -923,6 +979,8 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)init_completion (&policy->kobj_unregister);INIT_WORK (&policy->update, handle_update); +cpufreq_boost_init (policy); +/* call driver. From then on the cpufreq must be able * to accept all calls to ->verify and ->setpolicy for this CPU */
@@ -1860,6 +1918,100 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };/********************************************************************* +* BOOST * +*********************************************************************/ +int cpufreq_boost_trigger_state (struct cpufreq_policy *policy,int state) +{ +struct cpufreq_boost *boost; +unsigned long flags; +int ret =0 ; + +if (!policy || !policy->boost || !policy->boost->low_level_boost) +return -ENODEV ; + + boost = policy->boost; +write_lock_irqsave (&cpufreq_driver_lock, flags); + +if (boost->status != state) { + policy->boost->status = state; + ret = boost->low_level_boost (policy, state); +if (ret) { +pr_err ("BOOST cannot %sable low level code (%d)\n" , + state ?"en" :"dis" , ret); +return ret; + } + } + +write_unlock_irqrestore (&cpufreq_driver_lock, flags); + +pr_debug ("cpufreq BOOST %sabled\n" , state ?"en" :"dis" ); + +return 0 ; +} + +/** +* cpufreq_boost_notifier - notifier callback for cpufreq policy change. +* <at> nb: struct notifier_block * with callback info. +* <at> event: value showing cpufreq event for which this function invoked. +* <at> data: callback-specific data +*/ +static int cpufreq_boost_notifier (struct notifier_block *nb, +unsigned long event,void *data) +{ +struct cpufreq_policy *policy = data; + +if (event ==CPUFREQ_INCOMPATIBLE ) { +if (!policy || !policy->boost) +return -ENODEV ; + +if (policy->boost->status ==CPUFREQ_BOOST_EN ) { +pr_info ("NOTIFIER BOOST: MAX: %d e:%lu cpu: %d\n" , + policy->max, event, policy->cpu); +cpufreq_boost_trigger_state (policy,0 ); + } + } + +return 0 ; +} + +/* Notifier for cpufreq policy change */ +static struct notifier_block cpufreq_boost_notifier_block = { + .notifier_call = cpufreq_boost_notifier, +}; + +int cpufreq_boost_init (struct cpufreq_policy *policy) +{ +int ret =0 ; + +if (!policy) +return -EINVAL ; + +if (!cpufreq_driver->boost) { +pr_err ("Boost mode not supported on this device\n" ); +return -ENODEV ; + } + + policy->boost = cpufreq_boost = cpufreq_driver->boost; + +/* disable boost for newly created policy - as we e.g. change +governor */ + policy->boost->status =CPUFREQ_BOOST_DIS ; + +/* register policy notifier */ + ret =cpufreq_register_notifier (&cpufreq_boost_notifier_block, +CPUFREQ_POLICY_NOTIFIER ); +if (ret) { +pr_err ("CPUFREQ BOOST notifier not registered.\n" ); +return ret; + } +/* add policy to policies list headed at struct cpufreq_boost */ +list_add_tail (&policy->boost_list, &cpufreq_boost->policies); + +return 0 ; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_init); + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/
@@ -1954,6 +2106,10 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); + +if (cpufreq_driver->boost) +sysfs_remove_file (cpufreq_global_kobject, &(global_boost.attr)); +unregister_hotcpu_notifier (&cpufreq_cpu_notifier);write_lock_irqsave (&cpufreq_driver_lock, flags);
drivers/cpufreq/freq_table.c +85 -2
148 lines not on this page · raw message
include/linux/cpufreq.h +34 -1
@@ -88,6 +88,25 @@ struct cpufreq_real_policy {struct cpufreq_governor *governor;/* see below */ }; +#define CPUFREQ_BOOST_DIS (0) +#define CPUFREQ_BOOST_EN (1) + +struct cpufreq_policy ; +struct cpufreq_boost { +unsigned int max_boost_freq;/* maximum value of +* boosted freq */ +unsigned int max_normal_freq;/* non boost max freq */ +int status;/* status of boost */ + +/* boost sysfs attributies */ +struct freq_attr **attr; + +/* low-level trigger for boost */ +int (*low_level_boost) (struct cpufreq_policy *policy,int state); + +struct list_head policies; +}; +struct cpufreq_policy {/* CPUs sharing clock, require sw coordination */ cpumask_var_t cpus;/* Online CPUs only */
@@ -113,6 +132,9 @@ struct cpufreq_policy {struct cpufreq_real_policy user_policy; +struct cpufreq_boost *boost; +struct list_head boost_list; +struct kobject kobj;struct completion kobj_unregister; };
@@ -262,6 +284,9 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +struct cpufreq_boost *boost; };/* flags */
@@ -277,7 +302,6 @@ struct cpufreq_driver {int cpufreq_register_driver (struct cpufreq_driver *driver_data);int cpufreq_unregister_driver (struct cpufreq_driver *driver_data); -void cpufreq_notify_transition (struct cpufreq_policy *policy,struct cpufreq_freqs *freqs,unsigned int state);
@@ -403,6 +427,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative;#define CPUFREQ_ENTRY_INVALID ~0#define CPUFREQ_TABLE_END ~1 +/* Define index for boost frequency */ +#define CPUFREQ_BOOST ~2 +struct cpufreq_frequency_table {unsigned int index;/* any */ unsigned int frequency;/* kHz - doesn't need to be in ascending
@@ -421,11 +448,17 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,unsigned int relation, unsigned int *index); +unsigned int +cpufreq_frequency_table_boost_max (struct cpufreq_frequency_table *freq_table); +int cpufreq_boost_init (struct cpufreq_policy *policy); +/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu); +int cpufreq_boost_trigger_state (struct cpufreq_policy *policy,int state);/* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; +extern struct freq_attr cpufreq_freq_attr_boost_available_freqs;void cpufreq_frequency_table_get_attr (struct cpufreq_frequency_table *table,unsigned int cpu);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
Hi,
Quoted 11 lines · Lukasz Majewski
This commit adds support for software based frequency boosting. Exynos4 SoCs (e.g. 4x12) allow setting of frequency above its normal condition limits. This can be done for some short time.
Overclocking (boost) support came from cpufreq driver (which is platform dependent). Hence the data structure describing it is defined at its file.
To allow support for either SW and HW (Intel) based boosting, the cpufreq core code has been extended to support both solutions.
The main boost switch has been put at
/sys/devices/system/cpu/cpufreq/boost.
Log requires some better paragraphs but I am not concerned about it for now.
Quoted 7 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>--- drivers/cpufreq/cpufreq.c | 156 ++++++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 87 ++++++++++++++++++++++- include/linux/cpufreq.h | 35 +++++++++- 3 files changed, 275 insertions(+), 3 deletions(-)
My initial view on this patch is: "It is overly engineered and needs to get simplified"
drivers/cpufreq/cpufreq.c bool have_governor_per_policy(void) · line 139
Quoted 12 lines
drivers/cpufreq/cpufreq.c +4
-0@@ -133,6 +133,11 @@ bool have_governor_per_policy(void)return cpufreq_driver->have_governor_per_policy; } +/** +* Global definition of cpufreq_boost structure +*/ +struct cpufreq_boost *cpufreq_boost;
Probably just a 'static bool' here cpufreq_boost_enabled. Which takes care of selection from sysfs.
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu, · line 810
Quoted 9 lines
drivers/cpufreq/cpufreq.c +3
-0static struct cpufreq_governor *__find_governor (const char *str_governor) {@@ -761,6 +805,18 @@ static int cpufreq_add_dev_interface(unsigned int cpu,if (cpufreq_set_drv_attr_files (policy, cpufreq_driver->attr)) goto err_out_kobj_put; +if (cpufreq_driver->boost) { +if (sysfs_create_file (cpufreq_global_kobject, + &(global_boost.attr)))
This will report error for systems where we have two policy structures. As we are creating something already present.
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu, · line 813
Quoted 3 lines
drivers/cpufreq/cpufreq.c +3
-0+pr_warn ("could not register global boost sysfs file\n" ); + else + pr_debug("registered global boost sysfs file\n");
Please make all your prints to print function name too:
pr_debug("%s: foo\n", __func__, foo);
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu, · line 816
Quoted 2 lines
drivers/cpufreq/cpufreq.c +2
-0+if (cpufreq_set_drv_attr_files (policy, + cpufreq_driver->boost->attr))
Why is this required? Why do we want platforms to add some files in sysfs?
Quoted 58 lines
drivers/cpufreq/cpufreq.c +57
-0/********************************************************************* +* BOOST * +*********************************************************************/ +int cpufreq_boost_trigger_state (struct cpufreq_policy *policy,int state) +{ +struct cpufreq_boost *boost; +unsigned long flags; +int ret =0 ; + +if (!policy || !policy->boost || !policy->boost->low_level_boost) +return -ENODEV ; + + boost = policy->boost; +write_lock_irqsave (&cpufreq_driver_lock, flags); + +if (boost->status != state) { + policy->boost->status = state; + ret = boost->low_level_boost (policy, state); +if (ret) { +pr_err ("BOOST cannot %sable low level code (%d)\n" , + state ?"en" :"dis" , ret); +return ret; + } + } + +write_unlock_irqrestore (&cpufreq_driver_lock, flags); + +pr_debug ("cpufreq BOOST %sabled\n" , state ?"en" :"dis" ); + +return 0 ; +} + +/** +* cpufreq_boost_notifier - notifier callback for cpufreq policy change. +* <at> nb: struct notifier_block * with callback info. +* <at> event: value showing cpufreq event for which this function invoked. +* <at> data: callback-specific data +*/ +static int cpufreq_boost_notifier (struct notifier_block *nb, +unsigned long event,void *data) +{ +struct cpufreq_policy *policy = data; + +if (event ==CPUFREQ_INCOMPATIBLE ) { +if (!policy || !policy->boost) +return -ENODEV ; + +if (policy->boost->status ==CPUFREQ_BOOST_EN ) { +pr_info ("NOTIFIER BOOST: MAX: %d e:%lu cpu: %d\n" , + policy->max, event, policy->cpu); +cpufreq_boost_trigger_state (policy,0 ); + } + } + +return 0 ; +} + +/* Notifier for cpufreq policy change */
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1987
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+static struct notifier_block cpufreq_boost_notifier_block = { + .notifier_call = cpufreq_boost_notifier, +}; + +int cpufreq_boost_init (struct cpufreq_policy *policy) +{ +int ret =0 ; + +if (!policy) +return -EINVAL ;
Heh, policy can't be NULL here.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1990
Quoted 2 lines
drivers/cpufreq/cpufreq.c +2
-0+if (!cpufreq_driver->boost) { +pr_err ("Boost mode not supported on this device\n" );
Wow!! You want to screw everybody else's logs with this message. Its not a crime if you don't have boost mode supported :)
Actually this routine must be called only if cpufreq_driver->boost is valid.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1994
Quoted 4 lines
drivers/cpufreq/cpufreq.c +4
-0+return -ENODEV ; + } + + policy->boost = cpufreq_boost = cpufreq_driver->boost;
Why are we copying same pointer to policy->boost? Driver is passing pointer to a single memory location, just save it globally.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1998
Quoted 3 lines
drivers/cpufreq/cpufreq.c +3
-0+/* disable boost for newly created policy - as we e.g. change +governor */ + policy->boost->status =CPUFREQ_BOOST_DIS ;
Drivers supporting boost may want boost to be enabled by default, maybe without any sysfs calls.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 2012
Quoted 13 lines
drivers/cpufreq/cpufreq.c +13
-0+/* register policy notifier */ + ret =cpufreq_register_notifier (&cpufreq_boost_notifier_block, +CPUFREQ_POLICY_NOTIFIER ); +if (ret) { +pr_err ("CPUFREQ BOOST notifier not registered.\n" ); +return ret; + } +/* add policy to policies list headed at struct cpufreq_boost */ +list_add_tail (&policy->boost_list, &cpufreq_boost->policies); + +return 0 ; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_init);
Why do we need to maintain a list of boost here? notifiers? complex :(
drivers/cpufreq/cpufreq.c int cpufreq_unregister_driver(struct cpufreq_driver *driver) · line 2111
Quoted 11 lines
drivers/cpufreq/cpufreq.c +4
-0+/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -1954,6 +2106,10 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); + +if (cpufreq_driver->boost) +sysfs_remove_file (cpufreq_global_kobject, &(global_boost.attr));
You haven't removed this from policy. Memory leak.
drivers/cpufreq/freq_table.c line 7
Quoted 13 lines
drivers/cpufreq/cpufreq.c +0
-0unregister_hotcpu_notifier (&cpufreq_cpu_notifier);write_lock_irqsave (&cpufreq_driver_lock, flags);drivers/cpufreq/freq_table.c +2
-0@@ -3,6 +3,8 @@* * Copyright (C) 2002 - 2003 Dominik Brodowski * +* Copyright (C) 2013 Lukasz Majewski <[email protected]> +*
You shouldn't add it unless you did some major work on this file. You aren't maintaining this file in 2013.
drivers/cpufreq/freq_table.c line 32
Quoted 5 lines
drivers/cpufreq/freq_table.c +5
-0+static int cpufreq_frequency_table_skip_boost (struct cpufreq_policy *policy, +unsigned int index) +{ +if (index ==CPUFREQ_BOOST ) + if (!policy->boost ||
This shouldn't be true. If index has got CPUFREQ_BOOST, then driver has to support boost.
Quoted 11 lines
drivers/cpufreq/freq_table.c +11
-0+ policy->boost->status == CPUFREQ_BOOST_DIS) +return 1 ; + +return 0 ; +} + +unsigned int +cpufreq_frequency_table_boost_max (struct cpufreq_frequency_table *freq_table) +{ +int index, boost_freq_max; +
drivers/cpufreq/freq_table.c line 53
Quoted 10 lines
drivers/cpufreq/freq_table.c +10
-0+for (index =0 , boost_freq_max =0 ; + freq_table[index].frequency !=CPUFREQ_TABLE_END ; index++) +if (freq_table[index].index ==CPUFREQ_BOOST ) { +if (freq_table[index].frequency > boost_freq_max) + boost_freq_max = freq_table[index].frequency; + } + +return boost_freq_max; +} +EXPORT_SYMBOL_GPL (cpufreq_frequency_table_boost_max);
why do we need this?
include/linux/cpufreq.h struct cpufreq_real_policy { · line 92
Quoted 13 lines
/*
* if you use these, you must assure that the frequency table is valid
* all the time betweenget_attrandput_attr!include/linux/cpufreq.h +2
-0@@ -88,6 +88,25 @@ struct cpufreq_real_policy {struct cpufreq_governor *governor;/* see below */ }; +#define CPUFREQ_BOOST_DIS (0) +#define CPUFREQ_BOOST_EN (1)
You don't need these.. Just create variable as bool and 0 & 1 would be fine.
Quoted 5 lines
include/linux/cpufreq.h +5
-0+struct cpufreq_policy ; +struct cpufreq_boost { +unsigned int max_boost_freq;/* maximum value of +* boosted freq */ +unsigned int max_normal_freq;/* non boost max freq */
include/linux/cpufreq.h struct cpufreq_real_policy { · line 108
Quoted 10 lines
include/linux/cpufreq.h +10
-0+int status;/* status of boost */ + +/* boost sysfs attributies */ +struct freq_attr **attr; + +/* low-level trigger for boost */ +int (*low_level_boost) (struct cpufreq_policy *policy,int state); + +struct list_head policies; +};
We don't need it. Just add two more fields to cpufreq_driver:
- have_boost_freqs and low_level_boost (maybe a better name. What's its use?)
include/linux/cpufreq.h struct cpufreq_policy { · line 136
Quoted 9 lines
include/linux/cpufreq.h +2
-0struct cpufreq_policy {/* CPUs sharing clock, require sw coordination */ cpumask_var_t cpus;/* Online CPUs only */ @@ -113,6 +132,9 @@ struct cpufreq_policy {struct cpufreq_real_policy user_policy; +struct cpufreq_boost *boost; +struct list_head boost_list;
We don't need both of these.
include/linux/cpufreq.h struct cpufreq_driver { · line 280
Quoted 9 lines
include/linux/cpufreq.h +0
-1struct kobject kobj;struct completion kobj_unregister; };@@ -277,7 +302,6 @@ struct cpufreq_driver {int cpufreq_register_driver (struct cpufreq_driver *driver_data);int cpufreq_unregister_driver (struct cpufreq_driver *driver_data); -
??
include/linux/cpufreq.h extern struct cpufreq_governor cpufreq_gov_conservative; · line 431
Quoted 9 lines
include/linux/cpufreq.h +2
-0void cpufreq_notify_transition (struct cpufreq_policy *policy,struct cpufreq_freqs *freqs,unsigned int state);@@ -403,6 +427,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative;#define CPUFREQ_ENTRY_INVALID ~0#define CPUFREQ_TABLE_END ~1 +/* Define index for boost frequency */ +#define CPUFREQ_BOOST ~2
s/CPUFREQ_BOOST/CPUFREQ_BOOST_FREQ
Re: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
Hi Viresh,
Quoted 40 lines
Hi,
Quoted 8 lines · Lukasz Majewski
This commit adds support for software based frequency boosting. Exynos4 SoCs (e.g. 4x12) allow setting of frequency above its normal condition limits. This can be done for some short time.
Overclocking (boost) support came from cpufreq driver (which is platform dependent). Hence the data structure describing it is defined at its file.
Quoted 5 lines
To allow support for either SW and HW (Intel) based boosting, the cpufreq core code has been extended to support both solutions.
The main boost switch has been put
at/sys/devices/system/cpu/cpufreq/boost.Log requires some better paragraphs but I am not concerned about it for now.
Quoted 8 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>--- drivers/cpufreq/cpufreq.c | 156 ++++++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 87 ++++++++++++++++++++++- include/linux/cpufreq.h | 35 +++++++++- 3 files changed, 275insertions(+), 3 deletions(-)
My initial view on this patch is: "It is overly engineered and needs to get simplified"
Quoted 8 lines
drivers/cpufreq/cpufreq.c +0
-0@@ -133,6 +133,11 @@ bool have_governor_per_policy(void)return cpufreq_driver->have_governor_per_policy; }
Quoted 7 lines
drivers/cpufreq/cpufreq.c bool have_governor_per_policy(void) · line 139
Quoted 4 lines
drivers/cpufreq/cpufreq.c +4
-0+/** +* Global definition of cpufreq_boost structure +*/ +struct cpufreq_boost *cpufreq_boost;Probably just a 'static bool' here
cpufreq_boost_enabled. Which takes care of selection from sysfs.
The pointer to struct cpufreq_boost is needed for further reference (as it is now done with struct cpufreq_driver pointer - *cpufreq_driver
- defined at cpufreq.c file).
Quoted 7 lines
Quoted 7 lines
drivers/cpufreq/cpufreq.c +0
-0static struct cpufreq_governor *__find_governor (const char *str_governor) {@@ -761,6 +805,18 @@ static int cpufreq_add_dev_interface(unsigned int cpu, if (cpufreq_set_drv_attr_files(policy, cpufreq_driver->attr)) goto err_out_kobj_put;
Quoted 6 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu, · line 810
Quoted 3 lines
drivers/cpufreq/cpufreq.c +3
-0+if (cpufreq_driver->boost) { +if (sysfs_create_file (cpufreq_global_kobject, + &(global_boost.attr)))This will report error for systems where we have two policy structures. As we are creating something already present.
Good point, thanks.
Quoted 10 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned · line 815
Quoted 6 lines
drivers/cpufreq/cpufreq.c +3
-0+ pr_warn("could not register global boost sysfs file\n"); + else + pr_debug("registered global boost sysfs file\n");Please make all your prints to print function name too:
pr_debug("%s: foo\n", __func__, foo);
OK.
Quoted 7 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu,
Quoted 4 lines
drivers/cpufreq/cpufreq.c +2
-0+if (cpufreq_set_drv_attr_files (policy, + cpufreq_driver->boost->attr))Why is this required? Why do we want platforms to add some files in sysfs?
There are two kinds of attributes, which are exported by boost:
1. global boost (/sys/devices/system/cpu/cpufreq/boost)
2. attributes describing cpufreq abilities when boost is available (/sys/devices/syste/cpu/cpu0/cpufreq/):
- scaling_boost_frequencies - which will show over clocked frequencies
- the scaling_available_frequencies will also display boosted frequency (when boost enabled)
Information from 2. is cpufreq_driver dependent. And that information shouldn't been displayed when boost is not available
Quoted 70 lines
Quoted 70 lines
/*********************************************************************
+ *
BOOST *
+ *********************************************************************/ +intcpufreq_boost_trigger_state(struct cpufreq_policy *policy, int state)+{drivers/cpufreq/cpufreq.c +5
-0+struct cpufreq_boost *boost; +unsigned long flags; +int ret =0 ; + + if (!policy || !policy->boost|| !policy->boost->low_level_boost)
drivers/cpufreq/cpufreq.c +10
-0+return -ENODEV ; + + boost = policy->boost; +write_lock_irqsave (&cpufreq_driver_lock, flags); + +if (boost->status != state) { + policy->boost->status = state; + ret = boost->low_level_boost (policy, state); +if (ret) { + pr_err("BOOST cannot %sable low level code(%d)\n",
drivers/cpufreq/cpufreq.c +14
-0+ state ? "en" : "dis", ret); +return ret; + } + } + +write_unlock_irqrestore (&cpufreq_driver_lock, flags); + +pr_debug ("cpufreq BOOST %sabled\n" , state ?"en" :"dis" ); + +return 0 ; +} + +/** +* cpufreq_boost_notifier - notifier callback for cpufreq policy change.
+ * <at> nb: structnotifier_block* with callback info.
+ * <at> event: value showing cpufreq event for which this function invoked.
+ * <at> data: callback-specific data
+ */drivers/cpufreq/cpufreq.c +11
-0+static int cpufreq_boost_notifier (struct notifier_block *nb, +unsigned long event,void *data) +{ +struct cpufreq_policy *policy = data; + +if (event ==CPUFREQ_INCOMPATIBLE ) { +if (!policy || !policy->boost) +return -ENODEV ; + +if (policy->boost->status ==CPUFREQ_BOOST_EN ) { + pr_info("NOTIFIER BOOST: MAX: %d e:%lu cpu:%d\n",
drivers/cpufreq/cpufreq.c +13
-0+ policy->max, event, policy->cpu); +cpufreq_boost_trigger_state (policy,0 ); + } + } + +return 0 ; +} + +/* Notifier for cpufreq policy change */ +static struct notifier_block cpufreq_boost_notifier_block = { + .notifier_call = cpufreq_boost_notifier, +}; +
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1987
Quoted 6 lines
drivers/cpufreq/cpufreq.c +6
-0+int cpufreq_boost_init (struct cpufreq_policy *policy) +{ +int ret =0 ; + +if (!policy) +return -EINVAL ;Heh, policy can't be NULL here.
Extra precautions :-). I will remove it.
Quoted 6 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1990
Quoted 3 lines
drivers/cpufreq/cpufreq.c +2
-0+if (!cpufreq_driver->boost) { +pr_err ("Boost mode not supported on this device\n" );Wow!! You want to screw everybody else's logs with this message. Its not a crime if you don't have boost mode supported :)
Hmm, I've exaggerated a bit here.... :)
Quoted 11 lines
Actually this routine must be called only if
cpufreq_driver->boostis valid.drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1994
Quoted 4 lines
drivers/cpufreq/cpufreq.c +4
-0+return -ENODEV ; + } + + policy->boost = cpufreq_boost = cpufreq_driver->boost;Why are we copying same pointer to
policy->boost? Driver is passing pointer to a single memory location, just save it globally.
This needs some explanation.
The sysfs entry presented at [1] doesn't bring any useful information to reuse (like *policy). For this reason the global cpufreq_boost pointer is needed.
However to efficiently manage the boost, it is necessary to keep per policy pointer to the only struct cpufreq_boost instance (defined at cpufreq_driver code).
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1998
Quoted 5 lines
+ /* disable boost for newly created policy - as we e.g.
changedrivers/cpufreq/cpufreq.c +2
-0+governor */ + policy->boost->status =CPUFREQ_BOOST_DIS ;Drivers supporting boost may want boost to be enabled by default, maybe without any sysfs calls.
This can be done by setting the struct cpufreq_boost status field to CPUFREQ_BOOST_EN at cpufreq driver code (when boost structure is defined)
Quoted 10 lines
Quoted 10 lines
drivers/cpufreq/cpufreq.c +2
-0+/* register policy notifier */ + ret =cpufreq_register_notifier(&cpufreq_boost_notifier_block,
drivers/cpufreq/cpufreq.c +6
-0+ CPUFREQ_POLICY_NOTIFIER); +if (ret) { +pr_err ("CPUFREQ BOOST notifier not registered.\n" ); +return ret; + } +/* add policy to policies list headed at struct
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 2012
Quoted 6 lines
cpufreq_boost*/
+ list_add_tail(&policy->boost_list,&cpufreq_boost->policies); +drivers/cpufreq/cpufreq.c +3
-0+return 0 ; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_init);Why do we need to maintain a list of boost here? notifiers? complex :(
Notifier is needed to disable boost when policy is changed (for example when we change from ondemand/lab to performance governor).
I wanted to avoid the situation when boost stays enabled across different governors.
The list of in system available policies is defined to allow boost enable/disable for all policies available (by changing for example policy->max field).
If we decide, that we will support only one policy (as it is now at e.g. Exynos), the list is unnecessary here.
Quoted 10 lines
Quoted 10 lines
+/*********************************************************************
* REGISTER / UNREGISTER CPUFREQ
DRIVER *
*********************************************************************/drivers/cpufreq/cpufreq.c +0
-0@@ -1954,6 +2106,10 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) pr_debug("unregistering driver %s\n", driver->name);
Quoted 7 lines
drivers/cpufreq/cpufreq.c int cpufreq_unregister_driver(struct cpufreq_driver *driver)
Quoted 5 lines
drivers/cpufreq/cpufreq.c +3
-0subsys_interface_unregister (&cpufreq_interface); + +if (cpufreq_driver->boost) +sysfs_remove_file (cpufreq_global_kobject, &(global_boost.attr));You haven't removed this from policy. Memory leak.
Yes, you are right.
Quoted 17 lines
Quoted 9 lines
drivers/cpufreq/cpufreq.c +0
-0unregister_hotcpu_notifier (&cpufreq_cpu_notifier);write_lock_irqsave (&cpufreq_driver_lock, flags);(quoted diff) +0
-0
b/drivers/cpufreq/freq_table.cindex d7a7966..0e95524 100644drivers/cpufreq/freq_table.c line 7
Quoted 5 lines
drivers/cpufreq/freq_table.c +2
-0@@ -3,6 +3,8 @@* * Copyright (C) 2002 - 2003 Dominik Brodowski * +* Copyright (C) 2013 Lukasz Majewski <[email protected]> +* You shouldn't add it unless you did some major work on this file. You aren't maintaining this file in 2013.
OK, I will remove the entry.
Quoted 10 lines
drivers/cpufreq/freq_table.c line 32
Quoted 7 lines
drivers/cpufreq/freq_table.c +5
-0+static int cpufreq_frequency_table_skip_boost (struct cpufreq_policy *policy, +unsigned int index) +{ +if (index ==CPUFREQ_BOOST ) + if (!policy->boost ||This shouldn't be true. If index has got
CPUFREQ_BOOST, then driver has to support boost.
Correct me if I'm wrong here, but in my understanding the boost shall be only supported when both CPUFREQ_BOOST index is defined in a freq_table and boost.state = CPUFREQ_BOOST_EN is set.
Setting of CPUFREQ_BOOST shouldn't by default allow to use over clocking frequency.
Quoted 19 lines
Quoted 19 lines
drivers/cpufreq/freq_table.c +8
-0+ policy->boost->status == CPUFREQ_BOOST_DIS) +return 1 ; + +return 0 ; +} + +unsigned int +cpufreq_frequency_table_boost_max(struct cpufreq_frequency_table
*freq_table) +{drivers/cpufreq/freq_table.c +4
-0+int index, boost_freq_max; + + for (index = 0, boost_freq_max = 0; + freq_table[index].frequency != CPUFREQ_TABLE_END;index++)
drivers/cpufreq/freq_table.c +2
-0+if (freq_table[index].index ==CPUFREQ_BOOST ) { + if (freq_table[index].frequency >
boost_freq_max)
+boost_freq_max=
Quoted 8 lines
drivers/cpufreq/freq_table.c line 53
Quoted 6 lines
freq_table[index].frequency;
drivers/cpufreq/freq_table.c +5
-0+ } + +return boost_freq_max; +} +EXPORT_SYMBOL_GPL (cpufreq_frequency_table_boost_max);why do we need this?
To evaluate the maximal boost frequency from the frequency table. It is then used as a delimiter (when LAB cooperates with thermal framework).
Quoted 13 lines
Quoted 13 lines
/*
* if you use these, you must assure that the frequency table is
valid
* all the time betweenget_attrandput_attr!include/linux/cpufreq.h +0
-0@@ -88,6 +88,25 @@ struct cpufreq_real_policy {struct cpufreq_governor *governor;/* see below */ };
Quoted 5 lines
include/linux/cpufreq.h struct cpufreq_real_policy { · line 92
Quoted 2 lines
include/linux/cpufreq.h +2
-0+#define CPUFREQ_BOOST_DIS (0) +#define CPUFREQ_BOOST_EN (1)You don't need these.. Just create variable as bool and 0 & 1 would be fine.
Yes, this seems to be a clearer solution.
Quoted 13 lines
Quoted 13 lines
include/linux/cpufreq.h +5
-0+struct cpufreq_policy ; +struct cpufreq_boost { +unsigned int max_boost_freq;/* maximum value of +* boosted freq */ +unsigned int max_normal_freq;/* non boost max freq */
include/linux/cpufreq.h +6
-0+int status;/* status of boost */ + +/* boost sysfs attributies */ +struct freq_attr **attr; + +/* low-level trigger for boost */
Quoted 8 lines
include/linux/cpufreq.h struct cpufreq_real_policy { · line 108
Quoted 4 lines
+ int (
*low_level_boost) (structcpufreq_policy*policy, int
state); +include/linux/cpufreq.h +2
-0+struct list_head policies; +};We don't need it. Just add two more fields to
cpufreq_driver:
-have_boost_freqsandlow_level_boost(maybe a better name. What's its use?)
The separate struct cpufreq_boost was created to explicitly separate boost fields from cpufreq_driver structure.
If in your opinion this structure is redundant, I can remove it and extend cpufreq_driver structure.
Quoted 6 lines
Quoted 6 lines
struct
cpufreq_policy{
/* CPUs sharing clock, require sw coordination */
cpumask_var_tcpus; /* Online CPUs only */include/linux/cpufreq.h +0
-0@@ -113,6 +132,9 @@ struct cpufreq_policy {
Quoted 6 lines
include/linux/cpufreq.h struct cpufreq_policy { · line 136
Quoted 4 lines
include/linux/cpufreq.h +2
-0struct cpufreq_real_policy user_policy; +struct cpufreq_boost *boost; +struct list_head boost_list;We don't need both of these.
*boost pointer is necessary when one wants to enable/disable boost from e.g governor code (which operates mostly on struct cpufreq_policy *policy pointers).
The boost_list is necessary to connect policies in a list.
Quoted 16 lines
include/linux/cpufreq.h struct cpufreq_driver { · line 280
Quoted 10 lines
include/linux/cpufreq.h +0
-1struct kobject kobj;struct completion kobj_unregister; };@@ -277,7 +302,6 @@ struct cpufreq_driver {int cpufreq_register_driver (struct cpufreq_driver *driver_data);int cpufreq_unregister_driver (struct cpufreq_driver *driver_data); -??
Quoted 3 lines
include/linux/cpufreq.h +0
-0void cpufreq_notify_transition (struct cpufreq_policy *policy,struct cpufreq_freqs *freqs,unsigned int state);
Quoted 8 lines
include/linux/cpufreq.h extern struct cpufreq_governor cpufreq_gov_conservative; · line 431
Quoted 6 lines
include/linux/cpufreq.h +0
-0@@ -403,6 +427,9 @@ extern struct cpufreq_governor
cpufreq_gov_conservative; #defineCPUFREQ_ENTRY_INVALID~0
#defineCPUFREQ_TABLE_END~1include/linux/cpufreq.h +2
-0+/* Define index for boost frequency */ +#define CPUFREQ_BOOST ~2s/CPUFREQ_BOOST/CPUFREQ_BOOST_FREQ
Ok, will be changed to something more descriptive.
Thanks for thorough review :-)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
Quoted 18 lines · Lukasz Majewski
Quoted 6 lines · Lukasz Majewski
Quoted 2 lines
cpufreq_driver->boost->attr))Why is this required? Why do we want platforms to add some files in sysfs?
There are two kinds of attributes, which are exported by boost:
1. global boost (
/sys/devices/system/cpu/cpufreq/boost)2. attributes describing cpufreq abilities when boost is available (
/sys/devices/syste/cpu/cpu0/cpufreq/):
-scaling_boost_frequencies- which will show over clocked frequencies
- thescaling_available_frequencieswill also display boosted frequency (when boost enabled)
Quoted 2 lines
Information from 2. is
cpufreq_driverdependent. And that information shouldn't been displayed when boost is not available
This is not how I wanted this to be coded. Lets keep things simple:
- Implement it in the way cpufreq_freq_attr_scaling_available_freqs is implemented. And then drivers which need to see boost freqs can add it in their attr.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
+
policy->boost=cpufreq_boost=cpufreq_driver->boost;Why are we copying same pointer to
policy->boost? Driver is passing pointer to a single memory location, just save it globally.This needs some explanation.
Quoted 7 lines
The sysfs entry presented at [1] doesn't bring any useful information to reuse (like *policy). For this reason the global
cpufreq_boostpointer is needed.However to efficiently manage the boost, it is necessary to keep per policy pointer to the only struct
cpufreq_boostinstance (defined atcpufreq_drivercode).
No we don't need to screw struct cpufreq_policy with it. Just need two variables here:
- cpufreq_driver->boost: If driver supports boost or not.
- If above is true then a global bool variable that will say boost is enabled from sysfs or not.
Quoted 11 lines
Quoted 7 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1998
Quoted 4 lines
+ /* disable boost for newly created policy - as we e.g.
changedrivers/cpufreq/cpufreq.c +2
-0+governor */ + policy->boost->status =CPUFREQ_BOOST_DIS ;Drivers supporting boost may want boost to be enabled by default, maybe without any sysfs calls.
This can be done by setting the struct
cpufreq_booststatus field toCPUFREQ_BOOST_ENat cpufreq driver code (when boost structure is defined)
This really isn't driver dependent.. But user dependent. Maybe lets keep it disabled and people can enable it from sysfs.
Quoted 8 lines
Quoted 1 line
Why do we need to maintain a list of boost here? notifiers? complex :(
Notifier is needed to disable boost when policy is changed (for example when we change from ondemand/lab to performance governor).
I wanted to avoid the situation when boost stays enabled across different governors.
Quoted 6 lines
The list of in system available policies is defined to allow boost enable/disable for all policies available (by changing for example
policy->maxfield).If we decide, that we will support only one policy (as it is now at e.g. Exynos), the list is unnecessary here.
What we discussed last in your earlier patchset was:
- Keep boost feature separate from governors.
- If it is enabled, then any governor can use it (if they want).
- Lets not disable it if governor is changed. user must do it explicitly.
Quoted 10 lines
Quoted 9 lines
drivers/cpufreq/freq_table.c line 32
Quoted 6 lines
+static int cpufreq_frequency_table_skip_boost(struct
cpufreq_policy*policy,drivers/cpufreq/freq_table.c +4
-0+ unsigned int index) +{ +if (index ==CPUFREQ_BOOST ) + if (!policy->boost ||This shouldn't be true. If index has got
CPUFREQ_BOOST, then driver has to support boost.
Quoted 6 lines
Correct me if I'm wrong here, but in my understanding the boost shall be only supported when both
CPUFREQ_BOOSTindex is defined in afreq_tableand boost.state =CPUFREQ_BOOST_ENis set.Setting of
CPUFREQ_BOOSTshouldn't by default allow to use over clocking frequency.
For cpufreq core boost is enabled as soon as cpufreq_driver->boost is true. We can have additional checks to see if there is atleast one boost frequency but can skip this too.
Quoted 4 lines
Quoted 1 line
why do we need this?
To evaluate the maximal boost frequency from the frequency table. It is then used as a delimiter (when LAB cooperates with thermal framework).
Introduce this with LAB then.. Lets keep it as simple as possible for now. One step at a time.
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
include/linux/cpufreq.h +4
-0+struct cpufreq_boost { +unsigned int max_boost_freq;/* maximum value of +* boosted freq */ +unsigned int max_normal_freq;/* non boost max freq */
include/linux/cpufreq.h +6
-0+int status;/* status of boost */ + +/* boost sysfs attributies */ +struct freq_attr **attr; + +/* low-level trigger for boost */ Quoted 8 lines
include/linux/cpufreq.h struct cpufreq_real_policy { · line 108
Quoted 4 lines
+ int (
*low_level_boost) (structcpufreq_policy*policy, int
state); +include/linux/cpufreq.h +2
-0+struct list_head policies; +};We don't need it. Just add two more fields to
cpufreq_driver:
-have_boost_freqsandlow_level_boost(maybe a better name. What's its use?)
Quoted 5 lines
The separate struct
cpufreq_boostwas created to explicitly separate boost fields fromcpufreq_driverstructure.If in your opinion this structure is redundant, I can remove it and extend
cpufreq_driverstructure.
I am not against a structure (as putting related stuff in a struct is always better), but against so many fields in it to make things complicated.
I will only keep have_boost_freqs and low_level_boost. Remove everything else.
Quoted 3 lines
*boost pointer is necessary when one wants to enable/disable boost from e.g governor code (which operates mostly on struct
cpufreq_policy*policy pointers).
We don't need to do this. boost can only be disabled from userspace by user. No intervention from governor.
Re: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
Hi Viresh,
Quoted 144 lines · Lukasz Majewski
Quoted 19 lines
Quoted 7 lines
Quoted 1 line · Lukasz Majewski
cpufreq_driver->boost->attr))Why is this required? Why do we want platforms to add some files in sysfs?
There are two kinds of attributes, which are exported by boost:
1. global boost (
/sys/devices/system/cpu/cpufreq/boost)2. attributes describing cpufreq abilities when boost is available (
/sys/devices/syste/cpu/cpu0/cpufreq/):
-scaling_boost_frequencies- which will show over clocked frequencies
- thescaling_available_frequencieswill also display
boosted frequency (when boost enabled)Quoted 2 lines
Information from 2. is
cpufreq_driverdependent. And that information shouldn't been displayed when boost is not availableThis is not how I wanted this to be coded. Lets keep things simple:
- Implement it in the waycpufreq_freq_attr_scaling_available_freqsis implemented. And then drivers which need to see boost freqs can add it in their attr.Quoted 7 lines
Quoted 4 lines
Quoted 1 line
+
policy->boost=cpufreq_boost=cpufreq_driver->boost;Why are we copying same pointer to
policy->boost? Driver is passing pointer to a single memory location, just save it globally.This needs some explanation.
Quoted 7 lines
The sysfs entry presented at [1] doesn't bring any useful information to reuse (like *policy). For this reason the global
cpufreq_boostpointer is needed.However to efficiently manage the boost, it is necessary to keep per policy pointer to the only struct
cpufreq_boostinstance (defined atcpufreq_drivercode).No we don't need to screw struct
cpufreq_policywith it. Just need two variables here:
-cpufreq_driver->boost: If driver supports boost or not.
- If above is true then a global bool variable that will say boost is enabled from sysfs or not.Quoted 11 lines
Quoted 7 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1998
Quoted 4 lines
+ /* disable boost for newly created policy - as we e.g.
changedrivers/cpufreq/cpufreq.c +2
-0+governor */ + policy->boost->status =CPUFREQ_BOOST_DIS ;Drivers supporting boost may want boost to be enabled by default, maybe without any sysfs calls.
This can be done by setting the struct
cpufreq_booststatus field toCPUFREQ_BOOST_ENat cpufreq driver code (when boost structure is defined)This really isn't driver dependent.. But user dependent. Maybe lets keep it disabled and people can enable it from sysfs.
Quoted 9 lines
Quoted 2 lines
Why do we need to maintain a list of boost here? notifiers? complex :(
Notifier is needed to disable boost when policy is changed (for example when we change from ondemand/lab to performance governor).
I wanted to avoid the situation when boost stays enabled across different governors.
Quoted 6 lines
The list of in system available policies is defined to allow boost enable/disable for all policies available (by changing for example
policy->maxfield).If we decide, that we will support only one policy (as it is now at e.g. Exynos), the list is unnecessary here.
What we discussed last in your earlier patchset was:
- Keep boost feature separate from governors.
- If it is enabled, then any governor can use it (if they want).
- Lets not disable it if governor is changed. user must do it explicitly.Quoted 10 lines
Quoted 9 lines
drivers/cpufreq/freq_table.c line 32
Quoted 6 lines
+static int cpufreq_frequency_table_skip_boost(struct
cpufreq_policy*policy,drivers/cpufreq/freq_table.c +4
-0+ unsigned int index) +{ +if (index ==CPUFREQ_BOOST ) + if (!policy->boost ||This shouldn't be true. If index has got
CPUFREQ_BOOST, then driver has to support boost.Quoted 6 lines
Correct me if I'm wrong here, but in my understanding the boost shall be only supported when both
CPUFREQ_BOOSTindex is defined in afreq_tableand boost.state =CPUFREQ_BOOST_ENis set.Setting of
CPUFREQ_BOOSTshouldn't by default allow to use over clocking frequency.For cpufreq core boost is enabled as soon as
cpufreq_driver->boostis true. We can have additional checks to see if there is atleast one boost frequency but can skip this too.Quoted 5 lines
Quoted 1 line
why do we need this?
To evaluate the maximal boost frequency from the frequency table. It is then used as a delimiter (when LAB cooperates with thermal framework).
Introduce this with LAB then.. Lets keep it as simple as possible for now. One step at a time.
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
(quoted diff) +2
-0+struct cpufreq_boost { + unsigned int max_boost_freq; /* maximum valueof
+ * boosted freq
*/
+ unsigned intmax_normal_freq; /* non boost max
freq */include/linux/cpufreq.h +6
-0+int status;/* status of boost */ + +/* boost sysfs attributies */ +struct freq_attr **attr; + +/* low-level trigger for boost */ Quoted 8 lines
include/linux/cpufreq.h struct cpufreq_real_policy { · line 108
Quoted 4 lines
+ int (
*low_level_boost) (structcpufreq_policy*policy,
int state); +include/linux/cpufreq.h +2
-0+struct list_head policies; +};We don't need it. Just add two more fields to
cpufreq_driver:
-have_boost_freqsandlow_level_boost(maybe a better name. What's its use?)Quoted 5 lines
The separate struct
cpufreq_boostwas created to explicitly separate boost fields fromcpufreq_driverstructure.If in your opinion this structure is redundant, I can remove it and extend
cpufreq_driverstructure.
Quoted 6 lines
I am not against a structure (as putting related stuff in a struct is always better), but against so many fields in it to make things complicated.
I will only keep
have_boost_freqsandlow_level_boost. Remove everything else.
I would prefer to have following fields in the cpufreq_boost structure:
struct cpufreq_boost {
unsigned int max_boost_freq; /*boost max freq*/
unsigned int max_normal_freq; /*max normal freq
int (*low_level_boost) (int state);
bool boost_en; /* indicate if boost is enabled */
}
The max_{boost|normal}_freq fields will be filed at ret = cpufreq_driver->init(policy);
Thanks to them I will avoid calling many times routine, which extracts from freq_table maximal boost and normal frequencies.
I could define those variables in the exynos-cpufreq.c driver, but I think, that they are more suitable to be embedded at cpufreq_boost structure.
Quoted 7 lines
Quoted 4 lines
*boost pointer is necessary when one wants to enable/disable boost from e.g governor code (which operates mostly on struct
cpufreq_policy*policy pointers).We don't need to do this. boost can only be disabled from userspace by user. No intervention from governor.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
Hi Lukasz,
On 7 June 2013 18:57, Lukasz Majewski <[email protected]> wrote:
I hope you agreed to all the other comments I gave as I don't see an explicit reply below each of these. I have seen people missing these in past, so what would be better to do is:
- either reply below each one of them and say yes or no..
- Or write once below many comments and say: All above comments are accepted.
So, that Reviewer is assured that you haven't missed anything.
Quoted 11 lines
I would prefer to have following fields in the
cpufreq_booststructure:
structcpufreq_boost{
unsigned intmax_boost_freq; /*boost max freq*/
unsigned intmax_normal_freq; /*max normal freq
int (*low_level_boost) (int state);
boolboost_en; /* indicate if boost is enabled */
}The max_{boost|normal}_freq fields will be filed at ret =
cpufreq_driver->init(policy);
Quoted 6 lines
Thanks to them I will avoid calling many times routine, which extracts from
freq_tablemaximal boost and normal frequencies.I could define those variables in the
exynos-cpufreq.cdriver, but I think, that they are more suitable to be embedded atcpufreq_booststructure.
I understand that you need these variables (I will still look how you are using them in next version). But they are per policy and driver isn't responsible for maintaining them. If they are required then cpufreq core must find them out and keep in struct cpufreq_policy (as they are policy dependent)..
So, remove this structure from cpufreq_driver and embed variables directly.
Re: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
Hi Viresh,
Quoted 4 lines
Hi Lukasz,
On 7 June 2013 18:57, Lukasz Majewski <[email protected]> wrote:
Quoted 9 lines
I hope you agreed to all the other comments I gave as I don't see an explicit reply below each of these. I have seen people missing these in past, so what would be better to do is:
- either reply below each one of them and say yes or no..
- Or write once below many comments and say: All above comments are accepted.So, that Reviewer is assured that you haven't missed anything.
Thanks for reminding :-).
I've read through all the comments. I'm redesigning now the driver to remove redundant code.
Quoted 18 lines
Quoted 11 lines
I would prefer to have following fields in the
cpufreq_boost
structure: structcpufreq_boost{
unsigned intmax_boost_freq; /*boost max freq*/
unsigned intmax_normal_freq; /*max normal freq
int (*low_level_boost) (int state);
boolboost_en; /* indicate if boost is enabled */
}The max_{boost|normal}_freq fields will be filed at ret =
cpufreq_driver->init(policy);Quoted 6 lines
Thanks to them I will avoid calling many times routine, which extracts from
freq_tablemaximal boost and normal frequencies.I could define those variables in the
exynos-cpufreq.cdriver, but I think, that they are more suitable to be embedded atcpufreq_booststructure.
Quoted 8 lines
I understand that you need these variables (I will still look how you are using them in next version). But they are per policy and driver isn't responsible for maintaining them. If they are required then cpufreq core must find them out and keep in struct
cpufreq_policy(as they are policy dependent)..So, remove this structure from
cpufreq_driverand embed variables directly.
After refactoring the code. I admit, that we shall embed the struct cpu_boost fields directly to the coufreq_driver. There is no point to create structure with 2 fields.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
Quoted 3 lines · Lukasz Majewski
After refactoring the code. I admit, that we shall embed the struct
cpu_boostfields directly to thecoufreq_driver. There is no point to create structure with 2 fields.
Great!! I will wait for your next version.
Re: [PATCH 2/5] cpufreq:boost: Add support for software based CPU frequency boost
In reply to Viresh KumarHi Viresh,
Quoted 20 lines · Lukasz Majewski
Quoted 19 lines
Quoted 7 lines
Quoted 1 line · Lukasz Majewski
cpufreq_driver->boost->attr))Why is this required? Why do we want platforms to add some files in sysfs?
There are two kinds of attributes, which are exported by boost:
1. global boost (
/sys/devices/system/cpu/cpufreq/boost)2. attributes describing cpufreq abilities when boost is available (
/sys/devices/syste/cpu/cpu0/cpufreq/):
-scaling_boost_frequencies- which will show over clocked frequencies
- thescaling_available_frequencieswill also display
boosted frequency (when boost enabled)
Quoted 7 lines
Quoted 2 lines
Information from 2. is
cpufreq_driverdependent. And that information shouldn't been displayed when boost is not availableThis is not how I wanted this to be coded. Lets keep things simple:
- Implement it in the waycpufreq_freq_attr_scaling_available_freqsis implemented. And then drivers which need to see boost freqs can add it in their attr.
I've added scaling_boost_frequencies to cpufreq_driver attr.
However, I would keep the boost attributes definition in the freq_table file (as I've proposed in my patch).
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
Quoted 2 lines
+
policy->boost=cpufreq_boost=cpufreq_driver->boost;Why are we copying same pointer to
policy->boost? Driver is passing pointer to a single memory location, just save it globally.This needs some explanation.
The sysfs entry presented at [1] doesn't bring any useful information to reuse (like *policy). For this reason the global
cpufreq_boostpointer is needed.
Quoted 7 lines
Quoted 3 lines
However to efficiently manage the boost, it is necessary to keep per policy pointer to the only struct
cpufreq_boostinstance (defined atcpufreq_drivercode).No we don't need to screw struct
cpufreq_policywith it. Just need two variables here:
-cpufreq_driver->boost: If driver supports boost or not.
This will be done as above.
Quoted 2 lines
- If above is true then a global bool variable that will say boost is enabled from sysfs or not.
One global flag will be defined at cpufreq.c to indicate if global boost sysfs attr has been created.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1998
Quoted 5 lines
+ /* disable boost for newly created policy - as we e.g.
changedrivers/cpufreq/cpufreq.c +2
-0+governor */ + policy->boost->status =CPUFREQ_BOOST_DIS ;Drivers supporting boost may want boost to be enabled by default, maybe without any sysfs calls.
Quoted 6 lines
Quoted 3 lines
This can be done by setting the struct
cpufreq_booststatus field toCPUFREQ_BOOST_ENat cpufreq driver code (when boost structure is defined)This really isn't driver dependent.. But user dependent. Maybe lets keep it disabled and people can enable it from sysfs.
The cpufreq_driver struct will have boost_en field. This will allow keep boost state (it is similar to global boost_enable at acpi-cpufreq.c).
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
Why do we need to maintain a list of boost here? notifiers? complex :(
Notifier is needed to disable boost when policy is changed (for example when we change from ondemand/lab to performance governor).
I wanted to avoid the situation when boost stays enabled across different governors.
The list of in system available policies is defined to allow boost enable/disable for all policies available (by changing for example
policy->maxfield).
Quoted 5 lines
Quoted 2 lines
If we decide, that we will support only one policy (as it is now at e.g. Exynos), the list is unnecessary here.
What we discussed last in your earlier patchset was:
- Keep boost feature separate from governors.
Ok.
Quoted 1 line
- If it is enabled, then any governor can use it (if they want).
Ok, lets do it in this way
Quoted 2 lines
- Lets not disable it if governor is changed. user must do it explicitly.
Ok, agree (notifier removed).
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
drivers/cpufreq/freq_table.c line 32
Quoted 7 lines
+static int cpufreq_frequency_table_skip_boost(struct
cpufreq_policy*policy,drivers/cpufreq/freq_table.c +4
-0+ unsigned int index) +{ +if (index ==CPUFREQ_BOOST ) + if (!policy->boost ||This shouldn't be true. If index has got
CPUFREQ_BOOST, then driver has to support boost.Correct me if I'm wrong here, but in my understanding the boost shall be only supported when both
CPUFREQ_BOOSTindex is defined in afreq_tableand boost.state =CPUFREQ_BOOST_ENis set.
Quoted 6 lines
Quoted 2 lines
Setting of
CPUFREQ_BOOSTshouldn't by default allow to use over clocking frequency.For cpufreq core boost is enabled as soon as
cpufreq_driver->boostis true. We can have additional checks to see if there is atleast one boost frequency but can skip this too.
Checks are needed to read max_normal frequency and max boost frequency from frequency table.
In exynos cpufreq_driver->init() I will disable boost.
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
why do we need this?
To evaluate the maximal boost frequency from the frequency table. It is then used as a delimiter (when LAB cooperates with thermal framework).
Introduce this with LAB then.. Lets keep it as simple as possible for now. One step at a time.
Sorry, I have LAB in back of my head. For now I'm forgetting about it :-) [*]
Quoted 29 lines
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
(quoted diff) +2
-0+struct cpufreq_boost { + unsigned int max_boost_freq; /* maximum valueof
+ * boosted freq
*/
+ unsigned intmax_normal_freq; /* non boost max
freq */include/linux/cpufreq.h +6
-0+int status;/* status of boost */ + +/* boost sysfs attributies */ +struct freq_attr **attr; + +/* low-level trigger for boost */ Quoted 8 lines
include/linux/cpufreq.h struct cpufreq_real_policy { · line 108
Quoted 4 lines
+ int (
*low_level_boost) (structcpufreq_policy*policy,
int state); +include/linux/cpufreq.h +2
-0+struct list_head policies; +};We don't need it. Just add two more fields to
cpufreq_driver:
-have_boost_freqsandlow_level_boost(maybe a better name. What's its use?)Quoted 5 lines
The separate struct
cpufreq_boostwas created to explicitly separate boost fields fromcpufreq_driverstructure.If in your opinion this structure is redundant, I can remove it and extend
cpufreq_driverstructure.
Quoted 6 lines
I am not against a structure (as putting related stuff in a struct is always better), but against so many fields in it to make things complicated.
I will only keep
have_boost_freqsandlow_level_boost. Remove everything else.
As I've written at other mail. This struct will have only two fields, so I will embed those fields at cpufreq_driver.
Quoted 7 lines
Quoted 4 lines
*boost pointer is necessary when one wants to enable/disable boost from e.g governor code (which operates mostly on struct
cpufreq_policy*policy pointers).We don't need to do this. boost can only be disabled from userspace by user. No intervention from governor.
Let's got for that option (as I've promissed at [*] :-) ).
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 3/5 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
In reply to Lukasz MajewskiThe Intel's HW based boost solution needs to cooperate with common cpufreq boost.
For this reason the sysfs handling code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq.c code.
The _store_boost() function has been redesigned to be used as low_level_boost callback.
--- drivers/cpufreq/acpi-cpufreq.c | 64 ++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 38 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +26 -38
@@ -133,20 +133,10 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask)wrmsr_on_cpus (cpumask, msr_addr, msrs); } -static ssize_t _store_boost (const char *buf,size_t count) +static int _store_boost (struct cpufreq_policy *policy,int val) { -int ret; -unsigned long val =0 ; - -if (!boost_supported) -return -EINVAL ; - - ret =kstrtoul (buf,10 , &val); -if (ret || (val >1 )) -return -EINVAL ; -if ((val && boost_enabled) || (!val && !boost_enabled)) -return count; +return 0 ;get_online_cpus ();
@@ -157,30 +147,31 @@ static ssize_t _store_boost(const char *buf, size_t count) boost_enabled = val;pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" ); -return count; +return 0 ; } -static ssize_t store_global_boost (struct kobject *kobj,struct attribute *attr, -const char *buf,size_t count) +static ssize_t store_boost (const char *buf,size_t count) { -return _store_boost (buf, count); -} +int ret; +unsigned long val =0 ; -static ssize_t show_global_boost (struct kobject *kobj, -struct attribute *attr,char *buf) -{ -return sprintf (buf,"%u\n" , boost_enabled); -} +if (!boost_supported) +return -EINVAL ; -static struct global_attr global_boost =__ATTR (boost,0644 , - show_global_boost, - store_global_boost); + ret =kstrtoul (buf,10 , &val); +if (ret || (val >1 )) +return -EINVAL ; + +_store_boost (NULL , (int ) val); + +return count; +}#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB static ssize_t store_cpb (struct cpufreq_policy *policy,const char *buf,size_t count) { -return _store_boost (buf, count); +return store_boost (buf, count); }static ssize_t show_cpb (struct cpufreq_policy *policy,char *buf)
@@ -910,6 +901,11 @@ static struct freq_attr *acpi_cpufreq_attr[] = { NULL, }; +static struct cpufreq_boost acpi_boost = { + .low_level_boost = _store_boost, + .policies =LIST_HEAD_INIT (acpi_boost.policies), +}; +static struct cpufreq_driver acpi_cpufreq_driver = { .verify = acpi_cpufreq_verify, .target = acpi_cpufreq_target,
@@ -920,6 +916,9 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .name = "acpi-cpufreq", .owner = THIS_MODULE, .attr = acpi_cpufreq_attr, +#ifdef CONFIG_CPU_FREQ_BOOST + .boost = &acpi_boost, +#endif };static void __init acpi_cpufreq_boost_init (void )
@@ -941,22 +940,11 @@ static void __init acpi_cpufreq_boost_init(void)register_cpu_notifier (&boost_nb);put_online_cpus (); - }else - global_boost.attr.mode =0444 ; - -/* We create the boost file in any case, though for systems without -* hardware support it will be read-only and hardwired to return 0. -*/ -if (sysfs_create_file (cpufreq_global_kobject, &(global_boost.attr))) -pr_warn (PFX "could not register global boost sysfs file\n" ); -else -pr_debug ("registered global boost sysfs file\n" ); + } } static void __exit acpi_cpufreq_boost_exit(void) { -sysfs_remove_file (cpufreq_global_kobject, &(global_boost.attr)); -if (msrs) {unregister_cpu_notifier (&boost_nb);
Signature · 1 line
1.7.10.4
PATCH 4/5 cpufreq:exynos:Extend exynos cpufreq driver to support boost
In reply to Lukasz MajewskiNew structure - exynos_boost has been created to embrace the information related to boost support.
The CONFIG_CPU_FREQ_BOOST flag is responsible for attaching the boost structure to the cpufreq driver.
Setting exynos cpufreq driver .boost field to NULL, indicates that boost is not supported.
Moreover device tree attribute "boost_mode" defines if exynos platform support frequency overclocking (boost).
Moreover new attribute structure describing extra CPU features supported when boost is enabled is also provided.
--- drivers/cpufreq/exynos-cpufreq.c | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
drivers/cpufreq/exynos-cpufreq.c +48 -0
@@ -267,6 +267,38 @@ static struct freq_attr *exynos_cpufreq_attr[] = { NULL, }; +/* per CPU boost attributes to be exported to sysfs */ +static struct freq_attr *exynos_cpufreq_boost_attr[] = { + &cpufreq_freq_attr_boost_available_freqs, +NULL , +}; + +/* low level code to enable/disable boost */ +static int +exynos_cpufreq_boost_trigger (struct cpufreq_policy *policy,int state) +{ + +if (!policy || !policy->boost) +return -ENODEV ; + +if (state) { + policy->boost->max_normal_freq = policy->max; + policy->max = policy->boost->max_boost_freq; + policy->cpuinfo.max_freq = policy->max; + }else { + policy->max = policy->boost->max_normal_freq; + policy->cpuinfo.max_freq = policy->max; + } + +return 0 ; +} + +static struct cpufreq_boost exynos_boost = { + .attr = exynos_cpufreq_boost_attr, + .low_level_boost = exynos_cpufreq_boost_trigger, + .policies =LIST_HEAD_INIT (exynos_boost.policies), +}; +static struct cpufreq_driver exynos_driver = { .flags =CPUFREQ_STICKY , .verify = exynos_verify_speed,
@@ -276,6 +308,9 @@ static struct cpufreq_driver exynos_driver = { .exit = exynos_cpufreq_cpu_exit, .name = "exynos_cpufreq", .attr = exynos_cpufreq_attr, +#ifdef CONFIG_CPU_FREQ_BOOST + .boost = &exynos_boost, +#endif #ifdef CONFIG_PM .suspend = exynos_cpufreq_suspend, .resume = exynos_cpufreq_resume,
@@ -359,6 +394,8 @@ static struct of_device_id exynos_cpufreq_of_match[] __initconst = {static int __init exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *node = pdev->dev.of_node; +int ret = -EINVAL ; exynos_info =kzalloc (sizeof (struct exynos_dvfs_info ),GFP_KERNEL );
@@ -390,6 +427,17 @@ static int __init exynos_cpufreq_probe(struct platform_device *pdev) goto err_vdd_arm; } +/* If boost_mode property not available - then NULL out the boost +pointer to indicate thst boost is not supported*/ +if (exynos_driver.boost) { +if (of_property_read_bool (node,"boost_mode" )) + exynos_boost.max_boost_freq = +cpufreq_frequency_table_boost_max ( + exynos_info->freq_table); +else + exynos_driver.boost =NULL ; + } + locking_frequency =exynos_getspeed (0 );register_pm_notifier (&exynos_cpufreq_nb);
Signature · 1 line
1.7.10.4
PATCH 5/5 cpufreq:boost:Kconfig: Enable boost support at Kconfig
In reply to Lukasz MajewskiEnable/disable support for BOOST. New flag - CPU_FREQ_BOOST has been defined for that.
--- drivers/cpufreq/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/Kconfig +7 -0
@@ -23,6 +23,13 @@ config CPU_FREQ_TABLE config CPU_FREQ_GOV_COMMON bool +config CPU_FREQ_BOOST + bool "CPU frequency boost support" + help + Switch to enable support for frequency boost + + If in doubt, say N. + config CPU_FREQ_STAT tristate "CPU frequency translation statistics" select CPU_FREQ_TABLE
Signature · 1 line
1.7.10.4
Re: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
drivers/cpufreq/Kconfig config CPU_FREQ_TABLE · line 32
Quoted 7 lines · Lukasz Majewski
drivers/cpufreq/Kconfig +7
-0+config CPU_FREQ_BOOST + bool "CPU frequency boost support" + help + Switch to enable support for frequency boost + + If in doubt, say N. +
This help text is devoid of any useful information.
On what platforms ? What's the upside/downside ? Why is it an option ?
Dave
Re: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
Hi Dave,
Quoted 12 lines · Lukasz Majewski
drivers/cpufreq/Kconfig config CPU_FREQ_TABLE · line 32
Quoted 8 lines
drivers/cpufreq/Kconfig +7
-0+config CPU_FREQ_BOOST + bool "CPU frequency boost support" + help + Switch to enable support for frequency boost + + If in doubt, say N. +This help text is devoid of any useful information.
Quoted 1 line
On what platforms ? What's the upside/downside ? Why is it an option ?
I shall be more verbose here.
The boost option is supposed to provide one solution to control software based (like is is done with Samsung Exynos4 SoC) and hardware based (like Intel's Turbo Boost feature) boost.
Support for Intel's boost is already in mainline. Therefore I aimed to extend cpufreq to also manage software based solutions (e.g. Exynos).
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
Quoted 16 lines · Lukasz Majewski
Hi Dave,
Quoted 12 lines · Lukasz Majewski
drivers/cpufreq/Kconfig config CPU_FREQ_TABLE · line 32
Quoted 8 lines
drivers/cpufreq/Kconfig +7
-0+config CPU_FREQ_BOOST + bool "CPU frequency boost support" + help + Switch to enable support for frequency boost + + If in doubt, say N. +This help text is devoid of any useful information.
Quoted 1 line
On what platforms ? What's the upside/downside ? Why is it an option ?
Quoted 8 lines
I shall be more verbose here.
The boost option is supposed to provide one solution to control software based (like is is done with Samsung Exynos4 SoC) and hardware based (like Intel's Turbo Boost feature) boost.
Support for Intel's boost is already in mainline. Therefore I aimed to extend cpufreq to also manage software based solutions (e.g. Exynos).
Given CPUFREQ is available on more platforms than X86/ARM, this option could also use a depends.
Dave
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
Quoted 2 lines · Dave Jones
Given CPUFREQ is available on more platforms than X86/ARM, this option could also use a depends.
It should be disabled by default, so please add default n. But we don't need a depends here as everybody is open to use it. Its a core feature.
Re: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
In reply to Lukasz MajewskiQuoted 2 lines · Lukasz Majewski
Enable/disable support for BOOST. New flag -
CPU_FREQ_BOOSThas been defined for that.
What's the reason for this? Why would you want to not compile-in the boosting code?
Also, at least on x86, even with this feature disabled, the CPU will boost by default unless you fiddle with it through the MSRs as root.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
Hi,
Quoted 6 lines · Lukasz Majewski
Quoted 2 lines
Enable/disable support for BOOST. New flag -
CPU_FREQ_BOOSThas been defined for that.What's the reason for this? Why would you want to not compile-in the boosting code?
I think that this flag could be removed and the "boost" could be compiled-in permanently.
Viresh, what is your opinion?
Quoted 4 lines
Also, at least on x86, even with this feature disabled, the CPU will boost by default unless you fiddle with it through the MSRs as root.
So this is a good argument for removing this flag from Kconfig.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
Quoted 6 lines · Lukasz Majewski
Hi,
Quoted 4 lines · Lukasz Majewski
Quoted 2 lines
Enable/disable support for BOOST. New flag -
CPU_FREQ_BOOSThas been defined for that.
Quoted 7 lines
Quoted 2 lines
What's the reason for this? Why would you want to not compile-in the boosting code?
I think that this flag could be removed and the "boost" could be compiled-in permanently.
Viresh, what is your opinion?
Yes, Borislav is correct. I haven't actually reviewed these last patches as I saw lots of issues with first one :)
Re: [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
Hi Viresh,
Quoted 10 lines · Lukasz Majewski
Quoted 9 lines
Hi,
Quoted 6 lines · Lukasz Majewski
Quoted 2 lines
Enable/disable support for BOOST. New flag -
CPU_FREQ_BOOSThas been defined for that.What's the reason for this? Why would you want to not compile-in the boosting code?
Quoted 7 lines
Quoted 4 lines
I think that this flag could be removed and the "boost" could be compiled-in permanently.
Viresh, what is your opinion?
Yes, Borislav is correct. I haven't actually reviewed these last patches as I saw lots of issues with first one :)
Ok, thanks :-)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
v2 cover cpufreq:boost: CPU Boost mode support
In reply to Lukasz MajewskiThis patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos).
For this reason cpufreq/freq_table code has been reorganized to include common code.
Important design decisions:
- Boost related code is compiled-in unconditionally and disabled by default The cpufreq_driver is responsibile for providing low_level_boost callback
- struct cpufreq_driver has been extended with boost related fields
- Boost sysfs attributies are seen only when cpufreq driver supports them. They will not show up until either cpufreq_driver defines low_level_boost callback or device tree's cpufreq "boost_mode" attribute is defined.
- No special spin_lock for Boost was created. The one from cpufreq_driver was reused.
- Low level boost trigger function (*low_level_boost function callback) is necessary to "glue" together acpi-cpufreq boost with software based one.
Tested at: HW:
Exynos 4412 3.10 linux Exynos 4210 3.10 linux
Compile tested x86_64 defconfig (acpi) - help with HW (Intel Nehalem) test
needed
Two patches were abandoned (comparing to v1):
[PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes [PATCH 5/5] cpufreq:boost:Kconfig: Enable boost support at Kconfig
For detailed changelog please look into relevant patches
Lukasz Majewski (3):
cpufreq:boost: CPU frequency boost code unification for software and
hardware solutions
cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common
boost solution
cpufreq:exynos:Extend Exynos cpufreq driver to support boost
framework
drivers/cpufreq/acpi-cpufreq.c | 72 ++++++++++++++------------------------ drivers/cpufreq/cpufreq.c | 69 ++++++++++++++++++++++++++++++++++++ drivers/cpufreq/exynos-cpufreq.c | 49 ++++++++++++++++++++++++-- drivers/cpufreq/freq_table.c | 57 ++++++++++++++++++++++++++++-- include/linux/cpufreq.h | 12 +++++++ 5 files changed, 209 insertions(+), 50 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v2 1/3 cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
This commit adds support for software based frequency boosting. Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal condition limits. Such a change shall be only done for a short time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
By default boost is disabled. One global attribute is available at:/sys/devices/system/cpu/cpufreq/boost.
It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.
---
Changes for v2:
- Removal of cpufreq_boost structure and move its fields to cpufreq_driver structure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names
--- drivers/cpufreq/cpufreq.c | 69 ++++++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 57 ++++++++++++++++++++++++++++++++-- include/linux/cpufreq.h | 12 ++++++++ 3 files changed, 136 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +69 -0
@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool cpufreq_boost_sysfs_defined; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */
@@ -315,6 +316,33 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost_status (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , cpufreq_driver->boost_en); +} + +static ssize_t store_boost_status (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count) +{ +int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot %sable boost!\n" , __func__, + enable ?"en" :"dis" ); +return -EINVAL ; + } + +return count; +} + +static struct global_attr global_boost =__ATTR (boost,0644 , + show_boost_status, + store_boost_status);static struct cpufreq_governor *__find_governor (const char *str_governor) {
@@ -754,6 +782,17 @@ static int cpufreq_add_dev_interface(unsigned int cpu, goto err_out_kobj_put; drv_attr++; } +if (cpufreq_driver->low_level_boost && !cpufreq_boost_sysfs_defined) { + ret =sysfs_create_file (cpufreq_global_kobject, + &(global_boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n" , + __func__); + goto err_out_kobj_put; + } + cpufreq_boost_sysfs_defined =1 ; + } +if (cpufreq_driver->get) { ret =sysfs_create_file (&policy->kobj, &cpuinfo_cur_freq.attr);if (ret)
@@ -1853,6 +1892,30 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };/********************************************************************* +* BOOST * +*********************************************************************/ +int cpufreq_boost_trigger_state (int state) +{ +int ret =0 ; + +if (!cpufreq_driver->low_level_boost) +return -ENODEV ; + +if (cpufreq_driver->boost_en != state) { + ret = cpufreq_driver->low_level_boost (state); +if (ret) { +pr_err ("%s: BOOST cannot %sable low level code (%d)\n" , + __func__, state ?"en" :"dis" , ret); +return ret; + } + } + +pr_debug ("%s: cpufreq BOOST %sabled\n" , __func__, state ?"en" :"dis" ); + +return 0 ; +} + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/
@@ -1947,6 +2010,12 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); + +if (cpufreq_driver->low_level_boost && cpufreq_boost_sysfs_defined) { +sysfs_remove_file (cpufreq_global_kobject, &(global_boost.attr)); + cpufreq_boost_sysfs_defined =0 ; + } +unregister_hotcpu_notifier (&cpufreq_cpu_notifier);write_lock_irqsave (&cpufreq_driver_lock, flags);
drivers/cpufreq/freq_table.c +55 -2
90 lines not on this page · raw message
include/linux/cpufreq.h +12 -0
@@ -262,6 +262,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_en; +int (*low_level_boost) (int state); };/* flags */
@@ -403,6 +407,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative;#define CPUFREQ_ENTRY_INVALID ~0#define CPUFREQ_TABLE_END ~1 +/* Define index for boost frequency */ +#define CPUFREQ_BOOST_FREQ ~2 +struct cpufreq_frequency_table {unsigned int index;/* any */ unsigned int frequency;/* kHz - doesn't need to be in ascending
@@ -421,11 +428,16 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,unsigned int relation, unsigned int *index); +unsigned int +cpufreq_frequency_table_max (struct cpufreq_frequency_table *freq_table,int ); +int cpufreq_boost_trigger_state (int state); +/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu);/* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; +extern struct freq_attr cpufreq_freq_attr_boost_available_freqs;void cpufreq_frequency_table_get_attr (struct cpufreq_frequency_table *table,unsigned int cpu);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
Hi,
Change subject to: "cpufreq: Add boost frequency support in core"
Quoted 1 line · Lukasz Majewski
This commit adds support for software based frequency boosting.
No. It adds support for both software and hardware boosting. So just
write: This commit adds boost frequency support in cpufreq core (Hardware & Software).
Quoted 2 lines
Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal condition limits. Such a change shall be only done for a short
s/condition/operation
s/change/mode
s/done/used
Quoted 10 lines
time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
By default boost is disabled. One global attribute is available at:/sys/devices/system/cpu/cpufreq/boost.
Enter a blank line here.
Quoted 5 lines
It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (
CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.
Good.
Quoted 10 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>---
Changes for v2:
- Removal ofcpufreq_booststructure and move its fields tocpufreq_driverstructure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names
---
You don't have to manually add "---" here. Just keep a blank line instead.
Quoted 18 lines
drivers/cpufreq/cpufreq.c | 69 ++++++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 57 ++++++++++++++++++++++++++++++++-- include/linux/cpufreq.h | 12 ++++++++ 3 files changed, 136 insertions(+), 2 deletions(-)drivers/cpufreq/cpufreq.c +1
-0@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool cpufreq_boost_sysfs_defined; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 322
Quoted 7 lines
drivers/cpufreq/cpufreq.c +4
-0@@ -315,6 +316,33 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost_status (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , cpufreq_driver->boost_en);
This isn't correct. It shows if cpufreq driver supports boost or not and it should show if boost is enabled from sysfs when cpufreq driver supports boost.
Quoted 4 lines
drivers/cpufreq/cpufreq.c +4
-0+} + +static ssize_t store_boost_status (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count)
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 336
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+{ +int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot %sable boost!\n" , __func__, + enable ?"en" :"dis" );
%sable doesn't look very much readable. Use complete strings:
"enable" and "disable".
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 345
Quoted 9 lines
drivers/cpufreq/cpufreq.c +9
-0+return -EINVAL ; + } + +return count; +} + +static struct global_attr global_boost =__ATTR (boost,0644 , + show_boost_status, + store_boost_status);
User define_one_global_rw.
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu,
Quoted 3 lines
drivers/cpufreq/cpufreq.c +0
-0static struct cpufreq_governor *__find_governor (const char *str_governor) {@@ -754,6 +782,17 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
Why not do this in cpufreq_register_driver()?
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu, · line 785
Quoted 4 lines
drivers/cpufreq/cpufreq.c +1
-0goto err_out_kobj_put; drv_attr++; } +if (cpufreq_driver->low_level_boost && !cpufreq_boost_sysfs_defined) {
I thought low_level_boost() is a function which will only be supported for drivers
using hardware boost feature, like intel. And so we must have used boost_en here.
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu, · line 787
Quoted 2 lines
drivers/cpufreq/cpufreq.c +2
-0+ ret =sysfs_create_file (cpufreq_global_kobject, + &(global_boost.attr));
cpufreq_sysfs_create_file(), check 2361be23666232dbb4851a527f466c4cbf5340fc for details.
Quoted 13 lines
drivers/cpufreq/cpufreq.c +8
-0+if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n" , + __func__); + goto err_out_kobj_put; + } + cpufreq_boost_sysfs_defined =1 ; + } +if (cpufreq_driver->get) { ret =sysfs_create_file (&policy->kobj, &cpuinfo_cur_freq.attr);if (ret)@@ -1853,6 +1892,30 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1902
Quoted 10 lines
drivers/cpufreq/cpufreq.c +8
-0/********************************************************************* +* BOOST * +*********************************************************************/ +int cpufreq_boost_trigger_state (int state) +{ +int ret =0 ; + +if (!cpufreq_driver->low_level_boost) +return -ENODEV ;
I am certainly not aligned with your design. What's the use of this field? And please update documentation too for these new entries in cpufreq_driver structure.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1904
Quoted 1 line
drivers/cpufreq/cpufreq.c +1
-0+if (cpufreq_driver->boost_en != state) {
So, you are using boost_en to see if boost is enabled from sysfs? Then you have put it at wrong place.
I thought there would be three variables:
- cpufreq_driver->boost_supported: boost is enabled for driver
- cpufreq_driver->low_level_boost(): to set desired boost state (Only for hardware boosting)
- boost_enabled: global variable in cpufreq.c file, used only if cpufreq_driver->boost_supported is true.
Quoted 8 lines
drivers/cpufreq/freq_table.c +0
-0@@ -20,6 +20,27 @@* FREQUENCY TABLE HELPERS * *********************************************************************/
drivers/cpufreq/freq_table.c line 32
Quoted 10 lines
drivers/cpufreq/freq_table.c +10
-0+unsigned int +cpufreq_frequency_table_max (struct cpufreq_frequency_table *freq_table, +int boost) +{ +int i =0 , boost_freq_max =0 , freq_max =0 ; + +for (; freq_table[i].frequency !=CPUFREQ_TABLE_END ; i++) { +if (freq_table[i].index ==CPUFREQ_BOOST_FREQ ) { +if (freq_table[i].frequency > boost_freq_max) + boost_freq_max = freq_table[i].frequency;
Do above only when boost==true and below when boost==false.
Quoted 25 lines
drivers/cpufreq/freq_table.c +13
-1+ }else { +if (freq_table[i].frequency > freq_max) + freq_max = freq_table[i].frequency; + } + } + +return boost ? boost_freq_max : freq_max; + +} +EXPORT_SYMBOL_GPL (cpufreq_frequency_table_max); +int cpufreq_frequency_table_cpuinfo (struct cpufreq_policy *policy,struct cpufreq_frequency_table *table) {@@ -171,7 +192,8 @@ static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table);/** * show_available_freqs - show available frequencies for the specified CPU */ -static ssize_t show_available_freqs (struct cpufreq_policy *policy,char *buf) +static ssize_t show_available_freqs (struct cpufreq_policy *policy,char *buf, +int show_boost) {unsigned int i =0 ;unsigned int cpu = policy->cpu;
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 214
Quoted 7 lines
drivers/cpufreq/freq_table.c +4
-0@@ -186,22 +208,53 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf)for (i =0 ; (table[i].frequency !=CPUFREQ_TABLE_END ); i++) {if (table[i].frequency ==CPUFREQ_ENTRY_INVALID )continue ; +if (show_boost) +if (table[i].index !=CPUFREQ_BOOST_FREQ ) +continue ; +
Looks wrong. You will show boost freqs when show_boost is false.
Quoted 34 lines
drivers/cpufreq/freq_table.c +18
-1count +=sprintf (&buf[count],"%d " , table[i].frequency); } count +=sprintf (&buf[count],"\n" );return count; +} +/** +* show_available_normal_freqs - show normal boost frequencies for +* the specified CPU +*/ +static ssize_t show_available_normal_freqs (struct cpufreq_policy *policy, +char *buf) +{ +return show_available_freqs (policy, buf,0 ); }struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { .attr = { .name ="scaling_available_frequencies" , .mode =0444 , }, - .show = show_available_freqs, + .show = show_available_normal_freqs, };EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_available_freqs); +/** +* show_available_boost_freqs - show available boost frequencies for +* the specified CPU +*/ +static ssize_t show_available_boost_freqs (struct cpufreq_policy *policy, +char *buf) +{ +return show_available_freqs (policy, buf,1 );
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 257
Quoted 10 lines
drivers/cpufreq/freq_table.c +10
-0+} + +struct freq_attr cpufreq_freq_attr_boost_available_freqs = { + .attr = { .name ="scaling_boost_frequencies" , + .mode =0444 , + }, + .show = show_available_boost_freqs, +}; +EXPORT_SYMBOL_GPL (cpufreq_freq_attr_boost_available_freqs); +
Code redundancy can be reduced by creating a macro for declaring **_availabe_freqs, its attributes and export symbol.
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 260
Quoted 3 lines
drivers/cpufreq/freq_table.c +0
-0/* * if you use these, you must assure that the frequency table is valid * all the time between get_attr and put_attr!
With this patch alone, we would be using boost frequencies even in normal cases where we haven't enabled boost.
Re: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
Hi Viresh,
Quoted 3 lines
Hi,
Change subject to: "cpufreq: Add boost frequency support in core"
Ok.
Quoted 7 lines · Lukasz Majewski
Quoted 1 line
This commit adds support for software based frequency boosting.
No. It adds support for both software and hardware boosting. So just
write: This commit adds boost frequency support in cpufreq core (Hardware & Software).
Ok.
Quoted 9 lines
Quoted 4 lines
Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal condition limits. Such a change shall be only done for a short
s/condition/operation
s/change/mode
s/done/used
Ok.
Quoted 5 lines
Quoted 5 lines
time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
Quoted 7 lines
Quoted 5 lines
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
By default boost is disabled. One global attribute is available at:/sys/devices/system/cpu/cpufreq/boost.Enter a blank line here.
Ok
Quoted 13 lines
Quoted 6 lines
It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (
CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.Good.
Quoted 4 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>---
^^^^
[*] this --- was added manually by me.
Quoted 9 lines
Quoted 6 lines
Changes for v2:
- Removal ofcpufreq_booststructure and move its fields tocpufreq_driverstructure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names ---You don't have to manually add "---" here. Just keep a blank line instead.
One "---" is added by git automatically. The [*] was added to distinct the changelog from rest of the commit. At least older versions of GIT required this to not include changelog to commit messages.
Quoted 24 lines
Quoted 24 lines
drivers/cpufreq/cpufreq.c | 69++++++++++++++++++++++++++++++++++++++++++
drivers/cpufreq/freq_table.c| 57
++++++++++++++++++++++++++++++++--include/linux/cpufreq.h|
12 ++++++++ 3 files changed, 136 insertions(+), 2 deletions(-)drivers/cpufreq/cpufreq.c +1
-0@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool cpufreq_boost_sysfs_defined; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */ @@ -315,6 +316,33 @@
EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /*********************************************************************
* SYSFS
INTERFACE *
*********************************************************************/
Quoted 8 lines
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 322
Quoted 4 lines
drivers/cpufreq/cpufreq.c +4
-0+ssize_t show_boost_status (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , cpufreq_driver->boost_en);This isn't correct. It shows if cpufreq driver supports boost or not and it should show if boost is enabled from sysfs when cpufreq driver supports boost.
The cpufreq_driver->low_level_boost() is only valid when cpufreq driver supports boost. Otherwise it is NULL. Thereof you will not see those attributes exported to /sysfs until cpufreq driver supports boost.
When "boost" attribute is exported - then it returns state of boosting (if it is enabled or not).
Quoted 11 lines
Quoted 11 lines
drivers/cpufreq/cpufreq.c +3
-0+} + +static ssize_t store_boost_status(struct kobject *kobj, structattribute *attr,
drivers/cpufreq/cpufreq.c +6
-0+ const char *buf, size_t count) +{ + int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 )
Quoted 8 lines
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 336
Quoted 5 lines
drivers/cpufreq/cpufreq.c +5
-0+return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot %sable boost!\n" , __func__, + enable ?"en" :"dis" );%sable doesn't look very much readable. Use complete strings:
"enable" and "disable".
Ok.
Quoted 12 lines
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 345
Quoted 10 lines
drivers/cpufreq/cpufreq.c +9
-0+return -EINVAL ; + } + +return count; +} + +static struct global_attr global_boost =__ATTR (boost,0644 , + show_boost_status, + store_boost_status);User
define_one_global_rw.
Ok, will reuse available macros (this code was taken directly from acpi-cpufreq.c file).
Quoted 7 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned · line 782
Quoted 5 lines
static struct
cpufreq_governor*__find_governor(const char*str_governor) {drivers/cpufreq/cpufreq.c +0
-0@@ -754,6 +782,17 @@ static int cpufreq_add_dev_interface(unsigned int cpu,Why not do this in
cpufreq_register_driver()?
Good point. I will move this code to cpufreq_register_driver.
Quoted 10 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu,
Quoted 6 lines
drivers/cpufreq/cpufreq.c +1
-0goto err_out_kobj_put; drv_attr++; } +if (cpufreq_driver->low_level_boost && !cpufreq_boost_sysfs_defined) {I thought
low_level_boost()is a function which will only be supported for drivers
using hardware boost feature, like intel.
I think that we shall give users some flexibility and don't assume that low_level_boost is only used for one solution/vendor.
It is also needed with software controlled boost. Please refer to patch 3/3.
Quoted 2 lines
And so we must have used
boost_enhere.
boost_en has two meanings:
0 - either boost disabled or not supported (when low_level_boost=NULL). 1 - boost is enabled.
Quoted 6 lines
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev_interface(unsigned int cpu, · line 787
Quoted 3 lines
drivers/cpufreq/cpufreq.c +2
-0+ ret =sysfs_create_file (cpufreq_global_kobject, + &(global_boost.attr));
cpufreq_sysfs_create_file(), check2361be23666232dbb4851a527f466c4cbf5340fcfor details.
Ok, I will rebase those changes to newestkernel/git/rafael/linux-pm.git ,branch
kernel_pm/pm-cpufreq
Quoted 16 lines
Quoted 16 lines
drivers/cpufreq/cpufreq.c +8
-0+if (ret) { + pr_err("%s: cannot register global boost sysfs file\n", + __func__); + goto err_out_kobj_put; + } + cpufreq_boost_sysfs_defined =1 ; + } +if (cpufreq_driver->get) { ret = sysfs_create_file(&policy->kobj,&cpuinfo_cur_freq.attr); if (ret)
drivers/cpufreq/cpufreq.c +0
-0@@ -1853,6 +1892,30 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };
Quoted 13 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1902
Quoted 10 lines
drivers/cpufreq/cpufreq.c +1
-0/********************************************************************* +* BOOST *
+ *********************************************************************/drivers/cpufreq/cpufreq.c +5
-0+int cpufreq_boost_trigger_state(int state) +{ +int ret =0 ; + +if (!cpufreq_driver->low_level_boost) +return -ENODEV ;I am certainly not aligned with your design. What's the use of this field?
I had to rewrite a bit :-) patches since we decided to drop struct cpufreq_boost.
I've added two fields to cpufreq_driver:
- low_level_boost:
* When boost is not supported (default) it is set to NULL. This field has two purposes: Indicates if boost is available on the system and provides address of low level callback
* When cpufreq driver assigns pointer to this field, it means that it is supported
- boost_en:
* It shows if boost is enabled or disabled/not supported to the rest of the system.
Quoted 2 lines
And please update documentation too for these
new entries incpufreq_driverstructure.
Ok I will extend it.
Quoted 5 lines
Quoted 2 lines
+ if (
cpufreq_driver->boost_en!= state) {So, you are using
boost_ento see if boost is enabled from sysfs? Then you have put it at wrong place.
I check if boost is already enabled.
Quoted 3 lines
I thought there would be three variables:
-cpufreq_driver->boost_supported: boost is enabled for driver
For this purpose I check the low_level_boost pointer if it's NULL or not.
Quoted 2 lines
-
cpufreq_driver->low_level_boost(): to set desired boost state (Only for hardware boosting)
It has two purposes (as described above) and can be used (defined) by software and hardware boost solutions.
Quoted 2 lines
-
boost_enabled: global variable incpufreq.cfile, used only ifcpufreq_driver->boost_supportedis true.
I think that boost enabled flag shall be defined at cpufreq driver (please look into acpi_cpufreq.c - which used another set of global flags).
It will then provide one flag for cpufreq.c (core) and drivers.
However I've added one global flag: cpufreq_boost_sysfs_defined which indicates if /sys/devices/system/cpu/cpufreq/boost attribute has been already defined (to prevent multiple definitions attempts).
Quoted 11 lines
Quoted 11 lines
(quoted diff) +0
-0
b/drivers/cpufreq/freq_table.cindex d7a7966..4e4f692 100644drivers/cpufreq/freq_table.c +0
-0@@ -20,6 +20,27 @@* FREQUENCY TABLE HELPERS *
*********************************************************************/
Quoted 15 lines
Quoted 10 lines
drivers/cpufreq/freq_table.c +2
-0+unsigned int +cpufreq_frequency_table_max(struct cpufreq_frequency_table
*freq_table,drivers/cpufreq/freq_table.c +7
-0+ int boost) +{ +int i =0 , boost_freq_max =0 , freq_max =0 ; + +for (; freq_table[i].frequency !=CPUFREQ_TABLE_END ; i++) { +if (freq_table[i].index ==CPUFREQ_BOOST_FREQ ) { + if (freq_table[i].frequency >Quoted 3 lines
boost_freq_max)
+boost_freq_max=
freq_table[i].frequency;Do above only when boost==true and below when boost==false.
Ok.
Quoted 28 lines
Quoted 28 lines
drivers/cpufreq/freq_table.c +11
-0+ }else { +if (freq_table[i].frequency > freq_max) + freq_max = freq_table[i].frequency; + } + } + +return boost ? boost_freq_max : freq_max; + +} +EXPORT_SYMBOL_GPL (cpufreq_frequency_table_max); +int cpufreq_frequency_table_cpuinfo (struct cpufreq_policy *policy, struct cpufreq_frequency_table*table) {
drivers/cpufreq/freq_table.c +0
-0@@ -171,7 +192,8 @@ static DEFINE_PER_CPU(struct
cpufreq_frequency_table*,cpufreq_show_table); /**
*show_available_freqs- show available frequencies for the
specified CPU */
-staticssize_tshow_available_freqs(struct cpufreq_policy *policy, char *buf)+staticssize_tshow_available_freqs(structcpufreq_policy*policy, char *buf,drivers/cpufreq/freq_table.c +1
-0+ int show_boost) {unsigned int i =0 ;unsigned int cpu = policy->cpu;@@ -186,22 +208,53 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0;
Quoted 8 lines
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 214
Quoted 6 lines
(table[i].frequency !=
CPUFREQ_TABLE_END); i++) { if (table[i].frequency ==CPUFREQ_ENTRY_INVALID) continue;drivers/cpufreq/freq_table.c +4
-0+if (show_boost) +if (table[i].index !=CPUFREQ_BOOST_FREQ ) +continue ; +Looks wrong. You will show boost freqs when
show_boostis false.
My purpose here is to display frequencies only tagged with CPUFREQ_BOOST_FREQ and when show_boost is true.
When show_boost is false, the operation of the function is unchanged.
Quoted 43 lines
Quoted 43 lines
count += sprintf(&buf[count], "%d ", table[i].frequency); } count += sprintf(&buf[count], "\n"); return count;drivers/cpufreq/freq_table.c +6
-0+} +/** +* show_available_normal_freqs - show normal boost frequencies for +* the specified CPU +*/ +static ssize_t show_available_normal_freqs(struct cpufreq_policy*policy,
drivers/cpufreq/freq_table.c +6
-1+ char *buf) +{ +return show_available_freqs (policy, buf,0 ); }struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { .attr = { .name ="scaling_available_frequencies" , .mode =0444 , }, - .show = show_available_freqs, + .show = show_available_normal_freqs, };EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_available_freqs); +/** +* show_available_boost_freqs - show available boost frequencies for
+ * the specified CPU
+ */
+staticssize_tshow_available_boost_freqs(structcpufreq_policy*policy,drivers/cpufreq/freq_table.c +8
-0+ char *buf) +{ +return show_available_freqs (policy, buf,1 ); +} + +struct freq_attr cpufreq_freq_attr_boost_available_freqs = { + .attr = { .name ="scaling_boost_frequencies" , + .mode =0444 ,
Quoted 8 lines
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 257
Quoted 5 lines
drivers/cpufreq/freq_table.c +5
-0+ }, + .show = show_available_boost_freqs, +}; +EXPORT_SYMBOL_GPL (cpufreq_freq_attr_boost_available_freqs); +Code redundancy can be reduced by creating a macro for declaring **_availabe_freqs, its attributes and export symbol.
Yes, you are right here. Those two structures only differ with different names.
Quoted 8 lines
Quoted 5 lines
/*
* if you use these, you must assure that the frequency table is
valid
* all the time betweenget_attrandput_attr!With this patch alone, we would be using boost frequencies even in normal cases where we haven't enabled boost.
Correct me if I'm wrong here, but the cpufreq_freq_attr_boost_available_freqs will be added to cpufreq driver's freq_attr table (i.e. *exynos_cpufreq_attr[]).
It is cpufreq driver's responsibility to add this attribute. By default all other drivers add only cpufreq_freq_attr_boost_available_freqs.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
Quoted 1 line · Lukasz Majewski
Hi Viresh,
Hi Lukasz,
Quoted 1 line
Quoted 1 line
Hi,
Please don't remove the line which says, who wrote last mail at what time. These >, >>, >>>, >>>>, ... have a meaning. They help us understand who wrote what in bottom posting. And as you removed my line, nobody can see who wrote above "Hi" to you :)
Quoted 6 lines
Quoted 2 lines
You don't have to manually add "---" here. Just keep a blank line instead.
One "---" is added by git automatically. The [*] was added to distinct the changelog from rest of the commit. At least older versions of GIT required this to not include changelog to commit messages.
You don't have to add an extra "---" line. Just write your changelog after "---" added by git and give a blank line between your last changelog line and below ones (probably just to make it more readable and not a must, but i am not sure).
Quoted 11 lines
Quoted 5 lines
Quoted 5 lines
drivers/cpufreq/cpufreq.c | 69++++++++++++++++++++++++++++++++++++++++++
drivers/cpufreq/freq_table.c| 57
++++++++++++++++++++++++++++++++--include/linux/cpufreq.h|
12 ++++++++ 3 files changed, 136 insertions(+), 2 deletions(-)I think that we shall give users some flexibility and don't assume that
low_level_boostis only used for one solution/vendor.It is also needed with software controlled boost. Please refer to patch 3/3.
You didn't get me. I am not asking to keep it only for Intel. But keep this variable as is (s/low_level_boost/set_boost_freq), and make it optional. So, few drivers can implement it but not everybody is required to.
So, Add another variable: boost_supported, which will tell cpufreq core that boost is supported by governor or not.
And a global variable in cpufreq.c boost_enabled to track status of what user has requested.
Quoted 3 lines
However I've added one global flag:
cpufreq_boost_sysfs_definedwhich indicates if/sys/devices/system/cpu/cpufreq/boostattribute has been already defined (to prevent multiple definitions attempts).
You don't need this variable anymore as sysfs create file is now moved to cpufreq_register_driver(), so this can't be called twice.
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
char *buf) +static
ssize_tshow_available_freqs(structcpufreq_policy*policy, char *buf,drivers/cpufreq/freq_table.c +1
-0+ int show_boost) {unsigned int i =0 ;unsigned int cpu = policy->cpu;@@ -186,22 +208,53 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0;Quoted 8 lines
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 214
Quoted 6 lines
(table[i].frequency !=
CPUFREQ_TABLE_END); i++) { if (table[i].frequency ==CPUFREQ_ENTRY_INVALID) continue;drivers/cpufreq/freq_table.c +4
-0+if (show_boost) +if (table[i].index !=CPUFREQ_BOOST_FREQ ) +continue ; +Looks wrong. You will show boost freqs when
show_boostis false.
Quoted 4 lines
My purpose here is to display frequencies only tagged with
CPUFREQ_BOOST_FREQand whenshow_boostis true.When
show_boostis false, the operation of the function is unchanged.
Which is wrong. When show_boost is false, it means that user don't want to see boost frequencies and so you should skip them.
Quoted 8 lines
Quoted 2 lines
With this patch alone, we would be using boost frequencies even in normal cases where we haven't enabled boost.
Correct me if I'm wrong here, but the
cpufreq_freq_attr_boost_available_freqswill be added to cpufreq driver'sfreq_attrtable (i.e. *exynos_cpufreq_attr[]).
It is cpufreq driver's responsibility to add this attribute. By default all other drivers add onlycpufreq_freq_attr_boost_available_freqs.
You are just talking about showing boost freqs in sysfs. I am talking about the frequencies that governors will select when boost is disabled from sysfs. Because we don't skip boost frequencies in target() routines, we will set them as and when governor requests them.
Re: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
On Wed, 12 Jun 2013 13:39:18 +0530, Viresh Kumar wrote:
Hi Viresh,
Quoted 11 lines · Lukasz Majewski
Quoted 1 line
Hi Viresh,
Hi Lukasz,
Quoted 1 line
Quoted 1 line
Hi,
Please don't remove the line which says, who wrote last mail at what time. These >, >>, >>>, >>>>, ... have a meaning. They help us understand who wrote what in bottom posting. And as you removed my line, nobody can see who wrote above "Hi" to you :)
Ok, mailer adjusted.
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
You don't have to manually add "---" here. Just keep a blank line instead.
One "---" is added by git automatically. The [*] was added to distinct the changelog from rest of the commit. At least older versions of GIT required this to not include changelog to commit messages.
Quoted 4 lines
You don't have to add an extra "---" line. Just write your changelog after "---" added by git and give a blank line between your last changelog line and below ones (probably just to make it more readable and not a must, but i am not sure).
I got your point. If you prefer, I will stick to it. No problem.
As a side note:
In the other open source project (u-boot) we use the pattern which I've used previously. It has one big advantage - I can edit change log at git gui (just below sign-of-by). It is simply more convenient for me :-). Those changes between "---" are simply skipped by git am afterwards.
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
drivers/cpufreq/cpufreq.c | 69++++++++++++++++++++++++++++++++++++++++++
drivers/cpufreq/freq_table.c| 57
++++++++++++++++++++++++++++++++--include/linux/cpufreq.h|
12 ++++++++ 3 files changed, 136 insertions(+), 2 deletions(-)I think that we shall give users some flexibility and don't assume that
low_level_boostis only used for one solution/vendor.
Quoted 7 lines
Quoted 2 lines
It is also needed with software controlled boost. Please refer to patch 3/3.
You didn't get me. I am not asking to keep it only for Intel. But keep this variable as is (s/low_level_boost/set_boost_freq), and make it optional. So, few drivers can implement it but not everybody is required to.
The low_level_boost (set_boost_freq)[*] is optional. However it seems to me, that the burden of changing available set of frequencies (when boost is enabled) must be put to cpufreq driver anyway.
Without this function [*] defined, we cannot enable frequency boosting.
Quoted 3 lines
So, Add another variable:
boost_supported, which will tell cpufreq core that boost is supported by governor or not.
^^^^^^^shouldn't it be cpufreq driver?
Ok, boost_supported seems needed. In my opinion it shall be defined at cpufreq_driver structure (since it provides boosting infrastructure anyway).
Quoted 3 lines
And a global variable in
cpufreq.cboost_enabledto track status of what user has requested.
I think, that boost_enable shall be also defined at cpufreq driver (as proposed in the patch). We keep pointer to cpufreq driver at cpufreq.c anyway. Moreover, boost_enable flag is already defined at acpi-cpufreq.c (as static). We will have two flags for the same purpose.
Quoted 7 lines
Quoted 4 lines
However I've added one global flag:
cpufreq_boost_sysfs_definedwhich indicates if/sys/devices/system/cpu/cpufreq/boostattribute has been already defined (to prevent multiple definitions attempts).You don't need this variable anymore as sysfs create file is now moved to
cpufreq_register_driver(), so this can't be called twice.
Yes, in this situation the cpufreq_boost_sysfs_defined flag is redundant.
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 11 lines
char *buf) +static
ssize_tshow_available_freqs(structcpufreq_policy*policy, char *buf,drivers/cpufreq/freq_table.c +1
-0+ int show_boost) {unsigned int i =0 ;unsigned int cpu = policy->cpu;@@ -186,22 +208,53 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0;(table[i].frequency !=
CPUFREQ_TABLE_END); i++) { if (table[i].frequency ==CPUFREQ_ENTRY_INVALID) continue;drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 214
Quoted 4 lines
drivers/cpufreq/freq_table.c +4
-0+if (show_boost) +if (table[i].index !=CPUFREQ_BOOST_FREQ ) +continue ; +Looks wrong. You will show boost freqs when
show_boostis false.
Quoted 8 lines
Quoted 5 lines
My purpose here is to display frequencies only tagged with
CPUFREQ_BOOST_FREQand whenshow_boostis true.When
show_boostis false, the operation of the function is unchanged.Which is wrong. When
show_boostis false, it means that user don't want to see boost frequencies and so you should skip them.
So we want as follows:show_boost = 1 ---> show only frequencies tagged as CPUFREQ_BOOST_FREQ show_boost = 0 ---> show only "normal" (non boost) frequencies
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
With this patch alone, we would be using boost frequencies even in normal cases where we haven't enabled boost.
Correct me if I'm wrong here, but the
cpufreq_freq_attr_boost_available_freqswill be added to cpufreq driver'sfreq_attrtable (i.e. *exynos_cpufreq_attr[]). It is cpufreq driver's responsibility to add this attribute. By default all other drivers add onlycpufreq_freq_attr_boost_available_freqs.
Quoted 5 lines
You are just talking about showing boost freqs in sysfs. I am talking about the frequencies that governors will select when boost is disabled from sysfs. Because we don't skip boost frequencies in
target()routines, we will set them as and when governor requests them.
I think, that it is the main issue here and it shall be cleared out:
Frequencies marked as: CPUFREQ_BOOST_FREQ are added permanently to the freq_table.
That is the distinction to the original overclocking patch posted with LAB, where freq_boost structure was modified and boost frequencies were either valid or invalid.
Then we can in SW control boost in two ways:
1. change policy->max value (to the maximal boost frequency) - as it is done now (v3) at Exynos. This is the simple solution (patch 3/3)
2. Modify all freq_table helper functions to be aware of boost and skip boost frequencies when boost_enable = 0. (as it was done at v2). This requires code modification at freq_table.c and reevaluation of policy.
Maybe you have any other idea?
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
Quoted 9 lines · Lukasz Majewski
Quoted 6 lines · Viresh Kumar
On 12 June 2013 13:09, Lukasz Majewski <[email protected]> wrote:
You don't have to add an extra "---" line. Just write your changelog after "---" added by git and give a blank line between your last changelog line and below ones (probably just to make it more readable and not a must, but i am not sure).
I got your point. If you prefer, I will stick to it. No problem.
Its not how I prefer it, but how everybody does it :)
Quoted 7 lines
As a side note:
In the other open source project (u-boot) we use the pattern which I've used previously. It has one big advantage - I can edit change log at git gui (just below sign-of-by). It is simply more convenient for me :-). Those changes between "---" are simply skipped by git am afterwards.
Yes, I am still asking you to follow the same steps:
git send-email --annotate ***patches***
and then write whatever you don't want to be logged by git am after the "---" already present in the patch.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines
Quoted 5 lines
drivers/cpufreq/cpufreq.c | 69++++++++++++++++++++++++++++++++++++++++++
drivers/cpufreq/freq_table.c| 57
++++++++++++++++++++++++++++++++--include/linux/cpufreq.h|
12 ++++++++ 3 files changed, 136 insertions(+), 2 deletions(-)I think that we shall give users some flexibility and don't assume that
low_level_boostis only used for one solution/vendor.It is also needed with software controlled boost. Please refer to patch 3/3.
Quoted 8 lines
Quoted 4 lines
You didn't get me. I am not asking to keep it only for Intel. But keep this variable as is (s/low_level_boost/set_boost_freq), and make it optional. So, few drivers can implement it but not everybody is required to.
The
low_level_boost(set_boost_freq)[*] is optional. However it seems to me, that the burden of changing available set of frequencies (when boost is enabled) must be put to cpufreq driver anyway.
Driver shouldn't play with boost freqs at runtime. This has to be handled by cpufreq core. The only thing cpufreq driver must be doing in low_level_boost or set_boost_freq (as what I suggested it to be), is to set the boost frequency requested by core. And so this routine would only be defined by drivers that have a special way of setting boost frequencies. For others ->target() routine should be able to set all freqs, boost or non boost.
Quoted 1 line
Without this function [*] defined, we cannot enable frequency boosting.
why?
Quoted 3 lines
Quoted 2 lines
So, Add another variable:
boost_supported, which will tell cpufreq core that boost is supported by governor or not.^^^^^^^shouldn't it be cpufreq driver?
Yeah, sorry :(
Quoted 3 lines
Ok,
boost_supportedseems needed. In my opinion it shall be defined atcpufreq_driverstructure (since it provides boosting infrastructure anyway).
that's what I asked.
Quoted 5 lines
Quoted 2 lines
And a global variable in
cpufreq.cboost_enabledto track status of what user has requested.I think, that
boost_enableshall be also defined at cpufreq driver (as proposed in the patch).
Not really. Driver should only care about if it supports boost or not. If it is enabled/disabled by sysfs or not should be kept inside core in a global variable.
Moreover, if we have 5-6 cpufreq drivers compiled in (for multi-arch compiled kernels), we will save memory wasted by this variable if it is present in cpufreq_driver.
Quoted 3 lines
Moreover,
boost_enableflag is already defined atacpi-cpufreq.c(as static). We will have two flags for the same purpose.
No, we don't have to. Just expose another API from cpufreq core to get status of boost.
Quoted 3 lines
So we want as follows:
show_boost= 1 ---> show only frequencies tagged asCPUFREQ_BOOST_FREQshow_boost= 0 ---> show only "normal" (non boost) frequencies
Yes.
Quoted 6 lines
Quoted 5 lines
You are just talking about showing boost freqs in sysfs. I am talking about the frequencies that governors will select when boost is disabled from sysfs. Because we don't skip boost frequencies in
target()routines, we will set them as and when governor requests them.
Quoted 7 lines
I think, that it is the main issue here and it shall be cleared out:
Frequencies marked as:
CPUFREQ_BOOST_FREQare added permanently to thefreq_table.
That is the distinction to the original overclocking patch posted withQuoted 1 line
LAB, where
freq_booststructure was modified and boost frequencies wereeither valid or invalid.
Yes.
Quoted 3 lines
Then we can in SW control boost in two ways:
1. changepolicy->maxvalue (to the maximal boost frequency) - as it is done now (v3) at Exynos. This is the simple solution (patch 3/3)
Drivers aren't supposed to set policy->max. It should be taken care of by core or freq_table.c file.
Quoted 4 lines
2. Modify all
freq_tablehelper functions to be aware of boost and skip boost frequencies whenboost_enable= 0. (as it was done at v2). This requires code modification atfreq_table.cand reevaluation of policy.
Yes, the core must be aware of it and must take the right decision here. So, we need to take care of boost freq in freq_table.c
Re: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
Quoted 5 lines · Viresh Kumar
Quoted 3 lines · Lukasz Majewski
Quoted 2 lines · Viresh Kumar
On 12 June 2013 13:09, Lukasz Majewski <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
You don't have to add an extra "---" line. Just write your changelog after "---" added by git and give a blank line between your last changelog line and below ones (probably just to make it more readable and not a must, but i am not sure).
I got your point. If you prefer, I will stick to it. No problem.
Its not how I prefer it, but how everybody does it :)
Ok, :-)
Quoted 9 lines
Quoted 8 lines
As a side note:
In the other open source project (u-boot) we use the pattern which I've used previously. It has one big advantage - I can edit change log at git gui (just below sign-of-by). It is simply more convenient for me :-). Those changes between "---" are simply skipped by git am afterwards.
Quoted 6 lines
Yes, I am still asking you to follow the same steps:
git send-email --annotate ***patches***
and then write whatever you don't want to be logged by git am after the "---" already present in the patch.
Ok,
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
drivers/cpufreq/cpufreq.c | 69++++++++++++++++++++++++++++++++++++++++++
drivers/cpufreq/freq_table.c| 57
++++++++++++++++++++++++++++++++--include/linux/cpufreq.h| 12 ++++++++ 3 files changed,
136 insertions(+), 2 deletions(-)Quoted 5 lines
I think that we shall give users some flexibility and don't assume that
low_level_boostis only used for one solution/vendor.It is also needed with software controlled boost. Please refer to patch 3/3.
You didn't get me. I am not asking to keep it only for Intel. But keep this variable as is (s/low_level_boost/set_boost_freq), and make it optional. So, few drivers can implement it but not everybody is required to.
Quoted 8 lines
Quoted 4 lines
The
low_level_boost(set_boost_freq)[*] is optional. However it seems to me, that the burden of changing available set of frequencies (when boost is enabled) must be put to cpufreq driver anyway.Driver shouldn't play with boost freqs at runtime. This has to be handled by cpufreq core. The only thing cpufreq driver must be doing in
low_level_boostorset_boost_freq(as what I suggested it to be),
So you want the set_boost_freq to not be used with software based boosting. Ok.
Quoted 9 lines
is to set the boost frequency requested by core. And so this routine would only be defined by drivers that have a special way of setting boost frequencies. For others ->target() routine should be able to set all freqs, boost or non boost.
Quoted 2 lines
Without this function [*] defined, we cannot enable frequency boosting.
why?
Hmm, please read my further comment.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
So, Add another variable:
boost_supported, which will tell cpufreq core that boost is supported by governor or not.^^^^^^^shouldn't it be cpufreqdriver?
Yeah, sorry :(
Ok.
Quoted 6 lines
Quoted 4 lines
Ok,
boost_supportedseems needed. In my opinion it shall be defined atcpufreq_driverstructure (since it provides boosting infrastructure anyway).that's what I asked.
Ok :-) .
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
And a global variable in
cpufreq.cboost_enabledto track status of what user has requested.I think, that
boost_enableshall be also defined at cpufreq driver (as proposed in the patch).Not really. Driver should only care about if it supports boost or not. If it is enabled/disabled by sysfs or not should be kept inside core in a global variable.
Ok,
Quoted 4 lines
Moreover, if we have 5-6 cpufreq drivers compiled in (for multi-arch compiled kernels), we will save memory wasted by this variable if it is present in
cpufreq_driver.
Ok. I didn't thought about this use case. Agree.
Quoted 7 lines
Quoted 4 lines
Moreover,
boost_enableflag is already defined atacpi-cpufreq.c(as static). We will have two flags for the same purpose.No, we don't have to. Just expose another API from cpufreq core to get status of boost.
Ok.
Quoted 7 lines
Quoted 5 lines
So we want as follows:
show_boost= 1 ---> show only frequencies tagged asCPUFREQ_BOOST_FREQshow_boost= 0 ---> show only "normal" (non boost) frequenciesYes.
Ok,
Quoted 19 lines
Quoted 9 lines
Quoted 6 lines
You are just talking about showing boost freqs in sysfs. I am talking about the frequencies that governors will select when boost is disabled from sysfs. Because we don't skip boost frequencies in
target()routines, we will set them as and when governor requests them.I think, that it is the main issue here and it shall be cleared out:
Quoted 7 lines
Frequencies marked as:
CPUFREQ_BOOST_FREQare added permanently to thefreq_table.
That is the distinction to the original overclocking patch posted withQuoted 2 lines
LAB, where
freq_booststructure was modified and boost frequencies wereeither valid or invalid.
Yes.
Quoted 7 lines
Quoted 4 lines
Then we can in SW control boost in two ways:
1. changepolicy->maxvalue (to the maximal boost frequency) - as it is done now (v3) at Exynos. This is the simple solution (patch 3/3)Drivers aren't supposed to set
policy->max. It should be taken care of by core orfreq_table.cfile.
This seems the right thing, but it would require some functions defined at freq_table.c to be extended to accept bool "boost" parameter (which would not consider freqs tagged as CPUFREQ_BOOST_FREQ).
Then each per cpu policy, shall be read and its max freq shall be updated when someone enables boost from sysfs (at cpufreq_boost_trigger_state).
This is my idea to manage boost mode from core code. Am I right?
Quoted 8 lines
Quoted 5 lines
2. Modify all
freq_tablehelper functions to be aware of boost and skip boost frequencies whenboost_enable= 0. (as it was done at v2). This requires code modification atfreq_table.cand reevaluation of policy.Yes, the core must be aware of it and must take the right decision here. So, we need to take care of boost freq in
freq_table.c
Ok. Then we agreed :-).
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
In reply to Lukasz MajewskiQuoted 67 lines · Lukasz Majewski
Hi Viresh,
Quoted 3 lines
Hi,
Change subject to: "cpufreq: Add boost frequency support in core"
Ok.
Quoted 7 lines · Lukasz Majewski
Quoted 1 line
This commit adds support for software based frequency boosting.
No. It adds support for both software and hardware boosting. So just
write: This commit adds boost frequency support in cpufreq core (Hardware & Software).Ok.
Quoted 9 lines
Quoted 4 lines
Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal condition limits. Such a change shall be only done for a short
s/condition/operation
s/change/mode
s/done/usedOk.
Quoted 5 lines
Quoted 5 lines
time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
Quoted 7 lines
Quoted 5 lines
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
By default boost is disabled. One global attribute is available at:/sys/devices/system/cpu/cpufreq/boost.Enter a blank line here.
Ok
Quoted 13 lines
Quoted 6 lines
It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (
CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.Good.
Quoted 4 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>---
^^^^[*] this --- was added manually by me.
Quoted 7 lines
Quoted 6 lines
Changes for v2:
- Removal ofcpufreq_booststructure and move its fields tocpufreq_driverstructure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names ---
Quoted 6 lines
Quoted 2 lines
You don't have to manually add "---" here. Just keep a blank line instead.
One "---" is added by git automatically. The [*] was added to distinct the changelog from rest of the commit. At least older versions of GIT required this to not include changelog to commit messages.
Which doesn't matter anyway. None of them will show up in git log, so don't worry. :-)
[...]
Quoted 7 lines
Quoted 3 lines
And so we must have used
boost_enhere.
boost_enhas two meanings:
0 - either boost disabled or not supported (when low_level_boost=NULL). 1 - boost is enabled.
Gosh, please don't do that. Use *two* flags, one meaning "supported" and the second meaning "enabled".
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH v2 1/3] cpufreq:boost: CPU frequency boost code unification for software and hardware solutions
On Wed, 12 Jun 2013 13:23:20 +0200, Rafael J. Wysocki wrote:
Hi Rafael,
Quoted 72 lines · Lukasz Majewski
Quoted 71 lines
Hi Viresh,
Quoted 3 lines
Hi,
Change subject to: "cpufreq: Add boost frequency support in core"
Ok.
Quoted 8 lines
Quoted 1 line · Lukasz Majewski
This commit adds support for software based frequency boosting.
No. It adds support for both software and hardware boosting. So just write: This commit adds boost frequency support in cpufreq core (Hardware & Software).
Ok.
Quoted 9 lines
Quoted 4 lines
Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal condition limits. Such a change shall be only done for a short
s/condition/operation
s/change/mode
s/done/usedOk.
Quoted 5 lines
Quoted 5 lines
time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
Quoted 7 lines
Quoted 5 lines
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
By default boost is disabled. One global attribute is available
at:/sys/devices/system/cpu/cpufreq/boost.Enter a blank line here.
Ok
Quoted 13 lines
Quoted 6 lines
It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (
CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.Good.
Quoted 4 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>---
^^^^[*] this --- was added manually by me.
Quoted 9 lines
Quoted 6 lines
Changes for v2:
- Removal ofcpufreq_booststructure and move its fields tocpufreq_driverstructure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names ---You don't have to manually add "---" here. Just keep a blank line instead.
Quoted 7 lines
Quoted 4 lines
One "---" is added by git automatically. The [*] was added to distinct the changelog from rest of the commit. At least older versions of GIT required this to not include changelog to commit messages.
Which doesn't matter anyway. None of them will show up in git log, so don't worry. :-)
:-)
Quoted 7 lines
[...]
Quoted 4 lines
Quoted 3 lines
And so we must have used
boost_enhere.
Quoted 6 lines
Quoted 3 lines
boost_enhas two meanings:
0 - either boost disabled or not supported (when
low_level_boost=NULL). 1 - boost is enabled.Gosh, please don't do that. Use *two* flags, one meaning "supported" and the second meaning "enabled".
That was already pointed out by Viresh. I will stick to his guidelines :-).
Quoted 5 lines
Thanks,
Rafael
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 2/3 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
In reply to Lukasz MajewskiThe Intel's hardware based boost solution driver has been changed to cooperate with common cpufreq boost framework.
The global sysfs boost attribute entry code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq code. This attribute is now only visible, when cpufreq driver supports it.
Global flags (boost_enabled and boost_supported) were replaced with boost_en flag and low_level_boost pointer presence at cpufreq driver structure.
The _store_boost() function has been redesigned to be used as low_level_boost callback.
---
Changes for v2:
- Replace boost_enabled and boost_supported global flags with proper entries at struct cpufreq_driver.
- Removal of struct cpufreq_boost
--- drivers/cpufreq/acpi-cpufreq.c | 72 +++++++++++++++------------------------- 1 file changed, 26 insertions(+), 46 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +26 -46
@@ -80,7 +80,6 @@ static struct acpi_processor_performance __percpu *acpi_perf_data;static struct cpufreq_driver acpi_cpufreq_driver;static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported;static struct msr __percpu *msrs;static bool boost_state (unsigned int cpu)
@@ -133,20 +132,11 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask)wrmsr_on_cpus (cpumask, msr_addr, msrs); } -static ssize_t _store_boost (const char *buf,size_t count) +static int _store_boost (int val) { -int ret; -unsigned long val =0 ; - -if (!boost_supported) -return -EINVAL ; - - ret =kstrtoul (buf,10 , &val); -if (ret || (val >1 )) -return -EINVAL ; - -if ((val && boost_enabled) || (!val && !boost_enabled)) -return count; +if ((val && acpi_cpufreq_driver.boost_en) || + (!val && !acpi_cpufreq_driver.boost_en)) +return 0 ;get_online_cpus ();
@@ -154,38 +144,39 @@ static ssize_t _store_boost(const char *buf, size_t count)put_online_cpus (); - boost_enabled = val; + acpi_cpufreq_driver.boost_en = val;pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" ); -return count; +return 0 ; } -static ssize_t store_global_boost (struct kobject *kobj,struct attribute *attr, -const char *buf,size_t count) +static ssize_t store_boost (const char *buf,size_t count) { -return _store_boost (buf, count); -} +int ret; +unsigned long val =0 ; -static ssize_t show_global_boost (struct kobject *kobj, -struct attribute *attr,char *buf) -{ -return sprintf (buf,"%u\n" , boost_enabled); -} +if (!acpi_cpufreq_driver.low_level_boost) +return -EINVAL ; + + ret =kstrtoul (buf,10 , &val); +if (ret || (val >1 )) +return -EINVAL ; -static struct global_attr global_boost =__ATTR (boost,0644 , - show_global_boost, - store_global_boost); +_store_boost ((int ) val); + +return count; +}#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB static ssize_t store_cpb (struct cpufreq_policy *policy,const char *buf,size_t count) { -return _store_boost (buf, count); +return store_boost (buf, count); }static ssize_t show_cpb (struct cpufreq_policy *policy,char *buf) { -return sprintf (buf,"%u\n" , boost_enabled); +return sprintf (buf,"%u\n" , acpi_cpufreq_driver.boost_en); }static struct freq_attr cpb =__ATTR (cpb,0644 , show_cpb, store_cpb);
@@ -571,7 +562,7 @@ static int boost_notify(struct notifier_block *nb, unsigned long action,switch (action) {case CPU_UP_PREPARE :case CPU_UP_PREPARE_FROZEN : -boost_set_msrs (boost_enabled, cpumask); +boost_set_msrs (acpi_cpufreq_driver.boost_en, cpumask);break ;case CPU_DOWN_PREPARE :
@@ -930,33 +921,22 @@ static void __init acpi_cpufreq_boost_init(void)if (!msrs)return ; - boost_supported = true; - boost_enabled =boost_state (0 ); + acpi_cpufreq_driver.low_level_boost = &_store_boost; + acpi_cpufreq_driver.boost_en =boost_state (0 );get_online_cpus ();/* Force all MSRs to the same value */ -boost_set_msrs (boost_enabled, cpu_online_mask); +boost_set_msrs (acpi_cpufreq_driver.boost_en, cpu_online_mask);register_cpu_notifier (&boost_nb);put_online_cpus (); - }else - global_boost.attr.mode =0444 ; - -/* We create the boost file in any case, though for systems without -* hardware support it will be read-only and hardwired to return 0. -*/ -if (sysfs_create_file (cpufreq_global_kobject, &(global_boost.attr))) -pr_warn (PFX "could not register global boost sysfs file\n" ); -else -pr_debug ("registered global boost sysfs file\n" ); + } } static void __exit acpi_cpufreq_boost_exit(void) { -sysfs_remove_file (cpufreq_global_kobject, &(global_boost.attr)); -if (msrs) {unregister_cpu_notifier (&boost_nb);
Signature · 1 line
1.7.10.4
PATCH v2 3/3 cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
In reply to Lukasz MajewskiThe struct cpufreq_driver has been extended to embrace the information related to boost support.
When "boost_mode" device tree attribute is defined for a platform, the low_level_boost pointer is filled with proper address. The .low_level_boost field filled to NULL, indicates that boost is not supported.
Operations of exynos_cpufreq_boost_trigger() function are protected with "local" mutex.
---
Changes for v2:
- Removal of struct cpufreq_boost
- Removal of the CONFIG_CPU_FREQ_BOOST flag
- low_level_boost with valid address when boost is supported
--- drivers/cpufreq/exynos-cpufreq.c | 49 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-)
drivers/cpufreq/exynos-cpufreq.c +47 -2
@@ -33,6 +33,7 @@ static struct cpufreq_freqs freqs;static unsigned int locking_frequency;static bool frequency_locked;static DEFINE_MUTEX (cpufreq_lock); +static struct cpufreq_cpuinfo *cpufreq_cpu_info;static int exynos_verify_speed (struct cpufreq_policy *policy) {
@@ -154,6 +155,7 @@ out:return ret; } +static struct cpufreq_driver exynos_driver;static int exynos_target (struct cpufreq_policy *policy,unsigned int target_freq,unsigned int relation)
@@ -244,6 +246,9 @@ static struct notifier_block exynos_cpufreq_nb = {static int exynos_cpufreq_cpu_init (struct cpufreq_policy *policy) { +unsigned int max_freq; +int ret; + policy->cur = policy->min = policy->max =exynos_getspeed (policy->cpu);cpufreq_frequency_table_get_attr (exynos_info->freq_table, policy->cpu);
@@ -253,7 +258,19 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy)cpumask_setall (policy->cpus); -return cpufreq_frequency_table_cpuinfo (policy, exynos_info->freq_table); + ret =cpufreq_frequency_table_cpuinfo (policy, exynos_info->freq_table); +if (ret) +return ret; + +if (exynos_driver.low_level_boost) { +/* disable boost by default */ + max_freq =cpufreq_frequency_table_max (exynos_info->freq_table, +0 ); + policy->cpuinfo.max_freq = policy->max = max_freq; + cpufreq_cpu_info = &policy->cpuinfo; + } + +return 0 ; }static int exynos_cpufreq_cpu_exit (struct cpufreq_policy *policy)
@@ -264,9 +281,32 @@ static int exynos_cpufreq_cpu_exit(struct cpufreq_policy *policy)static struct freq_attr *exynos_cpufreq_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, + &cpufreq_freq_attr_boost_available_freqs,NULL , }; +static int exynos_cpufreq_boost_trigger (int state) +{ +struct cpufreq_policy *policy =container_of (cpufreq_cpu_info, + struct cpufreq_policy, + cpuinfo); +unsigned int max_freq; + +mutex_lock (&cpufreq_lock); + exynos_driver.boost_en = state; + +/* Recalculate maximal frequency */ + max_freq =cpufreq_frequency_table_max (exynos_info->freq_table, + exynos_driver.boost_en); + +if (policy->max != max_freq) + policy->cpuinfo.max_freq = policy->max = max_freq; + +mutex_unlock (&cpufreq_lock); + +return 0 ; +} +static struct cpufreq_driver exynos_driver = { .flags =CPUFREQ_STICKY , .verify = exynos_verify_speed,
@@ -275,7 +315,7 @@ static struct cpufreq_driver exynos_driver = { .init = exynos_cpufreq_cpu_init, .exit = exynos_cpufreq_cpu_exit, .name = "exynos_cpufreq", - .attr = exynos_cpufreq_attr, + .attr = exynos_cpufreq_attr, #ifdef CONFIG_PM .suspend = exynos_cpufreq_suspend, .resume = exynos_cpufreq_resume,
@@ -359,6 +399,8 @@ static struct of_device_id exynos_cpufreq_of_match[] __initconst = {static int __init exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *node = pdev->dev.of_node; +int ret = -EINVAL ; exynos_info =kzalloc (sizeof (struct exynos_dvfs_info ),GFP_KERNEL );
@@ -391,6 +433,9 @@ static int __init exynos_cpufreq_probe(struct platform_device *pdev) } locking_frequency =exynos_getspeed (0 ); +if (of_property_read_bool (node,"boost_mode" )) + exynos_driver.low_level_boost = + &exynos_cpufreq_boost_trigger;register_pm_notifier (&exynos_cpufreq_nb);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v2 3/3] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
Quoted 7 lines · Lukasz Majewski
The struct
cpufreq_driverhas been extended to embrace the information related to boost support.When "
boost_mode" device tree attribute is defined for a platform, thelow_level_boostpointer is filled with proper address. The .low_level_boost field filled to NULL, indicates that boost is not supported.
This patch is still few generations back :)
Re: [PATCH v2 3/3] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
Quoted 10 lines · Viresh Kumar
Quoted 7 lines · Lukasz Majewski
The struct
cpufreq_driverhas been extended to embrace the information related to boost support.When "
boost_mode" device tree attribute is defined for a platform, thelow_level_boostpointer is filled with proper address. The .low_level_boost field filled to NULL, indicates that boost is not supported.This patch is still few generations back :)
But this is v2 version of boost patches.
Please also review:
[PATCH v4 4/7]
[PATCH v4 5/7]
[PATCH v4 6/7]
[PATCH v4 7/7] - disable boost at thermal framework
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v2 3/3] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
Quoted 4 lines · Lukasz Majewski
Quoted 1 line · Viresh Kumar
This patch is still few generations back :)
But this is v2 version of boost patches.
My mistake....
Quoted 5 lines
Please also review:
[PATCH v4 4/7]
[PATCH v4 5/7]
[PATCH v4 6/7]
[PATCH v4 7/7] - disable boost at thermal framework
don't worry I will review everything. I went home after reviewing half of the patches.
Re: [PATCH v2 3/3] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
Quoted 8 lines · Viresh Kumar
Quoted 4 lines · Lukasz Majewski
Quoted 1 line · Viresh Kumar
This patch is still few generations back :)
But this is v2 version of boost patches.
My mistake....
Quoted 8 lines
Quoted 5 lines
Please also review:
[PATCH v4 4/7]
[PATCH v4 5/7]
[PATCH v4 6/7]
[PATCH v4 7/7] - disable boost at thermal frameworkdon't worry I will review everything. I went home after reviewing half of the patches.
Ok, Thanks.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerQuoted 10 lines · Lukasz Majewski
This patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreqBoost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos).
For this reason cpufreq/freq_table code has been reorganized to include common code.
To be honest, I haven't given a review to patches 2/3 and 3/3 as I am concerned more about 1/3.
Maybe you can just send v3 of 1/3. 2/3 and 3/3 can be sent when we have finalized 2/3 and 3/3 's version.
Hi Viresh,
Quoted 8 lines · Lukasz Majewski
Quoted 7 lines
This patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
Quoted 7 lines
Quoted 4 lines
Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos). For this reason cpufreq/freq_table code has been reorganized to include common code.
To be honest, I haven't given a review to patches 2/3 and 3/3 as I am concerned more about 1/3.
As you pointed out in the other mail 1/3 has its own issues, but I think that patches 2/3 and 3/3 are an integral part of the boost support and bring better overall overview to the design.
Quoted 3 lines
Maybe you can just send v3 of 1/3. 2/3 and 3/3 can be sent when we have finalized 2/3 and 3/3 's version.
I'd opt for sending the whole patchset (it shouldn't be so difficult to adjust those patches), since it is easier for me to test.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerQuoted 3 lines · Lukasz Majewski
As you pointed out in the other mail 1/3 has its own issues, but I think that patches 2/3 and 3/3 are an integral part of the boost support and bring better overall overview to the design.
Yes they are. Undoubtedly.
Quoted 5 lines
Quoted 2 lines
Maybe you can just send v3 of 1/3. 2/3 and 3/3 can be sent when we have finalized 2/3 and 3/3 's version.
I'd opt for sending the whole patchset (it shouldn't be so difficult to adjust those patches), since it is easier for me to test.
Okay.
v3 cover cpufreq:boost: CPU Boost mode support
In reply to Lukasz MajewskiThis patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos).
For this reason cpufreq/freq_table code has been reorganized to include common code.
Important design decisions:
- Boost related code is compiled-in unconditionally and disabled by default The cpufreq_driver is responsibile for providing set_boost_freq callback (if needed)
- struct cpufreq_driver has been extended with boost related fields:
-- boost_supported - when driver supports boosting -- set_boost_freq - callback to function, which is necessary to
enable boost at the processor (like it is done at Intel)
- Boost sysfs attributies are seen only when cpufreq driver supports them. They will not show up until either cpufreq_driver defines boost_supported flag or device tree's cpufreq "boost_mode" attribute.
- No special spin_lock for Boost was created. The one from cpufreq_driver was reused.
- The Boost code doesn't rely on any policy. When boost state is changed, then policies attached to each CPU are updated.
Tested at: HW:
Exynos 4412 3.10 linux
Exynos 4210 3.10 linuxCompile tested x86_64 defconfig (acpi) - help with HW (Intel Nehalem) test
needed
Lukasz Majewski (3):
cpufreq: Add boost frequency support in core cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common
boost solution
cpufreq:exynos:Extend Exynos cpufreq driver to support boost
framework
arch/arm/mach-s3c24xx/cpufreq.c | 2 +- arch/powerpc/platforms/pasemi/cpufreq.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_32.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_64.c | 2 +- drivers/cpufreq/acpi-cpufreq.c | 62 +++++++----------- drivers/cpufreq/arm_big_little.c | 3 +- drivers/cpufreq/blackfin-cpufreq.c | 2 +- drivers/cpufreq/cpufreq-cpu0.c | 2 +- drivers/cpufreq/cpufreq.c | 87 ++++++++++++++++++++++++++ drivers/cpufreq/cris-artpec3-cpufreq.c | 2 +- drivers/cpufreq/cris-etraxfs-cpufreq.c | 2 +- drivers/cpufreq/davinci-cpufreq.c | 2 +- drivers/cpufreq/dbx500-cpufreq.c | 2 +- drivers/cpufreq/e_powersaver.c | 3 +- drivers/cpufreq/elanfreq.c | 2 +- drivers/cpufreq/exynos-cpufreq.c | 7 ++- drivers/cpufreq/exynos5440-cpufreq.c | 2 +- drivers/cpufreq/freq_table.c | 44 ++++++++++--- drivers/cpufreq/ia64-acpi-cpufreq.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 2 +- drivers/cpufreq/kirkwood-cpufreq.c | 3 +- drivers/cpufreq/longhaul.c | 2 +- drivers/cpufreq/loongson2_cpufreq.c | 2 +- drivers/cpufreq/maple-cpufreq.c | 2 +- drivers/cpufreq/omap-cpufreq.c | 2 +- drivers/cpufreq/p4-clockmod.c | 2 +- drivers/cpufreq/powernow-k6.c | 2 +- drivers/cpufreq/powernow-k7.c | 2 +- drivers/cpufreq/powernow-k8.c | 2 +- drivers/cpufreq/ppc_cbe_cpufreq.c | 2 +- drivers/cpufreq/pxa2xx-cpufreq.c | 4 +- drivers/cpufreq/pxa3xx-cpufreq.c | 2 +- drivers/cpufreq/s3c2416-cpufreq.c | 2 +- drivers/cpufreq/s3c64xx-cpufreq.c | 2 +- drivers/cpufreq/s5pv210-cpufreq.c | 2 +- drivers/cpufreq/sc520_freq.c | 2 +- drivers/cpufreq/sh-cpufreq.c | 2 +- drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +- drivers/cpufreq/sparc-us3-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 3 +- drivers/cpufreq/speedstep-centrino.c | 2 +- drivers/cpufreq/speedstep-ich.c | 2 +- drivers/cpufreq/speedstep-smi.c | 2 +- drivers/cpufreq/tegra-cpufreq.c | 4 +- include/linux/cpufreq.h | 18 +++++- 45 files changed, 211 insertions(+), 95 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v3 1/3 cpufreq: Add boost frequency support in core
This commit adds boost frequency support in cpufreq core (Hardware & Software).
Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal operation limits. Such a mode shall be only used for a short time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
By default boost is disabled. One global attribute is available at:/sys/devices/system/cpu/cpufreq/boost.
It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.
Changes for v2:
- Removal of cpufreq_boost structure and move its fields to cpufreq_driver structure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names
Changes for v3:
- Method for reading boost status
- Removal of cpufreq_frequency_table_max()
- Extent cpufreq_frequency_table_cpuinfo() to support boost parameter
- boost_supported flag added to cpufreq_driver struct
- "boost" sysfs attribute control flag removed
- One global flag describing state of the boost defined at cpufreq core
- Rename cpufreq_driver's low_level_boost field to set_boost_freq()
- Usage of cpufreq_sysfs_{remove|add}_file() routines
--- arch/arm/mach-s3c24xx/cpufreq.c | 2 +- arch/powerpc/platforms/pasemi/cpufreq.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_32.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_64.c | 2 +- drivers/cpufreq/acpi-cpufreq.c | 2 +- drivers/cpufreq/arm_big_little.c | 3 +- drivers/cpufreq/blackfin-cpufreq.c | 2 +- drivers/cpufreq/cpufreq-cpu0.c | 2 +- drivers/cpufreq/cpufreq.c | 87 ++++++++++++++++++++++++++ drivers/cpufreq/cris-artpec3-cpufreq.c | 2 +- drivers/cpufreq/cris-etraxfs-cpufreq.c | 2 +- drivers/cpufreq/davinci-cpufreq.c | 2 +- drivers/cpufreq/dbx500-cpufreq.c | 2 +- drivers/cpufreq/e_powersaver.c | 3 +- drivers/cpufreq/elanfreq.c | 2 +- drivers/cpufreq/exynos-cpufreq.c | 3 +- drivers/cpufreq/exynos5440-cpufreq.c | 2 +- drivers/cpufreq/freq_table.c | 44 ++++++++++--- drivers/cpufreq/ia64-acpi-cpufreq.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 2 +- drivers/cpufreq/kirkwood-cpufreq.c | 3 +- drivers/cpufreq/longhaul.c | 2 +- drivers/cpufreq/loongson2_cpufreq.c | 2 +- drivers/cpufreq/maple-cpufreq.c | 2 +- drivers/cpufreq/omap-cpufreq.c | 2 +- drivers/cpufreq/p4-clockmod.c | 2 +- drivers/cpufreq/powernow-k6.c | 2 +- drivers/cpufreq/powernow-k7.c | 2 +- drivers/cpufreq/powernow-k8.c | 2 +- drivers/cpufreq/ppc_cbe_cpufreq.c | 2 +- drivers/cpufreq/pxa2xx-cpufreq.c | 4 +- drivers/cpufreq/pxa3xx-cpufreq.c | 2 +- drivers/cpufreq/s3c2416-cpufreq.c | 2 +- drivers/cpufreq/s3c64xx-cpufreq.c | 2 +- drivers/cpufreq/s5pv210-cpufreq.c | 2 +- drivers/cpufreq/sc520_freq.c | 2 +- drivers/cpufreq/sh-cpufreq.c | 2 +- drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +- drivers/cpufreq/sparc-us3-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 3 +- drivers/cpufreq/speedstep-centrino.c | 2 +- drivers/cpufreq/speedstep-ich.c | 2 +- drivers/cpufreq/speedstep-smi.c | 2 +- drivers/cpufreq/tegra-cpufreq.c | 4 +- include/linux/cpufreq.h | 18 +++++- 45 files changed, 187 insertions(+), 55 deletions(-)
arch/arm/mach-s3c24xx/cpufreq.c +1 -1
@@ -387,7 +387,7 @@ static int s3c_cpufreq_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = cpu_cur.info->latency;if (ftab) -cpufreq_frequency_table_cpuinfo (policy, ftab); +cpufreq_frequency_table_cpuinfo (policy, ftab,0 );return 0 ; }
arch/powerpc/platforms/pasemi/cpufreq.c +1 -1
@@ -223,7 +223,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)/* this ensures that policy->cpuinfo_min and policy->cpuinfo_max * are set correctly */ -return cpufreq_frequency_table_cpuinfo (policy, pas_freqs); +return cpufreq_frequency_table_cpuinfo (policy, pas_freqs,0 ); out_unmap_sdcpwr:iounmap (sdcpwr_mapbase);
arch/powerpc/platforms/powermac/cpufreq_32.c +1 -1
@@ -408,7 +408,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cur = cur_freq;cpufreq_frequency_table_get_attr (pmac_cpu_freqs, policy->cpu); -return cpufreq_frequency_table_cpuinfo (policy, pmac_cpu_freqs); +return cpufreq_frequency_table_cpuinfo (policy, pmac_cpu_freqs,0 ); }static u32 read_gpio (struct device_node *np)
arch/powerpc/platforms/powermac/cpufreq_64.c +1 -1
@@ -365,7 +365,7 @@ static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)cpufreq_frequency_table_get_attr (g5_cpu_freqs, policy->cpu);return cpufreq_frequency_table_cpuinfo (policy, - g5_cpu_freqs); + g5_cpu_freqs,0 ); }
drivers/cpufreq/acpi-cpufreq.c +1 -1
@@ -819,7 +819,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) data->freq_table[valid_states].frequency =CPUFREQ_TABLE_END ; perf->state =0 ; - result =cpufreq_frequency_table_cpuinfo (policy, data->freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, data->freq_table,0 );if (result) goto err_freqfree;
drivers/cpufreq/arm_big_little.c +2 -1
@@ -167,7 +167,8 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)if (ret)return ret; - ret =cpufreq_frequency_table_cpuinfo (policy, freq_table[cur_cluster]); + ret =cpufreq_frequency_table_cpuinfo (policy, freq_table[cur_cluster], +0 );if (ret) {dev_err (cpu_dev,"CPU %d, cluster: %d invalid freq table\n" , policy->cpu, cur_cluster);
drivers/cpufreq/blackfin-cpufreq.c +1 -1
@@ -211,7 +211,7 @@ static int __bfin_cpu_init(struct cpufreq_policy *policy) policy->cur = cclk;cpufreq_frequency_table_get_attr (bfin_freq_table, policy->cpu); -return cpufreq_frequency_table_cpuinfo (policy, bfin_freq_table); +return cpufreq_frequency_table_cpuinfo (policy, bfin_freq_table,0 ); }static struct freq_attr *bfin_freq_attr[] = {
drivers/cpufreq/cpufreq-cpu0.c +1 -1
@@ -128,7 +128,7 @@ static int cpu0_cpufreq_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, freq_table); + ret =cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );if (ret) {pr_err ("invalid frequency table: %d\n" , ret);return ret;
drivers/cpufreq/cpufreq.c +87 -0
117 lines not on this page · raw message
drivers/cpufreq/cris-artpec3-cpufreq.c +1 -1
@@ -82,7 +82,7 @@ static int cris_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =1000000 ;/* 1ms */ policy->cur =cris_freq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, cris_freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, cris_freq_table,0 );if (result)return (result);
drivers/cpufreq/cris-etraxfs-cpufreq.c +1 -1
@@ -81,7 +81,7 @@ static int cris_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =1000000 ;/* 1ms */ policy->cur =cris_freq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, cris_freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, cris_freq_table,0 );if (result)return (result);
drivers/cpufreq/davinci-cpufreq.c +1 -1
@@ -137,7 +137,7 @@ static int davinci_cpu_init(struct cpufreq_policy *policy) policy->cur =davinci_getspeed (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );if (result) {pr_err ("%s: cpufreq_frequency_table_cpuinfo() failed" , __func__);
drivers/cpufreq/dbx500-cpufreq.c +1 -1
@@ -87,7 +87,7 @@ static int __cpuinit dbx500_cpufreq_init(struct cpufreq_policy *policy)int res;/* get policy fields based on the table */ - res =cpufreq_frequency_table_cpuinfo (policy, freq_table); + res =cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );if (!res)cpufreq_frequency_table_get_attr (freq_table, policy->cpu);else {
drivers/cpufreq/e_powersaver.c +2 -1
@@ -400,7 +400,8 @@ static int eps_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =140000 ;/* 844mV -> 700mV in ns */ policy->cur = fsb * current_multiplier; - ret =cpufreq_frequency_table_cpuinfo (policy, ¢aur->freq_table[0 ]); + ret =cpufreq_frequency_table_cpuinfo (policy, ¢aur->freq_table[0 ], +0 );if (ret) {kfree (centaur);return ret;
drivers/cpufreq/elanfreq.c +1 -1
@@ -223,7 +223,7 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; policy->cur =elanfreq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, elanfreq_table); + result =cpufreq_frequency_table_cpuinfo (policy, elanfreq_table,0 );if (result)return result;
drivers/cpufreq/exynos-cpufreq.c +2 -1
@@ -253,7 +253,8 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy)cpumask_setall (policy->cpus); -return cpufreq_frequency_table_cpuinfo (policy, exynos_info->freq_table); +return cpufreq_frequency_table_cpuinfo (policy, exynos_info->freq_table, +0 ); }static int exynos_cpufreq_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/exynos5440-cpufreq.c +1 -1
@@ -323,7 +323,7 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, dvfs_info->freq_table); + ret =cpufreq_frequency_table_cpuinfo (policy, dvfs_info->freq_table,0 );if (ret) {dev_err (dvfs_info->dev,"Invalid frequency table: %d\n" , ret);return ret;
drivers/cpufreq/freq_table.c +34 -10
79 lines not on this page · raw message
drivers/cpufreq/ia64-acpi-cpufreq.c +1 -1
@@ -335,7 +335,7 @@ acpi_cpufreq_cpu_init ( } } - result =cpufreq_frequency_table_cpuinfo (policy, data->freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, data->freq_table,0 );if (result) { goto err_freqfree; }
drivers/cpufreq/imx6q-cpufreq.c +1 -1
@@ -172,7 +172,7 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, freq_table); + ret =cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );if (ret) {dev_err (cpu_dev,"invalid frequency table: %d\n" , ret);return ret;
drivers/cpufreq/kirkwood-cpufreq.c +2 -1
@@ -131,7 +131,8 @@ static int kirkwood_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =5000 ;/* 5uS */ policy->cur =kirkwood_cpufreq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, kirkwood_freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, kirkwood_freq_table, +0 );if (result)return result;
drivers/cpufreq/longhaul.c +1 -1
@@ -921,7 +921,7 @@ static int __cpuinit longhaul_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =200000 ;/* nsec */ policy->cur =calc_speed (longhaul_get_cpu_mult ()); - ret =cpufreq_frequency_table_cpuinfo (policy, longhaul_table); + ret =cpufreq_frequency_table_cpuinfo (policy, longhaul_table,0 );if (ret)return ret;
drivers/cpufreq/loongson2_cpufreq.c +1 -1
@@ -136,7 +136,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cpu);return cpufreq_frequency_table_cpuinfo (policy, - &loongson2_clockmod_table[0 ]); + &loongson2_clockmod_table[0 ],0 ); }static int loongson2_cpufreq_verify (struct cpufreq_policy *policy)
drivers/cpufreq/maple-cpufreq.c +1 -1
@@ -184,7 +184,7 @@ static int maple_cpufreq_cpu_init(struct cpufreq_policy *policy)cpufreq_frequency_table_get_attr (maple_cpu_freqs, policy->cpu);return cpufreq_frequency_table_cpuinfo (policy, - maple_cpu_freqs); + maple_cpu_freqs,0 ); }
drivers/cpufreq/omap-cpufreq.c +1 -1
@@ -191,7 +191,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)atomic_inc_return (&freq_table_users); - result =cpufreq_frequency_table_cpuinfo (policy, freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );if (result) goto fail_table;
drivers/cpufreq/p4-clockmod.c +1 -1
@@ -239,7 +239,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =10000001 ; policy->cur = stock_freq; -return cpufreq_frequency_table_cpuinfo (policy, &p4clockmod_table[0 ]); +return cpufreq_frequency_table_cpuinfo (policy, &p4clockmod_table[0 ],0 ); }
drivers/cpufreq/powernow-k6.c +1 -1
@@ -167,7 +167,7 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =200000 ; policy->cur = busfreq * max_multiplier; - result =cpufreq_frequency_table_cpuinfo (policy, clock_ratio); + result =cpufreq_frequency_table_cpuinfo (policy, clock_ratio,0 );if (result)return result;
drivers/cpufreq/powernow-k7.c +1 -1
@@ -683,7 +683,7 @@ static int __cpuinit powernow_cpu_init(struct cpufreq_policy *policy)cpufreq_frequency_table_get_attr (powernow_table, policy->cpu); -return cpufreq_frequency_table_cpuinfo (policy, powernow_table); +return cpufreq_frequency_table_cpuinfo (policy, powernow_table,0 ); }static int powernow_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/powernow-k8.c +1 -1
@@ -1156,7 +1156,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)pr_debug ("policy current frequency %d kHz\n" , pol->cur);/* min/max the cpu is capable of */ -if (cpufreq_frequency_table_cpuinfo (pol, data->powernow_table)) { +if (cpufreq_frequency_table_cpuinfo (pol, data->powernow_table),0 ) { printk(KERN_ERR FW_BUG PFX "invalid powernow_table\n");powernow_k8_cpu_exit_acpi (data);kfree (data->powernow_table);
drivers/cpufreq/ppc_cbe_cpufreq.c +1 -1
@@ -127,7 +127,7 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)/* this ensures that policy->cpuinfo_min * and policy->cpuinfo_max are set correctly */ -return cpufreq_frequency_table_cpuinfo (policy, cbe_freqs); +return cpufreq_frequency_table_cpuinfo (policy, cbe_freqs,0 ); }static int cbe_cpufreq_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/pxa2xx-cpufreq.c +2 -2
@@ -453,10 +453,10 @@ static int pxa_cpufreq_init(struct cpufreq_policy *policy)find_freq_tables (&pxa255_freq_table, &pxa255_freqs);pr_info ("PXA255 cpufreq using %s frequency table\n" , pxa255_turbo_table ?"turbo" :"run" ); -cpufreq_frequency_table_cpuinfo (policy, pxa255_freq_table); +cpufreq_frequency_table_cpuinfo (policy, pxa255_freq_table,0 ); }else if (cpu_is_pxa27x ()) -cpufreq_frequency_table_cpuinfo (policy, pxa27x_freq_table); +cpufreq_frequency_table_cpuinfo (policy, pxa27x_freq_table,0 );printk (KERN_INFO "PXA CPU frequency change support initialized\n" );
drivers/cpufreq/pxa3xx-cpufreq.c +1 -1
@@ -108,7 +108,7 @@ static int setup_freqs_table(struct cpufreq_policy *policy, pxa3xx_freqs_num = num; pxa3xx_freqs_table = table; -return cpufreq_frequency_table_cpuinfo (policy, table); +return cpufreq_frequency_table_cpuinfo (policy, table,0 ); }static void __update_core_freq (struct pxa3xx_freq_info *info)
drivers/cpufreq/s3c2416-cpufreq.c +1 -1
@@ -494,7 +494,7 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = (500 *1000 ) + s3c_freq->regulator_latency; - ret =cpufreq_frequency_table_cpuinfo (policy, s3c_freq->freq_table); + ret =cpufreq_frequency_table_cpuinfo (policy, s3c_freq->freq_table,0 );if (ret) goto err_freq_table;
drivers/cpufreq/s3c64xx-cpufreq.c +1 -1
@@ -247,7 +247,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)*/ policy->cpuinfo.transition_latency = (500 *1000 ) + regulator_latency; - ret =cpufreq_frequency_table_cpuinfo (policy, s3c64xx_freq_table); + ret =cpufreq_frequency_table_cpuinfo (policy, s3c64xx_freq_table,0 );if (ret !=0 ) {pr_err ("Failed to configure frequency table: %d\n" , ret);
drivers/cpufreq/s5pv210-cpufreq.c +1 -1
@@ -557,7 +557,7 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =40000 ; -return cpufreq_frequency_table_cpuinfo (policy, s5pv210_freq_table); +return cpufreq_frequency_table_cpuinfo (policy, s5pv210_freq_table,0 ); out_dmc1:clk_put (dmc0_clk);
drivers/cpufreq/sc520_freq.c +1 -1
@@ -117,7 +117,7 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =1000000 ;/* 1ms */ policy->cur =sc520_freq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, sc520_freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, sc520_freq_table,0 );if (result)return result;
drivers/cpufreq/sh-cpufreq.c +1 -1
@@ -120,7 +120,7 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)if (freq_table) {int result; - result =cpufreq_frequency_table_cpuinfo (policy, freq_table); + result =cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );if (!result)cpufreq_frequency_table_get_attr (freq_table, cpu); }else {
drivers/cpufreq/sparc-us2e-cpufreq.c +1 -1
@@ -324,7 +324,7 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =0 ; policy->cur = clock_tick; -return cpufreq_frequency_table_cpuinfo (policy, table); +return cpufreq_frequency_table_cpuinfo (policy, table,0 ); }static int us2e_freq_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/sparc-us3-cpufreq.c +1 -1
@@ -181,7 +181,7 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =0 ; policy->cur = clock_tick; -return cpufreq_frequency_table_cpuinfo (policy, table); +return cpufreq_frequency_table_cpuinfo (policy, table,0 ); }static int us3_freq_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/spear-cpufreq.c +2 -1
@@ -178,7 +178,8 @@ static int spear_cpufreq_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, spear_cpufreq.freq_tbl); + ret =cpufreq_frequency_table_cpuinfo (policy, spear_cpufreq.freq_tbl, +0 );if (ret) {pr_err ("cpufreq_frequency_table_cpuinfo() failed" );return ret;
drivers/cpufreq/speedstep-centrino.c +1 -1
@@ -403,7 +403,7 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)pr_debug ("centrino_cpu_init: cur=%dkHz\n" , policy->cur); ret =cpufreq_frequency_table_cpuinfo (policy, -per_cpu (centrino_model, policy->cpu)->op_points); +per_cpu (centrino_model, policy->cpu)->op_points,0 );if (ret)return (ret);
drivers/cpufreq/speedstep-ich.c +1 -1
@@ -349,7 +349,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)/* cpuinfo and default policy values */ policy->cur = speed; - result =cpufreq_frequency_table_cpuinfo (policy, speedstep_freqs); + result =cpufreq_frequency_table_cpuinfo (policy, speedstep_freqs,0 );if (result)return result;
drivers/cpufreq/speedstep-smi.c +1 -1
@@ -329,7 +329,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; policy->cur = speed; - result =cpufreq_frequency_table_cpuinfo (policy, speedstep_freqs); + result =cpufreq_frequency_table_cpuinfo (policy, speedstep_freqs,0 );if (result)return result;
drivers/cpufreq/tegra-cpufreq.c +2 -2
@@ -216,7 +216,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)clk_prepare_enable (emc_clk);clk_prepare_enable (cpu_clk); -cpufreq_frequency_table_cpuinfo (policy, freq_table); +cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );cpufreq_frequency_table_get_attr (freq_table, policy->cpu); policy->cur =tegra_getspeed (policy->cpu); target_cpu_speed[policy->cpu] = policy->cur;
@@ -234,7 +234,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)static int tegra_cpu_exit (struct cpufreq_policy *policy) { -cpufreq_frequency_table_cpuinfo (policy, freq_table); +cpufreq_frequency_table_cpuinfo (policy, freq_table,0 );clk_disable_unprepare (emc_clk);return 0 ; }
include/linux/cpufreq.h +17 -1
@@ -266,6 +266,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_supported; +int (*set_boost_freq) (int state); };/* flags */
@@ -318,6 +322,10 @@ __ATTR(_name, _perm, show_##_name, NULL)static struct freq_attr _name = \ __ATTR(_name, 0644, show_##_name, store_##_name) +#define cpufreq_attr_available_freq (_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies) +struct global_attr {struct attribute attr; ssize_t (*show)(struct kobject *kobj,
@@ -407,6 +415,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative;#define CPUFREQ_ENTRY_INVALID ~0#define CPUFREQ_TABLE_END ~1 +/* Define index for boost frequency */ +#define CPUFREQ_BOOST_FREQ ~2 +struct cpufreq_frequency_table {unsigned int index;/* any */ unsigned int frequency;/* kHz - doesn't need to be in ascending
@@ -414,7 +425,8 @@ struct cpufreq_frequency_table { };int cpufreq_frequency_table_cpuinfo (struct cpufreq_policy *policy, -struct cpufreq_frequency_table *table); +struct cpufreq_frequency_table *table, +int boost);int cpufreq_frequency_table_verify (struct cpufreq_policy *policy,struct cpufreq_frequency_table *table);
@@ -425,11 +437,15 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,unsigned int relation, unsigned int *index); +int cpufreq_boost_trigger_state (int state); +int cpufreq_boost_state (void ); +/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu);/* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; +extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs;void cpufreq_frequency_table_get_attr (struct cpufreq_frequency_table *table,unsigned int cpu);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 6 lines · Lukasz Majewski
Changes for v2:
- Removal ofcpufreq_booststructure and move its fields tocpufreq_driverstructure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names
Quoted 9 lines
Changes for v3:
- Method for reading boost status
- Removal ofcpufreq_frequency_table_max()
- Extentcpufreq_frequency_table_cpuinfo()to support boost parameter
-boost_supportedflag added tocpufreq_driverstruct
- "boost" sysfs attribute control flag removed
- One global flag describing state of the boost defined at cpufreq core
- Rename cpufreq_driver'slow_level_boostfield toset_boost_freq()
- Usage of cpufreq_sysfs_{remove|add}_file() routines
Latest change log first please.
Quoted 24 lines
drivers/cpufreq/cpufreq.c +9
-0@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool cpufreq_boost_enabled; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */ @@ -315,6 +316,30 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , cpufreq_boost_enabled); +} + +static ssize_t store_boost (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count)
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 336
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+{ +int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot %sable boost!\n" , __func__, + enable ?"en" :"dis" );
Please don't use %sable as discussed earlier.
Quoted 14 lines
drivers/cpufreq/cpufreq.c +7
-0+return -EINVAL ; + } + +return count; +} +define_one_global_rw (boost);static struct cpufreq_governor *__find_governor (const char *str_governor) {@@ -1896,6 +1921,55 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };/********************************************************************* +* BOOST *
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1934
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+*********************************************************************/ +int cpufreq_boost_trigger_state (int state) +{ +struct cpufreq_frequency_table *freq_table; +struct cpufreq_policy *policy; +unsigned long flags; +int ret =0 , cpu; + +if (!cpufreq_driver->boost_supported) +return -ENODEV ;
This can't happen. sysfs directory is present only when we have boost supported.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1938
Quoted 3 lines
drivers/cpufreq/cpufreq.c +3
-0+if (cpufreq_boost_enabled != state) { +if (cpufreq_driver->set_boost_freq) { + ret = cpufreq_driver->set_boost_freq (state);
I thought this routine was for setting boost frequency and not for enabling boost feature. If boost has to be enabled separately then this routine must take care of it while setting freq.
So, in other words, this must not be called here.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1947
Quoted 9 lines
drivers/cpufreq/cpufreq.c +9
-0+if (ret) { +pr_err ("%s: BOOST cannot enable (%d)\n" , + __func__, ret); +return ret; + } + } + +for_each_possible_cpu (cpu) { + policy =cpufreq_cpu_get (cpu);
In case this code is required, it would make more sense to keep list of all available policies, which we can iterate through.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1953
Quoted 6 lines
drivers/cpufreq/cpufreq.c +6
-0+ freq_table =cpufreq_frequency_get_table (cpu); +if (policy && freq_table) { +write_lock_irqsave (&cpufreq_driver_lock, flags); +cpufreq_frequency_table_cpuinfo (policy, + freq_table, + state);
We obviously don't need the last param to this routine and so bunch of changes you did in this patch.
cpufreq_frequency_table_cpuinfo() can itself check if boost is enabled or not.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1958
Quoted 5 lines
drivers/cpufreq/cpufreq.c +5
-0+ cpufreq_boost_enabled = state; +write_unlock_irqrestore (&cpufreq_driver_lock, + flags); + } + }
I am not sure if this is required at all. Or what complications can be there when we update max/min on the fly here.
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1967
Quoted 9 lines
drivers/cpufreq/cpufreq.c +9
-0+ } + +pr_debug ("%s: cpufreq BOOST %s\n" , __func__, + state ?"enabled" :"disabled" ); + +return 0 ; +} + +int cpufreq_boost_state (void )
s/cpufreq_boost_state/cpufreq_boost_enabled
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1968
Quoted 2 lines
drivers/cpufreq/cpufreq.c +2
-0+{ +return cpufreq_boost_enabled;
s/cpufreq_boost_enabled/boost_enabled
Quoted 23 lines
drivers/cpufreq/cpufreq.c +12
-0+} + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -1934,6 +2008,15 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); +if (cpufreq_driver->boost_supported) { + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n" , + __func__); + goto err_null_driver; + } + } + ret =subsys_interface_register (&cpufreq_interface);if (ret) goto err_null_driver;
drivers/cpufreq/cpufreq.c int cpufreq_unregister_driver(struct cpufreq_driver *driver) · line 2082
Quoted 10 lines
drivers/cpufreq/cpufreq.c +4
-0@@ -1990,6 +2073,10 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); + +if (cpufreq_driver->boost_supported) +cpufreq_sysfs_remove_file (&(boost.attr)); +unregister_hotcpu_notifier (&cpufreq_cpu_notifier);write_lock_irqsave (&cpufreq_driver_lock, flags);
This part looked good :)
Quoted 38 lines
drivers/cpufreq/freq_table.c +7
-3@@ -21,7 +21,8 @@*********************************************************************/ int cpufreq_frequency_table_cpuinfo (struct cpufreq_policy *policy, -struct cpufreq_frequency_table *table) +struct cpufreq_frequency_table *table, +int boost) {unsigned int min_freq = ~0 ;unsigned int max_freq =0 ;@@ -31,9 +32,11 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,unsigned int freq = table[i].frequency;if (freq ==CPUFREQ_ENTRY_INVALID ) {pr_debug ("table entry %u is invalid, skipping\n" , i); -continue ; } +if (!boost && table[i].index ==CPUFREQ_BOOST_FREQ ) +continue ; +pr_debug ("table entry %u: %u kHz, %u index\n" , i, freq, table[i].index);if (freq < min_freq)@@ -171,7 +174,8 @@ static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table);/** * show_available_freqs - show available frequencies for the specified CPU */ -static ssize_t show_available_freqs (struct cpufreq_policy *policy,char *buf) +static ssize_t show_available_freqs (struct cpufreq_policy *policy,char *buf, +int show_boost) {unsigned int i =0 ;unsigned int cpu = policy->cpu;
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 196
Quoted 7 lines
drivers/cpufreq/freq_table.c +4
-0@@ -186,22 +190,42 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf)for (i =0 ; (table[i].frequency !=CPUFREQ_TABLE_END ); i++) {if (table[i].frequency ==CPUFREQ_ENTRY_INVALID )continue ; +if (show_boost && table[i].index !=CPUFREQ_BOOST_FREQ ) +continue ; +if (!show_boost && table[i].index ==CPUFREQ_BOOST_FREQ ) +continue ;
Maybe, this instead of above two if statements:
if (show_boost ^ (table[i].index == CPUFREQ_BOOST_FREQ))
continue
Quoted 6 lines
drivers/cpufreq/freq_table.c +0
-1count +=sprintf (&buf[count],"%d " , table[i].frequency); } count +=sprintf (&buf[count],"\n" );return count; -
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 206
Quoted 10 lines
drivers/cpufreq/freq_table.c +2
-6} -struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { - .attr = { .name ="scaling_available_frequencies" , - .mode =0444 , - }, - .show = show_available_freqs, -}; +/** +* show_scaling_available_frequencies - show normal boost frequencies for
s/boost /
Quoted 42 lines
drivers/cpufreq/freq_table.c +20
-0+* the specified CPU +*/ +static ssize_t scaling_available_frequencies_show (struct cpufreq_policy *policy, +char *buf) +{ +return show_available_freqs (policy, buf,0 ); +} +cpufreq_attr_available_freq (scaling_available);EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_available_freqs); +/** +* show_available_boost_freqs - show available boost frequencies for +* the specified CPU +*/ +static ssize_t scaling_boost_frequencies_show (struct cpufreq_policy *policy, +char *buf) +{ +return show_available_freqs (policy, buf,1 ); +} +cpufreq_attr_available_freq (scaling_boost); +EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_boost_freqs); +/* * if you use these, you must assure that the frequency table is valid * all the time between get_attr and put_attr! include/linux/cpufreq.h +4
-0@@ -266,6 +266,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_supported; +int (*set_boost_freq) (int state); };/* flags */
include/linux/cpufreq.h __ATTR(_name, _perm, show_##_name, NULL) · line 327
Quoted 6 lines
include/linux/cpufreq.h +3
-0@@ -318,6 +322,10 @@ __ATTR(_name, _perm, show_##_name, NULL)static struct freq_attr _name = \ __ATTR(_name, 0644, show_##_name, store_##_name) +#define cpufreq_attr_available_freq (_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies)
What is this doing in cpufreq.h? It will only be used by freq_table.c file.
Again, I couldn't see how boost freqs are getting used? You have probably made them part of normal freq range here and so they might be used during normal operations. But we wanted it to be used only when we have few cpus on... etc.. Where is that logic?
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 20 lines · Viresh Kumar
Quoted 7 lines · Lukasz Majewski
Changes for v2:
- Removal ofcpufreq_booststructure and move its fields tocpufreq_driverstructure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function namesQuoted 11 lines
Changes for v3:
- Method for reading boost status
- Removal ofcpufreq_frequency_table_max()
- Extentcpufreq_frequency_table_cpuinfo()to support boost parameter
-boost_supportedflag added tocpufreq_driverstruct
- "boost" sysfs attribute control flag removed
- One global flag describing state of the boost defined at cpufreq core
- Rename cpufreq_driver'slow_level_boostfield toset_boost_freq()
- Usage of cpufreq_sysfs_{remove|add}_file() routines
Quoted 1 line
Latest change log first please.
Ok.
Quoted 31 lines
Quoted 31 lines
drivers/cpufreq/cpufreq.c +1
-0@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool cpufreq_boost_enabled; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */ @@ -315,6 +316,30 @@
EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /*********************************************************************
* SYSFS
INTERFACE *
*********************************************************************/drivers/cpufreq/cpufreq.c +7
-0+ssize_t show_boost (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , cpufreq_boost_enabled); +} + +static ssize_t store_boost(struct kobject *kobj, struct attribute*attr,
drivers/cpufreq/cpufreq.c +5
-0+ const char *buf, size_t count) +{ + int ret, enable; + + ret =sscanf (buf,"%d" , &enable);
Quoted 8 lines
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 336
Quoted 6 lines
drivers/cpufreq/cpufreq.c +6
-0+if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot %sable boost!\n" , __func__, + enable ?"en" :"dis" );Please don't use %sable as discussed earlier.
My bad. I've overlooked this one.
Quoted 13 lines
Quoted 13 lines
drivers/cpufreq/cpufreq.c +6
-0+return -EINVAL ; + } + +return count; +} +define_one_global_rw (boost); static struct cpufreq_governor *__find_governor(const char
*str_governor) {drivers/cpufreq/cpufreq.c +0
-0@@ -1896,6 +1921,55 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };
Quoted 16 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1934
Quoted 13 lines
drivers/cpufreq/cpufreq.c +1
-0/********************************************************************* +* BOOST *
+ *********************************************************************/drivers/cpufreq/cpufreq.c +8
-0+int cpufreq_boost_trigger_state(int state) +{ +struct cpufreq_frequency_table *freq_table; +struct cpufreq_policy *policy; +unsigned long flags; +int ret =0 , cpu; + +if (!cpufreq_driver->boost_supported) +return -ENODEV ;This can't happen. sysfs directory is present only when we have boost supported.
I know, that we shall not look into the future. But this method will be used when somebody would like to enable boost from kernel. Let's say new governor or such :-).
I can remove this and add it later, but I think, that it is safer to add it straightaway.
Quoted 10 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1938
Quoted 4 lines
drivers/cpufreq/cpufreq.c +3
-0+if (cpufreq_boost_enabled != state) { +if (cpufreq_driver->set_boost_freq) { + ret = cpufreq_driver->set_boost_freq (state);I thought this routine was for setting boost frequency and not for enabling boost feature. If boost has to be enabled separately then this routine must take care of it while setting freq.
So, in other words, this must not be called here.
This function explicitly follows current logic of acpi-cpufreq.c.
I would like to avoid modifying legacy/working code as much as possible (especially when I hadn't yet received any feedback about acpi-cpufreq.c file changes).
Quoted 12 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1947
Quoted 11 lines
drivers/cpufreq/cpufreq.c +2
-0+if (ret) { + pr_err("%s: BOOST cannot enable(%d)\n",
drivers/cpufreq/cpufreq.c +7
-0+ __func__, ret); +return ret; + } + } + +for_each_possible_cpu (cpu) { + policy =cpufreq_cpu_get (cpu);
Quoted 2 lines
In case this code is required, it would make more sense to keep list of all available policies, which we can iterate through.
Maybe I don't get the big picture, but why we cannot iterate through possible CPUs? At least one shall have valid policy and freq_table combination.
I've already proposed list of all policies (at v1), but we decided to abandon this idea.
In which way list is better than iteration through all possible per-cpu variables, which store policies?
Quoted 16 lines
Quoted 5 lines
+
freq_table=cpufreq_frequency_get_table(cpu);drivers/cpufreq/cpufreq.c +2
-0+if (policy && freq_table) { +Quoted 7 lines
write_lock_irqsave(&cpufreq_driver_lock, flags); +
cpufreq_frequency_table_cpuinfo(policy,
+freq_table,
+
state);We obviously don't need the last param to this routine and so bunch of changes you did in this patch.
Quoted 2 lines
cpufreq_frequency_table_cpuinfo()can itself check if boost is enabled or not.
Yes, you are right. We can check if boost is supported and enabled inside this function.
Quoted 10 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1958
Quoted 7 lines
drivers/cpufreq/cpufreq.c +2
-0+ cpufreq_boost_enabled = state; +write_unlock_irqrestore(&cpufreq_driver_lock,
drivers/cpufreq/cpufreq.c +3
-0+ flags); + } + }I am not sure if this is required at all. Or what complications can be there when we update max/min on the fly here.
Correct me if I'm wrong, but I'm using scripts for tests which run simultaneously and enables/disables boost feature. I don't recall if there is a lock at sysfs, which would prevent from simultaneous write to the "boost" sysfs attribute.
I will doubble check that.
Quoted 12 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1967
Quoted 10 lines
drivers/cpufreq/cpufreq.c +9
-0+ } + +pr_debug ("%s: cpufreq BOOST %s\n" , __func__, + state ?"enabled" :"disabled" ); + +return 0 ; +} + +int cpufreq_boost_state (void )s/cpufreq_boost_state/cpufreq_boost_enabled
OK.
Quoted 98 lines
drivers/cpufreq/cpufreq.c
Quoted 3 lines
drivers/cpufreq/cpufreq.c +2
-0+{ +return cpufreq_boost_enabled;s/cpufreq_boost_enabled/boost_enabled
Quoted 35 lines
drivers/cpufreq/cpufreq.c +3
-0+} + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER *
*********************************************************************/drivers/cpufreq/cpufreq.c +9
-0@@ -1934,6 +2008,15 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); +if (cpufreq_driver->boost_supported) { + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { + pr_err("%s: cannot register global boost sysfs file\n", + __func__); + goto err_null_driver; + } + } + ret =subsys_interface_register (&cpufreq_interface);if (ret)goto err_null_driver;drivers/cpufreq/cpufreq.c +4
-0@@ -1990,6 +2073,10 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) pr_debug("unregistering driver %s\n", driver->name);subsys_interface_unregister (&cpufreq_interface); + +if (cpufreq_driver->boost_supported) +cpufreq_sysfs_remove_file (&(boost.attr)); +unregister_hotcpu_notifier (&cpufreq_cpu_notifier);Quoted 1 line
write_lock_irqsave(&cpufreq_driver_lock, flags);This part looked good :)
Quoted 48 lines
(quoted diff) +0
-0
b/drivers/cpufreq/freq_table.cindex d7a7966..f1a4d785 100644drivers/cpufreq/freq_table.c +2
-1@@ -21,7 +21,8 @@*********************************************************************/ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, -struct cpufreq_frequency_table *table) + struct cpufreq_frequency_table *table, + int boost) {unsigned int min_freq = ~0; unsigned int max_freq = 0;drivers/cpufreq/freq_table.c +0
-0@@ -31,9 +32,11 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, unsigned int freq = table[i].frequency;if (freq ==CPUFREQ_ENTRY_INVALID ) { pr_debug("table entry %u is invalid,skipping\n", i); -
continue; }drivers/cpufreq/freq_table.c +3
-0+if (!boost && table[i].index ==CPUFREQ_BOOST_FREQ ) +continue ; +pr_debug ("table entry %u: %u kHz, %u index\n" , i, freq, table[i].index);if (freq < min_freq)@@ -171,7 +174,8 @@ static DEFINE_PER_CPU(struct
cpufreq_frequency_table*,cpufreq_show_table); /**
*show_available_freqs- show available frequencies for the
specified CPU */
-staticssize_tshow_available_freqs(struct cpufreq_policy *policy, char *buf)+staticssize_tshow_available_freqs(structcpufreq_policy*policy, char *buf,drivers/cpufreq/freq_table.c +1
-0+ int show_boost) {unsigned int i =0 ;unsigned int cpu = policy->cpu;@@ -186,22 +190,42 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0;(table[i].frequency !=
CPUFREQ_TABLE_END); i++) { if (table[i].frequency ==CPUFREQ_ENTRY_INVALID) continue;
+ if (show_boost&& table[i].index !=CPUFREQ_BOOST_FREQ)drivers/cpufreq/freq_table.c +2
-0+continue ; + if (!show_boost && table[i].index ==Quoted 2 lines
CPUFREQ_BOOST_FREQ)
+ continue;Maybe, this instead of above two if statements:
Quoted 2 lines
if (
show_boost^ (table[i].index ==CPUFREQ_BOOST_FREQ))
continue
Yes. Good point.
Quoted 9 lines
Quoted 9 lines
count += sprintf(&buf[count], "%d ", table[i].frequency); } count += sprintf(&buf[count], "\n"); return count;-
}
Quoted 11 lines
Quoted 9 lines
drivers/cpufreq/freq_table.c +2
-6-struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { - .attr = { .name ="scaling_available_frequencies" , - .mode =0444 , - }, - .show = show_available_freqs, -}; +/** +* show_scaling_available_frequencies - show normal boost frequencies for
s/boost /
Ok.
Quoted 50 lines
Quoted 50 lines
+ * the specified CPU
+ */
+staticssize_tscaling_available_frequencies_show(structcpufreq_policy*policy,drivers/cpufreq/freq_table.c +7
-0+ char *buf) +{ +return show_available_freqs (policy, buf,0 ); +} +cpufreq_attr_available_freq (scaling_available);EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_available_freqs); +/** +* show_available_boost_freqs - show available boost frequencies for
+ * the specified CPU
+ */
+staticssize_tscaling_boost_frequencies_show(structcpufreq_policy*policy,drivers/cpufreq/freq_table.c +7
-0+ char *buf) +{ +return show_available_freqs (policy, buf,1 ); +} +cpufreq_attr_available_freq (scaling_boost); +EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_boost_freqs); +/* * if you use these, you must assure that the frequency table is valid
* all the time betweenget_attrandput_attr!include/linux/cpufreq.h +4
-0@@ -266,6 +266,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_supported; +int (*set_boost_freq) (int state); };/* flags */ @@ -318,6 +322,10 @@ __ATTR(_name, _perm, show_##_name, NULL)static struct freq_attr _name = \ __ATTR(_name, 0644, show_##_name, store_##_name)
Quoted 6 lines
include/linux/cpufreq.h __ATTR(_name, _perm, show_##_name, NULL) · line 327
Quoted 3 lines
include/linux/cpufreq.h +3
-0+#define cpufreq_attr_available_freq (_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies)What is this doing in
cpufreq.h? It will only be used byfreq_table.cfile.
I wanted to add those #defines to the place where other similar ones are placed.
I can put it to freq_table.c.
Quoted 6 lines
Again, I couldn't see how boost freqs are getting used? You have probably made them part of normal freq range here and so they might be used during normal operations. But we wanted it to be used only when we have few cpus on... etc.. Where is that logic?
The logic is as follow:
- cpufreq_driver exports .attr field. When driver supports boost then two attributes are exported (even when boost is not enabled, but supported):
- scaling_available_frequencies (only normal frequencies - this attribute is unchanged)
- scaling_boost_frequencies - list possible boost frequencies.
When boost is not supported - then only scaling_available_frequencies is exported (as it is done now).
Please refer to patch 3/3.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 8 lines · Lukasz Majewski
Quoted 7 lines · Viresh Kumar
Quoted 4 lines · Lukasz Majewski
drivers/cpufreq/cpufreq.c +3
-0+int cpufreq_boost_trigger_state(int state) +{ +if (!cpufreq_driver->boost_supported) +return -ENODEV ;
Quoted 6 lines
Quoted 2 lines
This can't happen. sysfs directory is present only when we have boost supported.
I know, that we shall not look into the future. But this method will be used when somebody would like to enable boost from kernel. Let's say new governor or such :-).
We don't know if that would be acceptable or not as of now.
Quoted 2 lines
I can remove this and add it later, but I think, that it is safer to add it straightaway.
Remove it for now.
Quoted 9 lines
Quoted 9 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1938
Quoted 4 lines
drivers/cpufreq/cpufreq.c +3
-0+if (cpufreq_boost_enabled != state) { +if (cpufreq_driver->set_boost_freq) { + ret = cpufreq_driver->set_boost_freq (state);I thought this routine was for setting boost frequency and not for enabling boost feature. If boost has to be enabled separately then this routine must take care of it while setting freq.
Quoted 7 lines
Quoted 1 line
So, in other words, this must not be called here.
This function explicitly follows current logic of
acpi-cpufreq.c.I would like to avoid modifying legacy/working code as much as possible (especially when I hadn't yet received any feedback about
acpi-cpufreq.cfile changes).
Hmm.. I saw that code now. You are talking about: boost_set_msrs ??
So, this function has nothing to do with set_boost_freq() but enable_boost(). Rename your function similarly and keep this code.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
(quoted diff) +2
-0+ if (ret) { + pr_err("%s: BOOST cannot enable(%d)\n",
drivers/cpufreq/cpufreq.c +7
-0+ __func__, ret); +return ret; + } + } + +for_each_possible_cpu (cpu) { + policy =cpufreq_cpu_get (cpu);
Quoted 6 lines
Quoted 2 lines
In case this code is required, it would make more sense to keep list of all available policies, which we can iterate through.
Maybe I don't get the big picture, but why we cannot iterate through possible CPUs? At least one shall have valid policy and
freq_tablecombination.
Many cpus share same policy structure and so iterating over all of them isn't a very good idea. Either keep a mask of cpus already iterated, copy policy->cpus to it on each iteration. If a cpu is already done skip loop for it.
OR keep a list of policies. I would prefer the later (do it in a separate patch), as this can be used later too.
Quoted 2 lines
I've already proposed list of all policies (at v1), but we decided to abandon this idea.
I don't remember why it was there but reason wasn't good enough to keep it.
Quoted 9 lines
Quoted 2 lines
I am not sure if this is required at all. Or what complications can be there when we update max/min on the fly here.
Correct me if I'm wrong, but I'm using scripts for tests which run simultaneously and enables/disables boost feature. I don't recall if there is a lock at sysfs, which would prevent from simultaneous write to the "boost" sysfs attribute.
I will doubble check that.
It isn't about a crash but how cpufreq subsystem works. I will think over it later too, for now you can keep it.
Quoted 4 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+{ + return cpufreq_boost_enabled;s/cpufreq_boost_enabled/boost_enabled
??
Quoted 11 lines
Quoted 10 lines
include/linux/cpufreq.h __ATTR(_name, _perm, show_##_name, NULL) · line 327
Quoted 7 lines
include/linux/cpufreq.h +3
-0@@ -318,6 +322,10 @@ __ATTR(_name, _perm, show_##_name, NULL)static struct freq_attr _name = \ __ATTR(_name, 0644, show_##_name, store_##_name) +#define cpufreq_attr_available_freq (_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies)What is this doing in
cpufreq.h? It will only be used byfreq_table.cfile.
Quoted 2 lines
I wanted to add those #defines to the place where other similar ones are placed.
That's not how these or any other declaration should be placed. By adding these to cpufreq.h, you are inviting other parts of kernel to use them. Which we don't want.
Quoted 1 line
I can put it to
freq_table.c.
Thanks.
Quoted 13 lines
Quoted 4 lines
Again, I couldn't see how boost freqs are getting used? You have probably made them part of normal freq range here and so they might be used during normal operations. But we wanted it to be used only when we have few cpus on... etc.. Where is that logic?
The logic is as follow:
-cpufreq_driverexports .attr field. When driver supports boost then two attributes are exported (even when boost is not enabled, but supported):
-scaling_available_frequencies(only normal frequencies - this attribute is unchanged)
-scaling_boost_frequencies- list possible boost frequencies.
Quoted 2 lines
When boost is not supported - then only
scaling_available_frequenciesis exported (as it is done now).
You are missing the whole point behind keeping this patchset. Its not about how to expose boost freqs to sysfs (that's what you are talking about) but to use these frequencies on the fly. Some part of kernel code would be setting these frequencies in real hardware. Who will set these frequencies? On what basis? How do we ensure we don't burn your chip?
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 17 lines · Viresh Kumar
Quoted 9 lines · Lukasz Majewski
Quoted 8 lines · Viresh Kumar
Quoted 4 lines · Lukasz Majewski
drivers/cpufreq/cpufreq.c +3
-0+int cpufreq_boost_trigger_state(int state) +{ +if (!cpufreq_driver->boost_supported) +return -ENODEV ;Quoted 6 lines
Quoted 2 lines
This can't happen. sysfs directory is present only when we have boost supported.
I know, that we shall not look into the future. But this method will be used when somebody would like to enable boost from kernel. Let's say new governor or such :-).
Quoted 6 lines
We don't know if that would be acceptable or not as of now.
Quoted 2 lines
I can remove this and add it later, but I think, that it is safer to add it straightaway.
Remove it for now.
Ok.
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Quoted 6 lines
drivers/cpufreq/cpufreq.c +3
-0+if (cpufreq_boost_enabled != state) { +if (cpufreq_driver->set_boost_freq) { + ret =
cpufreq_driver->set_boost_freq(state);Quoted 5 lines
I thought this routine was for setting boost frequency and not for enabling boost feature. If boost has to be enabled separately then this routine must take care of it while setting freq.
So, in other words, this must not be called here.
This function explicitly follows current logic of
acpi-cpufreq.c.
Quoted 8 lines
Quoted 3 lines
I would like to avoid modifying legacy/working code as much as possible (especially when I hadn't yet received any feedback about
acpi-cpufreq.cfile changes).Hmm.. I saw that code now. You are talking about:
boost_set_msrs??So, this function has nothing to do with
set_boost_freq()butenable_boost(). Rename your function similarly and keep this code.
Ok.
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1947
Quoted 11 lines
(quoted diff) +2
-0+ if (ret) { + pr_err("%s: BOOST cannot enable(%d)\n",
drivers/cpufreq/cpufreq.c +7
-0+ __func__, ret); +return ret; + } + } + +for_each_possible_cpu (cpu) { + policy =cpufreq_cpu_get (cpu);In case this code is required, it would make more sense to keep list of all available policies, which we can iterate through.
Quoted 8 lines
Quoted 3 lines
Maybe I don't get the big picture, but why we cannot iterate through possible CPUs? At least one shall have valid policy and
freq_tablecombination.Many cpus share same policy structure and so iterating over all of them isn't a very good idea. Either keep a mask of cpus already iterated, copy
policy->cpusto it on each iteration. If a cpu is already done skip loop for it.
This is the situation, which I wanted to avoid. Policy has the policy->cpus mask already implemented, but we don't know how/where to hook to them (one solution would be to start from cpu0, but for some reason I'm reluctant to do it in this way).
Quoted 3 lines
OR keep a list of policies. I would prefer the later (do it in a separate patch), as this can be used later too.
I will declare a boost_policy list at cpufreq.c. Then I will add policy to it, when cpufreq_add_dev() is called.
Quoted 6 lines
Quoted 3 lines
I've already proposed list of all policies (at v1), but we decided to abandon this idea.
I don't remember why it was there but reason wasn't good enough to keep it.
:-). Lets try with list.
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
I am not sure if this is required at all. Or what complications can be there when we update max/min on the fly here.
Correct me if I'm wrong, but I'm using scripts for tests which run simultaneously and enables/disables boost feature. I don't recall if there is a lock at sysfs, which would prevent from simultaneous write to the "boost" sysfs attribute.
Quoted 4 lines
Quoted 1 line
I will doubble check that.
It isn't about a crash but how cpufreq subsystem works. I will think over it later too, for now you can keep it.
OK.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+{ + return cpufreq_boost_enabled;s/cpufreq_boost_enabled/boost_enabled
??
I will change the name.
Quoted 15 lines
Quoted 12 lines
Quoted 11 lines
include/linux/cpufreq.h __ATTR(_name, _perm, show_##_name, NULL) · line 327
Quoted 8 lines
include/linux/cpufreq.h +3
-0@@ -318,6 +322,10 @@ __ATTR(_name, _perm, show_##_name, NULL)static struct freq_attr _name = \ __ATTR(_name, 0644, show_##_name, store_##_name) +#define cpufreq_attr_available_freq (_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies)What is this doing in
cpufreq.h? It will only be used byfreq_table.cfile.Quoted 2 lines
I wanted to add those #defines to the place where other similar ones are placed.
Quoted 7 lines
That's not how these or any other declaration should be placed. By adding these to
cpufreq.h, you are inviting other parts of kernel to use them. Which we don't want.Quoted 1 line
I can put it to
freq_table.c.Thanks.
Ok. I will keep the code local.
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Again, I couldn't see how boost freqs are getting used? You have probably made them part of normal freq range here and so they might be used during normal operations. But we wanted it to be used only when we have few cpus on... etc.. Where is that logic?
The logic is as follow:
-cpufreq_driverexports .attr field. When driver supports boost then two attributes are exported (even when boost is not enabled, but supported):
-scaling_available_frequencies(only normal frequencies -
this attribute is unchanged)
-scaling_boost_frequencies- list possible boost
frequencies.
Quoted 6 lines
Quoted 2 lines
When boost is not supported - then only
scaling_available_frequenciesis exported (as it is done now).You are missing the whole point behind keeping this patchset. Its not about how to expose boost freqs to sysfs (that's what you are talking about) but to use these frequencies on the fly.
Two separate things:
1. I think, that scaling_available_frequencies [*] attribute has to stay unchanged (this is how userspace sees the API). Linus would we very unhappy :-) if we had changed public API.
x86 guys, please correct me, but I think that [*] will be not changed (expanded) when Intel's HW boost is enabled at acpi-cpufreq.c code.
The scaling_boost_frequencies is only visible when driver (and probably soc maintainer) is ready to handle boosting. It shows over clocked frequencies.
2. How we would control boost?
- To enable this you must mark IDs for some freqs as CPUFREQ_BOOST_FREQ.
- The cpufreq_boost.boost_supported flag needs to be true (set at cpufreq driver code)
- One needs to enable boosting by sysfs or call cpufreq_boost_trigger_state(1); The latter will not work when cpufreq_driver->boost_supported is not set.
I assume that when somebody takes those three above steps, then he is aware that boost is working on his machine.
How one can control the boost? I'm now (on my setup) using thermal subsystem. I set proper trip points and when one of them is met, then boost is disabled. Moreover the thermal governor (stepwise) also reduces frequency.
It works stable with v3.10 (with 3.8 there were some bugs - now they are fixed).
The core acpi-cpufreq.c code hadn't been changed by me, so I assume that it will work as before.
Quoted 3 lines
Some part of kernel
code would be setting these frequencies in real hardware. Who will set these frequencies?
Those freqs are set by ->target() callback (when allowed)
Quoted 2 lines
On what basis? How do we ensure we don't
burn your chip?
Thermal subsystem is a good example here. Another may be a governor, or even scheduler.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 11 lines · Lukasz Majewski
Quoted 4 lines · Viresh Kumar
Many cpus share same policy structure and so iterating over all of them isn't a very good idea. Either keep a mask of cpus already iterated, copy
policy->cpusto it on each iteration. If a cpu is already done skip loop for it.This is the situation, which I wanted to avoid. Policy has the
policy->cpusmask already implemented, but we don't know how/where to hook to them (one solution would be to start from cpu0, but for some reason I'm reluctant to do it in this way).
We could have started from any cpu. Result and performance would have been same.
Quoted 5 lines
Quoted 2 lines
OR keep a list of policies. I would prefer the later (do it in a separate patch), as this can be used later too.
I will declare a
boost_policylist atcpufreq.c. Then I will add policy to it, whencpufreq_add_dev()is called.
This list doesn't have anything to do with boost. Its just a list of all policies.
Quoted 21 lines
Quoted 14 lines
Quoted 14 lines
Quoted 4 lines
Again, I couldn't see how boost freqs are getting used? You have probably made them part of normal freq range here and so they might be used during normal operations. But we wanted it to be used only when we have few cpus on... etc.. Where is that logic?
The logic is as follow:
-cpufreq_driverexports .attr field. When driver supports boost then two attributes are exported (even when boost is not enabled, but supported):
-scaling_available_frequencies(only normal frequencies -
this attribute is unchanged)
-scaling_boost_frequencies- list possible boost
frequencies.Quoted 6 lines
Quoted 2 lines
When boost is not supported - then only
scaling_available_frequenciesis exported (as it is done now).You are missing the whole point behind keeping this patchset. Its not about how to expose boost freqs to sysfs (that's what you are talking about) but to use these frequencies on the fly.
Quoted 5 lines
Two separate things:
1. I think, that
scaling_available_frequencies[*] attribute has to stay unchanged (this is how userspace sees the API). Linus would we very unhappy :-) if we had changed public API.
I never asked to modify it. :)
Quoted 7 lines
x86 guys, please correct me, but I think that [*] will be not changed (expanded) when Intel's HW boost is enabled at
acpi-cpufreq.ccode.The
scaling_boost_frequenciesis only visible when driver (and probably soc maintainer) is ready to handle boosting. It shows over clocked frequencies.
Correct.
Quoted 11 lines
2. How we would control boost?
- To enable this you must mark IDs for some freqs asCPUFREQ_BOOST_FREQ.
- The cpufreq_boost.boost_supported flag needs to be true (set at cpufreq driver code)
- One needs to enable boosting by sysfs or callcpufreq_boost_trigger_state(1); The latter will not work whencpufreq_driver->boost_supportedis not set.I assume that when somebody takes those three above steps, then he is aware that boost is working on his machine.
All good until now.
Quoted 11 lines
How one can control the boost? I'm now (on my setup) using thermal subsystem. I set proper trip points and when one of them is met, then boost is disabled. Moreover the thermal governor (stepwise) also reduces frequency.
It works stable with v3.10 (with 3.8 there were some bugs - now they are fixed).
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.
That should adapt your patch in your patchset.
Quoted 5 lines
Quoted 3 lines
Some part of kernel
code would be setting these frequencies in real hardware. Who will set these frequencies?Those freqs are set by ->target() callback (when allowed)
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel. Userspace can't control when to run on boost freqs.
Quoted 5 lines
Quoted 2 lines
On what basis? How do we ensure we don't
burn your chip?Thermal subsystem is a good example here. Another may be a governor, or even scheduler.
So, you are enabling boost from sysfs when your thermal framework says, you can do it?
That's not going to work. There should be something inside kernel to take care of this stuff. Otherwise a user may switch on boost accidentally and may burn his chip.
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 8 lines · Viresh Kumar
Quoted 7 lines · Lukasz Majewski
Quoted 4 lines · Viresh Kumar
Many cpus share same policy structure and so iterating over all of them isn't a very good idea. Either keep a mask of cpus already iterated, copy
policy->cpusto it on each iteration. If a cpu is already done skip loop for it.
Quoted 7 lines
Quoted 4 lines
This is the situation, which I wanted to avoid. Policy has the
policy->cpusmask already implemented, but we don't know how/where to hook to them (one solution would be to start from cpu0, but for some reason I'm reluctant to do it in this way).We could have started from any cpu. Result and performance would have been same.
Yes. But I don't want to hardcode anything. Especially starting CPU number.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
OR keep a list of policies. I would prefer the later (do it in a separate patch), as this can be used later too.
I will declare a
boost_policylist atcpufreq.c. Then I will add policy to it, whencpufreq_add_dev()is called.This list doesn't have anything to do with boost. Its just a list of all policies.
Ok, I see.
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 15 lines
Quoted 5 lines
Again, I couldn't see how boost freqs are getting used? You have probably made them part of normal freq range here and so they might be used during normal operations. But we wanted it to be used only when we have few cpus on... etc.. Where is that logic?
The logic is as follow:
-cpufreq_driverexports .attr field. When driver supports boost then two attributes are exported (even when boost is not enabled, but supported):
-scaling_available_frequencies(only normal frequencies
- this attribute is unchanged)
-scaling_boost_frequencies- list possible boost
frequencies.Quoted 2 lines
When boost is not supported - then only
scaling_available_frequenciesis exported (as it is done now).You are missing the whole point behind keeping this patchset. Its not about how to expose boost freqs to sysfs (that's what you are talking about) but to use these frequencies on the fly.
Quoted 7 lines
Quoted 5 lines
Two separate things:
1. I think, that
scaling_available_frequencies[*] attribute has to stay unchanged (this is how userspace sees the API). Linus would we very unhappy :-) if we had changed public API.I never asked to modify it. :)
:-)
Quoted 10 lines
Quoted 8 lines
x86 guys, please correct me, but I think that [*] will be not changed (expanded) when Intel's HW boost is enabled at
acpi-cpufreq.ccode.The
scaling_boost_frequenciesis only visible when driver (and probably soc maintainer) is ready to handle boosting. It shows
over clocked frequencies.Correct.
Ok.
Quoted 10 lines
Quoted 10 lines
2. How we would control boost?
- To enable this you must mark IDs for some freqs asCPUFREQ_BOOST_FREQ.
- The cpufreq_boost.boost_supported flag needs to be true (set at cpufreq driver code)
- One needs to enable boosting by sysfs or callcpufreq_boost_trigger_state(1); The latter will not work whencpufreq_driver->boost_supportedis not set.
Quoted 4 lines
Quoted 2 lines
I assume that when somebody takes those three above steps, then he is aware that boost is working on his machine.
All good until now.
Ok.
Quoted 6 lines
Quoted 6 lines
How one can control the boost? I'm now (on my setup) using thermal subsystem. I set proper trip points and when one of them is met, then boost is disabled. Moreover the thermal governor (stepwise) also reduces frequency.
Quoted 14 lines
Quoted 6 lines
It works stable with v3.10 (with 3.8 there were some bugs - now they are fixed).
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.That should adapt your patch in your patchset.
Quoted 5 lines
Quoted 3 lines
Some part of kernel
code would be setting these frequencies in real hardware. Who will set these frequencies?Those freqs are set by ->target() callback (when allowed)
The ->target() [*] is called when governor calls it. I didn't change any of this behaviour.
Quoted 3 lines
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel.
From sysfs I just enable the boost. I do not order from userpace the cpufreq to run with a particular (boosted) frequency.
When I enable boost - I ask (politely) the cpufreq core to reevaluate policies and when applicable increase policy->max.
Then governor can use this new frequencies for normal operation.
Quoted 2 lines
Userspace can't control when to run
on boost freqs.
The control, if boost frequency shall be used or not, is done by governor when load is appropriate.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
On what basis? How do we ensure we don't
burn your chip?Thermal subsystem is a good example here. Another may be a governor, or even scheduler.
So, you are enabling boost from sysfs when your thermal framework says, you can do it?
No. I'm enabling boost from sysfs (modify policies). This does not mean that boost frequency is run.
If governor decides, that it shall use boost freq - then it will use it.
When during heavy workload (and running boost freq), the trip point for thermal is being passed, the boost shall be disabled. Moreover stepwise will also reduce frequency with which SoC runs.
Quoted 4 lines
That's not going to work. There should be something inside kernel to take care of this stuff. Otherwise a user may switch on boost accidentally and may burn his chip.
User can by mistake enable boost. But then she/he needs to load SoC to the maximum (to enable policy->max). After heating up the SoC - the thermal goes in and disables boost and reduces frequency to cool down the device.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 2 lines · Lukasz Majewski
Yes. But I don't want to hardcode anything. Especially starting CPU number.
There is nothing wrong with it. for_each_online_cpu() is good enough on these cases.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
How one can control the boost? I'm now (on my setup) using thermal subsystem. I set proper trip points and when one of them is met, then boost is disabled. Moreover the thermal governor (stepwise) also reduces frequency.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
It works stable with v3.10 (with 3.8 there were some bugs - now they are fixed).
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.That should adapt your patch in your patchset.
??
Quoted 10 lines
Quoted 2 lines
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel.
From sysfs I just enable the boost. I do not order from userpace the cpufreq to run with a particular (boosted) frequency.
When I enable boost - I ask (politely) the cpufreq core to reevaluate policies and when applicable increase
policy->max.Then governor can use this new frequencies for normal operation.
So, with your current patchset in, ondemand or conservative governors will start using boost frequencies. Which might burn your chip.
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 6 lines · Viresh Kumar
Quoted 2 lines · Lukasz Majewski
Yes. But I don't want to hardcode anything. Especially starting CPU number.
There is nothing wrong with it.
for_each_online_cpu()is good enough on these cases.
I've already changed this code to use list of policies.
I will send this at v4.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
How one can control the boost? I'm now (on my setup) using thermal subsystem. I set proper trip points and when one of them is met, then boost is disabled. Moreover the thermal governor (stepwise) also reduces frequency.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
It works stable with v3.10 (with 3.8 there were some bugs - now they are fixed).
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.That should adapt your patch in your patchset.
Could you explain what do you mean?
Quoted 9 lines
??
Quoted 6 lines
Quoted 2 lines
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel.
From sysfs I just enable the boost. I do not order from userpace the cpufreq to run with a particular (boosted) frequency.
Quoted 7 lines
Quoted 4 lines
When I enable boost - I ask (politely) the cpufreq core to reevaluate policies and when applicable increase
policy->max.Then governor can use this new frequencies for normal operation.
So, with your current patchset in, ondemand or conservative governors will start using boost frequencies. Which might burn your chip.
Two scenarios:
1. Thermal framework is compiled in and enabled (for exynos/other SoC) -> trip point is reached -> boost is disabled -> frequency is reduced -> SoC is cooled down.
I think, that thermal framework is a good "safe valve" here.
2. Thermal framework is disabled and user has enabled boost and used ondemand / conservative governor.
Then execute gzip < /dev/urandom > /dev/null & (on all cores).
Then yes, chip will hang/burn due to crossing operating point (or burn).
What other means of control (despite of thermal) would you consider applicable?
What comes to my mind is modifying governor logic to count how long the CPU run with boost enabled and then disable it.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 7 lines · Lukasz Majewski
Quoted 4 lines · Viresh Kumar
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.That should adapt your patch in your patchset.
Could you explain what do you mean?
Update acpi-cpufreq to use your infrastructure.
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel.
From sysfs I just enable the boost. I do not order from userpace the cpufreq to run with a particular (boosted) frequency.
Quoted 7 lines
Quoted 4 lines
When I enable boost - I ask (politely) the cpufreq core to reevaluate policies and when applicable increase
policy->max.Then governor can use this new frequencies for normal operation.
So, with your current patchset in, ondemand or conservative governors will start using boost frequencies. Which might burn your chip.
Quoted 6 lines
Two scenarios:
1. Thermal framework is compiled in and enabled (for exynos/other SoC) -> trip point is reached -> boost is disabled -> frequency is reduced -> SoC is cooled down.I think, that thermal framework is a good "safe valve" here.
Even in this case boost shouldn't have been enabled by default. Its not only about burning the chip but more than that.
According to my understanding, boost was important for power saving. In case a high load can be managed by a single cpu with boost freqs, then its better to use boost freqs rather than bringing another cpu up.
Normally boost freqs are not so useful if we talk about powersaving, as their energy consumption is much higher with not so great impact on performance.
That's why when this thread started we talked about boost only when one cpu is operational. But with your patch all cores can use boost freq and thermal will come into picture just to save the chip.
That's wrong. This isn't why we invented boost here. Otherwise you just don't need boost feature at all for your SoC. Just make these freqs as available freqs and let thermal control policy->max/min to save your chip.
Quoted 4 lines
2. Thermal framework is disabled and user has enabled boost and used ondemand / conservative governor.
Then execute gzip </dev/urandom>/dev/null& (on all cores).
Quoted 8 lines
Then yes, chip will hang/burn due to crossing operating point (or burn).
What other means of control (despite of thermal) would you consider applicable?
What comes to my mind is modifying governor logic to count how long the CPU run with boost enabled and then disable it.
Its not about how long.. One cpu type can work longer with boost freq compared to other.
What we probably need is:
- Enabled boost from sysfs if required (now below steps will come into picture)
- See how many cpus are running, if only one then start using boost freqs
- Now thermal should be come into picture to save chip in case a single cpu running at boost can burn it out.
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 10 lines · Viresh Kumar
Quoted 7 lines · Lukasz Majewski
Quoted 4 lines · Viresh Kumar
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.That should adapt your patch in your patchset.
Could you explain what do you mean?
Update acpi-cpufreq to use your infrastructure.
Ach... It is already done, since I always post acpi related patch to the boost series :-).
Quoted 31 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel.
From sysfs I just enable the boost. I do not order from userpace the cpufreq to run with a particular (boosted) frequency.
Quoted 8 lines
Quoted 4 lines
When I enable boost - I ask (politely) the cpufreq core to reevaluate policies and when applicable increase
policy->max.Then governor can use this new frequencies for normal operation.
So, with your current patchset in, ondemand or conservative governors will start using boost frequencies. Which might burn your chip.
Quoted 6 lines
Two scenarios:
1. Thermal framework is compiled in and enabled (for exynos/other SoC) -> trip point is reached -> boost is disabled -> frequency is reduced -> SoC is cooled down.I think, that thermal framework is a good "safe valve" here.
Even in this case boost shouldn't have been enabled by default. Its not only about burning the chip but more than that.
According to my understanding, boost was important for power saving. In case a high load can be managed by a single cpu with boost freqs, then its better to use boost freqs rather than bringing another cpu up.
Quoted 7 lines
Normally boost freqs are not so useful if we talk about powersaving, as their energy consumption is much higher with not so great impact on performance.
That's why when this thread started we talked about boost only when one cpu is operational. But with your patch all cores can use boost freq and thermal will come into picture just to save the chip.
I agree here.
Quoted 5 lines
That's wrong. This isn't why we invented boost here. Otherwise you just don't need boost feature at all for your SoC. Just make these freqs as available freqs and let thermal control policy->max/min to save your chip.
Also I agree.
Quoted 15 lines
Quoted 9 lines
2. Thermal framework is disabled and user has enabled boost and used ondemand / conservative governor.
Then execute gzip </dev/urandom>/dev/null& (on all cores).Then yes, chip will hang/burn due to crossing operating point (or burn).
Quoted 5 lines
What other means of control (despite of thermal) would you consider applicable?
What comes to my mind is modifying governor logic to count how long the CPU run with boost enabled and then disable it.
Quoted 8 lines
Its not about how long.. One cpu type can work longer with boost freq compared to other.
What we probably need is:
- Enabled boost from sysfs if required (now below steps will come into picture)
- See how many cpus are running, if only one then start using boost freqs
You are right here.
I'd like to propose following solution:
1. For acpi (where boost_enable come into play) - do not consider number of active cpus (this is done in HW anyway)
2. For SW solution evaluate how many CPUs are running. If only one is running then allow enabling boost from sysfs.
But following situation is also possible: User enable boost when one core is only running and then for some reason other core is woken up. What shall be done then?
Shall we then disable boost immediately when cpufreq detects that more than one core is running? Or leave this situation to be handled by thermal subsystem?
As a side note:
Logic proposed at point 2, is already implemented at LAB (enable LAB only when one core is running and disable it when more than one come into play).
Quoted 2 lines
- Now thermal should be come into picture to save chip in case a single cpu running at boost can burn it out.
I will extent v4 to embrace code which switches off boost at thermal.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 11 lines · Lukasz Majewski
Quoted 8 lines · Viresh Kumar
Its not about how long.. One cpu type can work longer with boost freq compared to other.
What we probably need is:
- Enabled boost from sysfs if required (now below steps will come into picture)
- See how many cpus are running, if only one then start using boost freqs
Quoted 8 lines
You are right here.
I'd like to propose following solution:
1. For acpi (whereboost_enablecome into play) - do not consider number of active cpus (this is done in HW anyway)2. For SW solution evaluate how many CPUs are running. If only one is running then allow enabling boost from sysfs.
Looks fine.
Quoted 6 lines
But following situation is also possible: User enable boost when one core is only running and then for some reason other core is woken up. What shall be done then?
Shall we then disable boost immediately when cpufreq detects that more than one core is running? Or leave this situation to be handled by thermal subsystem?
Obviously disable boost ASAP. Every SoC might not have a thermal framework glue to do it.
Quoted 4 lines
As a side note:
Logic proposed at point 2, is already implemented at LAB (enable LAB only when one core is running and disable it when more than one come into play).
Hmm.. So, eventually that will go away now :)
Quoted 4 lines
Quoted 2 lines
- Now thermal should be come into picture to save chip in case a single cpu running at boost can burn it out.
I will extent v4 to embrace code which switches off boost at thermal.
Gud.
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 14 lines · Viresh Kumar
Quoted 13 lines · Lukasz Majewski
Quoted 8 lines · Viresh Kumar
Its not about how long.. One cpu type can work longer with boost freq compared to other.
What we probably need is:
- Enabled boost from sysfs if required (now below steps will come into picture)
- See how many cpus are running, if only one then start using boost freqsYou are right here.
Quoted 8 lines
Quoted 6 lines
I'd like to propose following solution:
1. For acpi (whereboost_enablecome into play) - do not consider number of active cpus (this is done in HW anyway)2. For SW solution evaluate how many CPUs are running. If only one is running then allow enabling boost from sysfs.
Looks fine.
Ok,
Quoted 10 lines
Quoted 7 lines
But following situation is also possible: User enable boost when one core is only running and then for some reason other core is woken up. What shall be done then?
Shall we then disable boost immediately when cpufreq detects that more than one core is running? Or leave this situation to be handled by thermal subsystem?Obviously disable boost ASAP. Every SoC might not have a thermal framework glue to do it.
Implementation of counting number of idle CPUs would impose extending the cpufreq core itself. Do you have any hints how this can be done in a neat way?
I suspect, that porting the LAB solution to the cpufreq core may be not easy. I think that the best place for it would be governor core code.
Quoted 7 lines
Quoted 5 lines
As a side note:
Logic proposed at point 2, is already implemented at LAB (enable LAB only when one core is running and disable it when more than one come into play).Hmm.. So, eventually that will go away now :)
But this is not the only functionality, which LAB posses :-).
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
- Now thermal should be come into picture to save chip in case a single cpu running at boost can burn it out.
I will extent v4 to embrace code which switches off boost at thermal.
Gud.
Ok.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
In reply to Viresh KumarQuoted 32 lines · Viresh Kumar
Quoted 7 lines · Lukasz Majewski
Quoted 4 lines · Viresh Kumar
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.That should adapt your patch in your patchset.
Could you explain what do you mean?
Update acpi-cpufreq to use your infrastructure.
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel.
From sysfs I just enable the boost. I do not order from userpace the cpufreq to run with a particular (boosted) frequency.
Quoted 7 lines
Quoted 4 lines
When I enable boost - I ask (politely) the cpufreq core to reevaluate policies and when applicable increase
policy->max.Then governor can use this new frequencies for normal operation.
So, with your current patchset in, ondemand or conservative governors will start using boost frequencies. Which might burn your chip.
Quoted 6 lines
Two scenarios:
1. Thermal framework is compiled in and enabled (for exynos/other SoC) -> trip point is reached -> boost is disabled -> frequency is reduced -> SoC is cooled down.I think, that thermal framework is a good "safe valve" here.
Quoted 7 lines
Even in this case boost shouldn't have been enabled by default. Its not only about burning the chip but more than that.
According to my understanding, boost was important for power saving. In case a high load can be managed by a single cpu with boost freqs, then its better to use boost freqs rather than bringing another cpu up.
Do you mean the 'boost' sysfs attribute or the 'turbo frequencies' concept?
Quoted 3 lines
Normally boost freqs are not so useful if we talk about powersaving, as their energy consumption is much higher with not so great impact on performance.
Er, er, please be careful here. The impact on performance may be sufficient for deep C-states to become relevant in some cases.
Quoted 3 lines
That's why when this thread started we talked about boost only when one cpu is operational. But with your patch all cores can use boost freq and thermal will come into picture just to save the chip.
Well, that's why on x86 turbo is controlled by hardware that takes care of keeping things within the chip's thermal limits.
Quoted 4 lines
That's wrong. This isn't why we invented boost here. Otherwise you just don't need boost feature at all for your SoC. Just make these freqs as available freqs and let thermal control policy->max/min to save your chip.
The 'boost' attribute added by acpi-cpufreq means "let the hardware use turbo frequencies".
I'd recommend you both to read Documentation/cpu-freq/boost.txt now. :-)
I think we can extend the meaning to "let turbo frequencies be used", but if we need software to play the role of the hardware's thermal control, we need to be very careful.
Quoted 13 lines
Quoted 4 lines
2. Thermal framework is disabled and user has enabled boost and used ondemand / conservative governor.
Then execute gzip </dev/urandom>/dev/null& (on all cores).Quoted 8 lines
Then yes, chip will hang/burn due to crossing operating point (or burn).
What other means of control (despite of thermal) would you consider applicable?
What comes to my mind is modifying governor logic to count how long the CPU run with boost enabled and then disable it.
Quoted 6 lines
Its not about how long.. One cpu type can work longer with boost freq compared to other.
What we probably need is:
- Enabled boost from sysfs if required (now below steps will come into picture)
This has to be compatible with the existing stuff.
Quoted 3 lines
- See how many cpus are running, if only one then start using boost freqs
- Now thermal should be come into picture to save chip in case a single cpu running at boost can burn it out.
I'd say there needs to be a separate controller/monitor for that that will know what the chip's thermal limit is and how that relates to how fast the CPU core(s) may run and for how much time. I'm not sure it is sufficient to "wait for thermal to kick in" here, because you may need to slow down things in advance (i.e. before thermal sensors tell you there's too much heat, because that may be too late already).
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 55 lines · Rafael J. Wysocki
Quoted 36 lines · Viresh Kumar
Quoted 7 lines · Lukasz Majewski
Quoted 4 lines · Viresh Kumar
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
The core
acpi-cpufreq.ccode hadn't been changed by me, so I assume that it will work as before.That should adapt your patch in your patchset.
Could you explain what do you mean?
Update acpi-cpufreq to use your infrastructure.
Quoted 17 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
From sysfs?? I thought we are going to have some automatic control of this stuff from inside kernel.
From sysfs I just enable the boost. I do not order from userpace the cpufreq to run with a particular (boosted) frequency.
When I enable boost - I ask (politely) the cpufreq core to reevaluate policies and when applicable increase
policy->max.Quoted 6 lines
Quoted 2 lines
Then governor can use this new frequencies for normal operation.
So, with your current patchset in, ondemand or conservative governors will start using boost frequencies. Which might burn your chip.
Quoted 6 lines
Two scenarios:
1. Thermal framework is compiled in and enabled (for exynos/other SoC) -> trip point is reached -> boost is disabled -> frequency is reduced -> SoC is cooled down.I think, that thermal framework is a good "safe valve" here.
Quoted 7 lines
Even in this case boost shouldn't have been enabled by default. Its not only about burning the chip but more than that.
According to my understanding, boost was important for power saving. In case a high load can be managed by a single cpu with boost freqs, then its better to use boost freqs rather than bringing another cpu up.
Do you mean the 'boost' sysfs attribute or the 'turbo frequencies' concept?
Quoted 3 lines
Normally boost freqs are not so useful if we talk about powersaving, as their energy consumption is much higher with not so great impact on performance.
Er, er, please be careful here. The impact on performance may be sufficient for deep C-states to become relevant in some cases.
Quoted 6 lines
Quoted 3 lines
That's why when this thread started we talked about boost only when one cpu is operational. But with your patch all cores can use boost freq and thermal will come into picture just to save the chip.
Well, that's why on x86 turbo is controlled by hardware that takes care of keeping things within the chip's thermal limits.
And this is the reason why I don't want to overly change acpi-cpufreq.c code. :-)
Quoted 8 lines
Quoted 5 lines
That's wrong. This isn't why we invented boost here. Otherwise you just don't need boost feature at all for your SoC. Just make these freqs as available freqs and let thermal control policy->max/min to save your chip.
The 'boost' attribute added by acpi-cpufreq means "let the hardware use turbo frequencies".
This is HW managed. We only enable the switch and then simply forget about it.
Quoted 3 lines
I'd recommend you both to read
Documentation/cpu-freq/boost.txtnow. :-)
According to the documentation:
"Reading the file is always supported, even if the processor does not support boosting. In this case the file will be read-only and always reads as "0""
Hmm, in the proposed patch set, the "boost" attribute is only exported when cpufreq driver sets boost_supported flag.
Quoted 33 lines
I think we can extend the meaning to "let turbo frequencies be used", but if we need software to play the role of the hardware's thermal control, we need to be very careful.
Quoted 14 lines
Quoted 8 lines
2. Thermal framework is disabled and user has enabled boost and used ondemand / conservative governor.
Then execute gzip </dev/urandom>/dev/null& (on all cores).Then yes, chip will hang/burn due to crossing operating point (or burn).
Quoted 5 lines
What other means of control (despite of thermal) would you consider applicable?
What comes to my mind is modifying governor logic to count how long the CPU run with boost enabled and then disable it.
Quoted 6 lines
Its not about how long.. One cpu type can work longer with boost freq compared to other.
What we probably need is:
- Enabled boost from sysfs if required (now below steps will come into picture)This has to be compatible with the existing stuff.
Quoted 4 lines
- See how many cpus are running, if only one then start using boost freqs
- Now thermal should be come into picture to save chip in case a single cpu running at boost can burn it out.
Quoted 6 lines
I'd say there needs to be a separate controller/monitor for that that will know what the chip's thermal limit is and how that relates to how fast the CPU core(s) may run and for how much time. I'm not sure it is sufficient to "wait for thermal to kick in" here, because you may need to slow down things in advance (i.e. before thermal sensors tell you there's too much heat, because that may be too late already).
I think that thermal subsystem shall be the second option to disable SW boosting.
The main control shall be done inside the cpufreq core. The idea to disable boost when more than one core is active is rational.
I'm going to implement this concept at v4.
Quoted 5 lines
Thanks,
Rafael
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
On Tue, 18 Jun 2013 15:44:56 +0200, Lukasz Majewski wrote:
Dear Viesh, Rafael,
Quoted 5 lines
Quoted 3 lines
I'd recommend you both to read
Documentation/cpu-freq/boost.txtnow. :-)
Quoted 7 lines
According to the documentation:
"Reading the file is always supported, even if the processor does not support boosting. In this case the file will be read-only and always reads as "0""Hmm, in the proposed patch set, the "boost" attribute is only exported when cpufreq driver sets
boost_supportedflag.
I would like to clarify the above issue.
When I've discussed with Viresh previous version of this patch, we have agreed, that "boost" sysfs attribute [*]:/sys/devices/system/cpu/cpufreq/boost
would be only visible when boost_supported flag is set at cpufreq driver.
When acpi-cpufreq driver doesn't support boost, the attribute [*] won't be exported at all. This contradicts the documentation and legacy acpi-cpufreq behaviour.
Since I'm affraid to break API (with all its consequences :-) ), I would like to be sure that this is OK, and thereof I'm allowed to rewrite documentation accordingly.
I simply need explicit permission from both maintainers :-).
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 8 lines · Lukasz Majewski
I would like to clarify the above issue.
When I've discussed with Viresh previous version of this patch, we have agreed, that "boost" sysfs attribute [*]:
/sys/devices/system/cpu/cpufreq/boostwould be only visible when
boost_supportedflag is set at cpufreq driver.
Yes.
Quoted 3 lines
When acpi-cpufreq driver doesn't support boost, the attribute [*] won't be exported at all. This contradicts the documentation and legacy acpi-cpufreq behaviour.
No they aren't contradictory. What the documentation meant was:
acpi-cpufreq driver is used by lots of different x86 processors. Now all processors might not support boost inside x86 also. And for them we will keep 'boost' file readonly. This is done by following statement
if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
boost_supported = true;
....
} else
global_boost.attr.mode = 0444;Documentation file doesn't talk about any other cpufreq driver, for them there is no concept like boost.
You need to preserve this functionality.
Quoted 5 lines
Since I'm affraid to break API (with all its consequences :-) ), I would like to be sure that this is OK, and thereof I'm allowed to rewrite documentation accordingly.
I simply need explicit permission from both maintainers :-).
For me its okay to rewrite documentation.
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 16 lines · Viresh Kumar
Quoted 8 lines · Lukasz Majewski
I would like to clarify the above issue.
When I've discussed with Viresh previous version of this patch, we have agreed, that "boost" sysfs attribute [*]:
/sys/devices/system/cpu/cpufreq/boostwould be only visible when
boost_supportedflag is set at cpufreq driver.Yes.
Quoted 3 lines
When acpi-cpufreq driver doesn't support boost, the attribute [*] won't be exported at all. This contradicts the documentation and legacy acpi-cpufreq behaviour.
Quoted 5 lines
No they aren't contradictory. What the documentation meant was:
acpi-cpufreq driver is used by lots of different x86 processors. Now all processors might not support boost inside x86 also. And for them we will keep 'boost' file readonly. This is done by following statement
Thanks for explanation.
Quoted 6 lines
if (boot_cpu_has(X86_FEATURE_CPB) ||
boot_cpu_has(X86_FEATURE_IDA)) { boost_supported = true;
....
} else
global_boost.attr.mode = 0444;Grrr.... So simple and obvious solution [1].
Quoted 5 lines
Documentation file doesn't talk about any other cpufreq driver, for them there is no concept like boost.
You need to preserve this functionality.
Yes the idea [1], solves problem with legacy API.
Quoted 8 lines
Quoted 6 lines
Since I'm affraid to break API (with all its consequences :-) ), I would like to be sure that this is OK, and thereof I'm allowed to rewrite documentation accordingly.
I simply need explicit permission from both maintainers :-).
For me its okay to rewrite documentation.
I will extent documentation about the SW managed boost.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
In reply to Lukasz MajewskiQuoted 9 lines · Lukasz Majewski
Quoted 5 lines · Rafael J. Wysocki
Quoted 1 line · Viresh Kumar
On 17 June 2013 19:21, Lukasz Majewski <[email protected]>
Well, that's why on x86 turbo is controlled by hardware that takes care of keeping things within the chip's thermal limits.
And this is the reason why I don't want to overly change
acpi-cpufreq.ccode. :-)
We need to keep both hardware/software boost features at the same place in core, they may behave differently though. That's why I wanted you to do that.
Quoted 5 lines
I think that thermal subsystem shall be the second option to disable SW boosting.
The main control shall be done inside the cpufreq core. The idea to disable boost when more than one core is active is rational.
But then, it might not be enough. A single core can make your SoC very hot.
Viresh Kumar
maintainerRe: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
In reply to Rafael J. WysockiQuoted 9 lines · Rafael J. Wysocki
Quoted 6 lines · Viresh Kumar
On 17 June 2013 19:21, Lukasz Majewski <[email protected]> wrote:
According to my understanding, boost was important for power saving. In case a high load can be managed by a single cpu with boost freqs, then its better to use boost freqs rather than bringing another cpu up.
Do you mean the 'boost' sysfs attribute or the 'turbo frequencies' concept?
I thought they are the. Probably not, but I am not sure about the difference.
Quoted 6 lines
Quoted 3 lines
Normally boost freqs are not so useful if we talk about powersaving, as their energy consumption is much higher with not so great impact on performance.
Er, er, please be careful here. The impact on performance may be sufficient for deep C-states to become relevant in some cases.
Hmm.
Quoted 6 lines
Quoted 3 lines
That's why when this thread started we talked about boost only when one cpu is operational. But with your patch all cores can use boost freq and thermal will come into picture just to save the chip.
Well, that's why on x86 turbo is controlled by hardware that takes care of keeping things within the chip's thermal limits.
Yeah.
Quoted 9 lines
Quoted 4 lines
That's wrong. This isn't why we invented boost here. Otherwise you just don't need boost feature at all for your SoC. Just make these freqs as available freqs and let thermal control policy->max/min to save your chip.
The 'boost' attribute added by acpi-cpufreq means "let the hardware use turbo frequencies".
I'd recommend you both to read
Documentation/cpu-freq/boost.txtnow. :-)
I did it now :)
Quoted 3 lines
I think we can extend the meaning to "let turbo frequencies be used", but if we need software to play the role of the hardware's thermal control, we need to be very careful.
Exactly. There are two variants now:
- Hardware boost: x86: Don't do any trick in software to prevent hardware from boosting... Let the hardware take control as it is today
- Software boost: The initial idea from Lukasz was about using boost only when one cpu is used. That's the impression I had in mind. And it looked sensible too to some extent. BUT there is a great chance that any mistake can burn chips, so we need to be extremely careful.
Quoted 5 lines
Quoted 3 lines
What we probably need is:
- Enabled boost from sysfs if required (now below steps will come into picture)This has to be compatible with the existing stuff.
Sure.
Quoted 10 lines
Quoted 3 lines
- See how many cpus are running, if only one then start using boost freqs
- Now thermal should be come into picture to save chip in case a single cpu running at boost can burn it out.I'd say there needs to be a separate controller/monitor for that that will know what the chip's thermal limit is and how that relates to how fast the CPU core(s) may run and for how much time. I'm not sure it is sufficient to "wait for thermal to kick in" here, because you may need to slow down things in advance (i.e. before thermal sensors tell you there's too much heat, because that may be too late already).
That's why I wasn't sure about software boosting initially. But at the same time a thermal sensor might be good enough. They just have to be programmed accordingly, so that they fire a bit in advance before things are out of control. :)
Re: [PATCH v3 1/3] cpufreq: Add boost frequency support in core
Quoted 8 lines · Viresh Kumar
Quoted 7 lines
I'd say there needs to be a separate controller/monitor for that that will know what the chip's thermal limit is and how that relates to how fast the CPU core(s) may run and for how much time. I'm not sure it is sufficient to "wait for thermal to kick in" here, because you may need to slow down things in advance (i.e. before thermal sensors tell you there's too much heat, because that may be too late already).
Quoted 4 lines
That's why I wasn't sure about software boosting initially. But at the same time a thermal sensor might be good enough. They just have to be programmed accordingly, so that they fire a bit in advance before things are out of control. :)
I think that thermal subsystem shall disable boost when SoC is heated up.
The problem is to guarantee, that thermal will be always enabled and correctly configured when software based boost is ready to run.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v3 2/3 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
In reply to Lukasz MajewskiThe Intel's hardware based boost solution driver has been changed to cooperate with common cpufreq boost framework.
The global sysfs boost attribute entry code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq code. This attribute is now only visible, when cpufreq driver supports it.
The boost supported global flag was replaced with the one defined at acpi's cpufreq driver.
The _store_boost() function has been redesigned to be used as set_boost_freq callback.
Changes for v2:
- Replace boost_enabled and boost_supported global flags with proper entries at struct cpufreq_driver.
- Removal of struct cpufreq_boost
Changes for v3:
- Bring back boost_enabled as a global flag
- Move boost_supported to cpufreq_driver structure
--- drivers/cpufreq/acpi-cpufreq.c | 60 ++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 40 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +20 -40
@@ -80,7 +80,7 @@ static struct acpi_processor_performance __percpu *acpi_perf_data;static struct cpufreq_driver acpi_cpufreq_driver;static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; +static bool boost_enabled;static struct msr __percpu *msrs;static bool boost_state (unsigned int cpu)
@@ -133,20 +133,10 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask)wrmsr_on_cpus (cpumask, msr_addr, msrs); } -static ssize_t _store_boost (const char *buf,size_t count) +static int _store_boost (int val) { -int ret; -unsigned long val =0 ; - -if (!boost_supported) -return -EINVAL ; - - ret =kstrtoul (buf,10 , &val); -if (ret || (val >1 )) -return -EINVAL ; -if ((val && boost_enabled) || (!val && !boost_enabled)) -return count; +return 0 ;get_online_cpus ();
@@ -157,30 +147,31 @@ static ssize_t _store_boost(const char *buf, size_t count) boost_enabled = val;pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" ); -return count; +return 0 ; } -static ssize_t store_global_boost (struct kobject *kobj,struct attribute *attr, -const char *buf,size_t count) +static ssize_t store_boost (const char *buf,size_t count) { -return _store_boost (buf, count); -} +int ret; +unsigned long val =0 ; -static ssize_t show_global_boost (struct kobject *kobj, -struct attribute *attr,char *buf) -{ -return sprintf (buf,"%u\n" , boost_enabled); -} +if (!acpi_cpufreq_driver.boost_supported) +return -EINVAL ; + + ret =kstrtoul (buf,10 , &val); +if (ret || (val >1 )) +return -EINVAL ; -static struct global_attr global_boost =__ATTR (boost,0644 , - show_global_boost, - store_global_boost); +_store_boost ((int ) val); + +return count; +}#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB static ssize_t store_cpb (struct cpufreq_policy *policy,const char *buf,size_t count) { -return _store_boost (buf, count); +return store_boost (buf, count); }static ssize_t show_cpb (struct cpufreq_policy *policy,char *buf)
@@ -930,8 +921,8 @@ static void __init acpi_cpufreq_boost_init(void)if (!msrs)return ; - boost_supported = true; boost_enabled =boost_state (0 ); + acpi_cpufreq_driver.boost_supported = true;get_online_cpus ();
@@ -941,22 +932,11 @@ static void __init acpi_cpufreq_boost_init(void)register_cpu_notifier (&boost_nb);put_online_cpus (); - }else - global_boost.attr.mode =0444 ; - -/* We create the boost file in any case, though for systems without -* hardware support it will be read-only and hardwired to return 0. -*/ -if (cpufreq_sysfs_create_file (&(global_boost.attr))) -pr_warn (PFX "could not register global boost sysfs file\n" ); -else -pr_debug ("registered global boost sysfs file\n" ); + } } static void __exit acpi_cpufreq_boost_exit(void) { -cpufreq_sysfs_remove_file (&(global_boost.attr)); -if (msrs) {unregister_cpu_notifier (&boost_nb);
Signature · 1 line
1.7.10.4
PATCH v3 3/3 cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
In reply to Lukasz MajewskiThe struct cpufreq_driver has been extended to embrace the information related to boost support.
When "boost_mode" device tree attribute is defined for a platform, the boost_supported flag is set. Moreover boost related attributes were exported.
Changes for v2:
- Removal of struct cpufreq_boost
- Removal of the CONFIG_CPU_FREQ_BOOST flag
- low_level_boost with valid address when boost is supported
Changes for v3:
- Remove low level boost code
- Move boost management code to cpufreq core code
- Use boost_supported flag to indicate if driver supports over clocking
--- drivers/cpufreq/exynos-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/cpufreq/exynos-cpufreq.c +4 -0
@@ -265,6 +265,7 @@ static int exynos_cpufreq_cpu_exit(struct cpufreq_policy *policy)static struct freq_attr *exynos_cpufreq_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, + &cpufreq_freq_attr_scaling_boost_freqs,NULL , };
@@ -360,6 +361,7 @@ static struct of_device_id exynos_cpufreq_of_match[] __initconst = {static int __init exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *node = pdev->dev.of_node;int ret = -EINVAL ; exynos_info =kzalloc (sizeof (struct exynos_dvfs_info ),GFP_KERNEL );
@@ -392,6 +394,8 @@ static int __init exynos_cpufreq_probe(struct platform_device *pdev) } locking_frequency =exynos_getspeed (0 ); +if (of_property_read_bool (node,"boost_mode" )) + exynos_driver.boost_supported =1 ;register_pm_notifier (&exynos_cpufreq_nb);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerQuoted 38 lines · Lukasz Majewski
arch/arm/mach-s3c24xx/cpufreq.c | 2 +- arch/powerpc/platforms/pasemi/cpufreq.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_32.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_64.c | 2 +- drivers/cpufreq/acpi-cpufreq.c | 62 +++++++----------- drivers/cpufreq/arm_big_little.c | 3 +- drivers/cpufreq/blackfin-cpufreq.c | 2 +- drivers/cpufreq/cpufreq-cpu0.c | 2 +- drivers/cpufreq/cpufreq.c | 87 ++++++++++++++++++++++++++ drivers/cpufreq/cris-artpec3-cpufreq.c | 2 +- drivers/cpufreq/cris-etraxfs-cpufreq.c | 2 +- drivers/cpufreq/davinci-cpufreq.c | 2 +- drivers/cpufreq/dbx500-cpufreq.c | 2 +- drivers/cpufreq/e_powersaver.c | 3 +- drivers/cpufreq/elanfreq.c | 2 +- drivers/cpufreq/exynos-cpufreq.c | 7 ++- drivers/cpufreq/exynos5440-cpufreq.c | 2 +- drivers/cpufreq/freq_table.c | 44 ++++++++++--- drivers/cpufreq/ia64-acpi-cpufreq.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 2 +- drivers/cpufreq/kirkwood-cpufreq.c | 3 +- drivers/cpufreq/longhaul.c | 2 +- drivers/cpufreq/loongson2_cpufreq.c | 2 +- drivers/cpufreq/maple-cpufreq.c | 2 +- drivers/cpufreq/omap-cpufreq.c | 2 +- drivers/cpufreq/p4-clockmod.c | 2 +- drivers/cpufreq/powernow-k6.c | 2 +- drivers/cpufreq/powernow-k7.c | 2 +- drivers/cpufreq/powernow-k8.c | 2 +- drivers/cpufreq/ppc_cbe_cpufreq.c | 2 +- drivers/cpufreq/pxa2xx-cpufreq.c | 4 +- drivers/cpufreq/pxa3xx-cpufreq.c | 2 +- drivers/cpufreq/s3c2416-cpufreq.c | 2 +- drivers/cpufreq/s3c64xx-cpufreq.c | 2 +- drivers/cpufreq/s5pv210-cpufreq.c | 2 +- drivers/cpufreq/sc520_freq.c | 2 +- drivers/cpufreq/sh-cpufreq.c | 2 +- drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +-
Quoted 8 lines
drivers/cpufreq/sparc-us3-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 3 +- drivers/cpufreq/speedstep-centrino.c | 2 +- drivers/cpufreq/speedstep-ich.c | 2 +- drivers/cpufreq/speedstep-smi.c | 2 +- drivers/cpufreq/tegra-cpufreq.c | 4 +- include/linux/cpufreq.h | 18 +++++- 45 files changed, 211 insertions(+), 95 deletions(-)
Wow!! I am shocked to see these many files getting updated :)
Quoted 49 lines · Viresh Kumar
Quoted 46 lines · Lukasz Majewski
arch/arm/mach-s3c24xx/cpufreq.c | 2 +- arch/powerpc/platforms/pasemi/cpufreq.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_32.c | 2 +- arch/powerpc/platforms/powermac/cpufreq_64.c | 2 +- drivers/cpufreq/acpi-cpufreq.c | 62 +++++++----------- drivers/cpufreq/arm_big_little.c | 3 +- drivers/cpufreq/blackfin-cpufreq.c | 2 +- drivers/cpufreq/cpufreq-cpu0.c | 2 +- drivers/cpufreq/cpufreq.c | 87 ++++++++++++++++++++++++++ drivers/cpufreq/cris-artpec3-cpufreq.c | 2 +- drivers/cpufreq/cris-etraxfs-cpufreq.c | 2 +- drivers/cpufreq/davinci-cpufreq.c | 2 +- drivers/cpufreq/dbx500-cpufreq.c | 2 +- drivers/cpufreq/e_powersaver.c | 3 +- drivers/cpufreq/elanfreq.c | 2 +- drivers/cpufreq/exynos-cpufreq.c | 7 ++- drivers/cpufreq/exynos5440-cpufreq.c | 2 +- drivers/cpufreq/freq_table.c | 44 ++++++++++--- drivers/cpufreq/ia64-acpi-cpufreq.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 2 +- drivers/cpufreq/kirkwood-cpufreq.c | 3 +- drivers/cpufreq/longhaul.c | 2 +- drivers/cpufreq/loongson2_cpufreq.c | 2 +- drivers/cpufreq/maple-cpufreq.c | 2 +- drivers/cpufreq/omap-cpufreq.c | 2 +- drivers/cpufreq/p4-clockmod.c | 2 +- drivers/cpufreq/powernow-k6.c | 2 +- drivers/cpufreq/powernow-k7.c | 2 +- drivers/cpufreq/powernow-k8.c | 2 +- drivers/cpufreq/ppc_cbe_cpufreq.c | 2 +- drivers/cpufreq/pxa2xx-cpufreq.c | 4 +- drivers/cpufreq/pxa3xx-cpufreq.c | 2 +- drivers/cpufreq/s3c2416-cpufreq.c | 2 +- drivers/cpufreq/s3c64xx-cpufreq.c | 2 +- drivers/cpufreq/s5pv210-cpufreq.c | 2 +- drivers/cpufreq/sc520_freq.c | 2 +- drivers/cpufreq/sh-cpufreq.c | 2 +- drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +- drivers/cpufreq/sparc-us3-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 3 +- drivers/cpufreq/speedstep-centrino.c | 2 +- drivers/cpufreq/speedstep-ich.c | 2 +- drivers/cpufreq/speedstep-smi.c | 2 +- drivers/cpufreq/tegra-cpufreq.c | 4 +- include/linux/cpufreq.h | 18 +++++- 45 filesQuoted 1 line
changed, 211 insertions(+), 95 deletions(-)
Quoted 1 line
Wow!! I am shocked to see these many files getting updated :)
Hmm, CPUFREQ framework is quite popular :-).
Changing this one particular function, seemed to be the best solution.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
v4 cover cpufreq:boost: CPU Boost mode support
In reply to Lukasz MajewskiThis patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos).
For this reason cpufreq/freq_table code has been reorganized to include common code.
Important design decisions:
- Boost related code is compiled-in unconditionally and disabled by default The cpufreq_driver is responsibile for setting boost_supported flag and providing enable_boost callback(if HW support is needed)
- struct cpufreq_driver has been extended with boost related fields:
-- boost_supported - when driver supports boosting -- enable_boost - callback to function, which is necessary to
enable boost in the processor (like it is done at Intel)
- Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is always provided.
It will be read only, until either cpufreq_driver defines boost_supported flag or device tree's cpufreq "boost_mode" attribute is defined. It is consistent with legacy acpi API.
- No special spin_lock for Boost was created. The one from cpufreq core was reused.
- All available policies are now stored in a list.
- The Boost code doesn't rely on any policy. When boost state is changed, then the policy list is iterated and proper adjustements are done.
- Number of busy cpus (with load > 90%) is calculated and exported as a global sysfs attribute.
- The SW based boost can be only enabled when up to one core is regarded as a "busy" one. For safety reasons boost is disabled when more cores comes into play.
- To improve safety level, the thermal framework is also extended to disable software boosting, when thermal trip point is reached.
New patches for v4:
cpufreq: Store cpufreq policies in a list
cpufreq: Calculate number of busy CPUs
cpufreq: Enable software boost only when up to one busy core is running thermal:boost: Disable boost when trip point is reached
Tested at: HW:
Exynos 4412 3.10 linux
Exynos 4210 3.10 linuxCompile tested x86_64 defconfig (acpi) - help with HW (Intel Nehalem) test
needed
Lukasz Majewski (7):
cpufreq: Store cpufreq policies in a list
cpufreq: Add boost frequency support in core cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common
boost solution
cpufreq:exynos:Extend Exynos cpufreq driver to support boost
framework
cpufreq: Calculate number of busy CPUs
cpufreq: Enable software boost only when up to one busy core is
running
thermal:boost: Disable boost when trip point is reached
drivers/cpufreq/acpi-cpufreq.c | 61 ++++++----------- drivers/cpufreq/cpufreq.c | 132 ++++++++++++++++++++++++++++++++++++ drivers/cpufreq/cpufreq_governor.c | 4 ++ drivers/cpufreq/exynos-cpufreq.c | 4 ++ drivers/cpufreq/freq_table.c | 43 ++++++++++-- drivers/thermal/cpu_cooling.c | 3 + include/linux/cpufreq.h | 15 ++++ 7 files changed, 215 insertions(+), 47 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v4 1/7 cpufreq: Store cpufreq policies in a list
Policies available in a cpufreq framework are now linked together. They are accessible via cpufreq_policy_list defined at cpufreq core.
Changes for v4:
- New patch
--- drivers/cpufreq/cpufreq.c | 3 +++ include/linux/cpufreq.h | 1 + 2 files changed, 4 insertions(+)
drivers/cpufreq/cpufreq.c +3 -0
@@ -46,6 +46,7 @@ static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);#endif static DEFINE_RWLOCK (cpufreq_driver_lock); +static LIST_HEAD (cpufreq_policy_list);/* * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure
@@ -989,6 +990,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) }#endif +list_add (&policy->policy_list, &cpufreq_policy_list); ret =cpufreq_add_dev_interface (cpu, policy, dev);if (ret) goto err_out_unregister;
@@ -1992,6 +1994,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)subsys_interface_unregister (&cpufreq_interface);unregister_hotcpu_notifier (&cpufreq_cpu_notifier); +list_del (&cpufreq_policy_list);write_lock_irqsave (&cpufreq_driver_lock, flags); cpufreq_driver =NULL ;write_unlock_irqrestore (&cpufreq_driver_lock, flags);
include/linux/cpufreq.h +1 -0
@@ -117,6 +117,7 @@ struct cpufreq_policy {struct cpufreq_real_policy user_policy; +struct list_head policy_list;struct kobject kobj;struct completion kobj_unregister; };
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v4 1/7] cpufreq: Store cpufreq policies in a list
Quoted 8 lines · Lukasz Majewski
Policies available in a cpufreq framework are now linked together. They are accessible via
cpufreq_policy_listdefined at cpufreq core.Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>Changes for v4:
- New patch
You need to write changelog after ---, so that it doesn't get commited.
Quoted 18 lines
--- drivers/cpufreq/cpufreq.c | 3 +++ include/linux/cpufreq.h | 1 + 2 files changed, 4 insertions(+)drivers/cpufreq/cpufreq.c +1
-0@@ -46,6 +46,7 @@ static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);#endif static DEFINE_RWLOCK (cpufreq_driver_lock); +static LIST_HEAD (cpufreq_policy_list);/* * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure
drivers/cpufreq/cpufreq.c static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) · line 996
Quoted 7 lines
drivers/cpufreq/cpufreq.c +1
-0@@ -989,6 +990,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) }#endif +list_add (&policy->policy_list, &cpufreq_policy_list); ret =cpufreq_add_dev_interface (cpu, policy, dev);if (ret) goto err_out_unregister;
what about handling error cases?
Quoted 13 lines
drivers/cpufreq/cpufreq.c +1
-0@@ -1992,6 +1994,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)subsys_interface_unregister (&cpufreq_interface);unregister_hotcpu_notifier (&cpufreq_cpu_notifier); +list_del (&cpufreq_policy_list);write_lock_irqsave (&cpufreq_driver_lock, flags); cpufreq_driver =NULL ;write_unlock_irqrestore (&cpufreq_driver_lock, flags);include/linux/cpufreq.h +0
-0
include/linux/cpufreq.h struct cpufreq_policy { · line 122
Quoted 6 lines
include/linux/cpufreq.h +1
-0@@ -117,6 +117,7 @@ struct cpufreq_policy {struct cpufreq_real_policy user_policy; +struct list_head policy_list;struct kobject kobj;struct completion kobj_unregister;
--
viresh
Re: [PATCH v4 1/7] cpufreq: Store cpufreq policies in a list
Quoted 4 lines · On 26 Jun 2013 16:05:12,Viresh Kumar <[email protected]> wrote:
Quoted 3 lines · Lukasz Majewski
Policies available in a cpufreq framework are now linked together. They are accessible via
cpufreq_policy_listdefined at cpufreq core.
Quoted 10 lines
Quoted 5 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>Changes for v4:
- New patchYou need to write changelog after ---, so that it doesn't get commited.
Quoted 1 line
---
So here <---> I will put change log for v5.
Quoted 20 lines
Quoted 20 lines
drivers/cpufreq/cpufreq.c | 3 +++ include/linux/cpufreq.h | 1 + 2 files changed, 4 insertions(+)drivers/cpufreq/cpufreq.c +0
-0@@ -46,6 +46,7 @@ static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN],
cpufreq_cpu_governor); #endif
staticDEFINE_RWLOCK(cpufreq_driver_lock);
+staticLIST_HEAD(cpufreq_policy_list);/*
*cpu_policy_rwsemis a per CPU reader-writer semaphore designed
to cure @@ -989,6 +990,7 @@ static intcpufreq_add_dev(struct device *dev, struct subsys_interface *sif)}
#endif
Quoted 3 lines
Quoted 3 lines
+ list_add(&policy->policy_list, &cpufreq_policy_list); ret = cpufreq_add_dev_interface(cpu, policy, dev); if (ret)
I will add list_del(&cpufreq_policy_list);
here.
Quoted 3 lines
Quoted 1 line
goto err_out_unregister;what about handling error cases?
Thanks for spotting.
Quoted 24 lines
Quoted 15 lines
drivers/cpufreq/cpufreq.c +1
-0@@ -1992,6 +1994,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) subsys_interface_unregister(&cpufreq_interface);unregister_hotcpu_notifier (&cpufreq_cpu_notifier); +list_del (&cpufreq_policy_list);write_lock_irqsave (&cpufreq_driver_lock, flags); cpufreq_driver =NULL ;write_unlock_irqrestore(&cpufreq_driver_lock, flags);include/linux/cpufreq.h +0
-0include/linux/cpufreq.h struct cpufreq_policy { · line 122
Quoted 6 lines
include/linux/cpufreq.h +1
-0@@ -117,6 +117,7 @@ struct cpufreq_policy {struct cpufreq_real_policy user_policy; +struct list_head policy_list;struct kobject kobj;struct completion kobj_unregister;--
viresh
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 1/7] cpufreq: Store cpufreq policies in a list
Quoted 3 lines · Lukasz Majewski
Quoted 1 line
Quoted 1 line
---
So here <---> I will put change log for v5.
correct.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
ret = cpufreq_add_dev_interface(cpu, policy, dev); if (ret)I will add
list_del(&cpufreq_policy_list);
here.
May not be sufficient. You must do it once at the end of this routine.
Re: [PATCH v4 1/7] cpufreq: Store cpufreq policies in a list
Quoted 6 lines · Viresh Kumar
Quoted 3 lines · Lukasz Majewski
Quoted 1 line
Quoted 1 line
---
So here <---> I will put change log for v5.
correct.
OK.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
ret = cpufreq_add_dev_interface(cpu, policy, dev); if (ret)I will add
list_del(&cpufreq_policy_list);
here.May not be sufficient. You must do it once at the end of this routine.
Then I will add this code below:
err_out_kobj_put:
list_del(&cpufreq_policy_list); [rest of error path]
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 1/7] cpufreq: Store cpufreq policies in a list
Quoted 3 lines · Lukasz Majewski
err_out_kobj_put:
list_del(&cpufreq_policy_list);
[rest of error path]
I couldn't find err_out_kobj_put in existing code :)
BTW, just add to the list only once everything passed.
Re: [PATCH v4 1/7] cpufreq: Store cpufreq policies in a list
Quoted 8 lines · Viresh Kumar
Quoted 3 lines · Lukasz Majewski
err_out_kobj_put:
list_del(&cpufreq_policy_list);
[rest of error path]I couldn't find
err_out_kobj_putin existing code :)BTW, just add to the list only once everything passed.
Ok, we can do it like that :-)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 2/7 cpufreq: Add boost frequency support in core
In reply to Lukasz MajewskiThis commit adds boost frequency support in cpufreq core (Hardware & Software).
Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal operation limits. Such a mode shall be only used for a short time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
Boost sysfs attribute is always exported (to support legacy API). By default boost is exported as read only. One global attribute is available at:/sys/devices/system/cpu/cpufreq/boost.
Under the hood frequencies dedicated for boosting are marked with a special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.
Changes for v4:
- Remove boost parameter from cpufreq_frequency_table_cpuinfo() function
- Introduce cpufreq_boost_supported() method
- Use of cpufreq_boost_supported() and cpufreq_boost_enabled() to decide if frequency shall be skipped
- Rename set_boost_freq() to enable_boost()
- cpufreq_attr_available_freq() moved to freq_table.c
- Use policy list to get access to cpufreq policies
- Rename global boost flag (cpufreq_boost_enabled -> boost_enabled)
- pr_err corrected ( %sable)
- Remove sanity check at cpufreq_boost_trigger_state() entrance [to test if boost is supported]
- Use either HW (boost_enable) callback or SW managed boost
- Introduce new cpufreq_boost_trigger_state_sw() method to handle boost at SW.
- Protect boost_enabled manipulation with lock
- Always export boost attribute (preserve legacy behaviour). When boost is not supported this attribute is read only
Changes for v3:
- Method for reading boost status
- Removal of cpufreq_frequency_table_max()
- Extent cpufreq_frequency_table_cpuinfo() to support boost parameter
- boost_supported flag added to cpufreq_driver struct
- "boost" sysfs attribute control flag removed
- One global flag describing state of the boost defined at cpufreq core
- Rename cpufreq_driver's low_level_boost field to set_boost_freq()
- Usage of cpufreq_sysfs_{remove|add}_file() routines
Changes for v2:
- Removal of cpufreq_boost structure and move its fields to cpufreq_driver structure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names
--- drivers/cpufreq/cpufreq.c | 95 ++++++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 43 +++++++++++++++---- include/linux/cpufreq.h | 11 +++++ 3 files changed, 142 insertions(+), 7 deletions(-)
drivers/cpufreq/cpufreq.c +95 -0
@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool boost_enabled; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */
@@ -316,6 +317,29 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , boost_enabled); +} + +static ssize_t store_boost (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count) +{ +int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot enable boost!\n" , __func__); +return -EINVAL ; + } + +return count; +} +define_one_global_rw (boost);static struct cpufreq_governor *__find_governor (const char *str_governor) {
@@ -1898,6 +1922,65 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };/********************************************************************* +* BOOST * +*********************************************************************/ +static int cpufreq_boost_trigger_state_sw (void ) +{ +struct cpufreq_frequency_table *freq_table; +struct cpufreq_policy *policy; +int ret = -EINVAL ; + +list_for_each_entry (policy, &cpufreq_policy_list, policy_list) { + freq_table =cpufreq_frequency_get_table (policy->cpu); +if (freq_table) + ret =cpufreq_frequency_table_cpuinfo (policy, + freq_table); + } + +return ret; + +} +int cpufreq_boost_trigger_state (int state) +{ +unsigned long flags; +int ret =0 ; + +if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; +if (cpufreq_driver->enable_boost) + ret = cpufreq_driver->enable_boost (state); +else + ret =cpufreq_boost_trigger_state_sw (); + +if (ret) { + boost_enabled =0 ; +write_unlock_irqrestore (&cpufreq_driver_lock, flags); +pr_err ("%s: BOOST cannot enable (%d)\n" , + __func__, ret); + +return ret; + } +write_unlock_irqrestore (&cpufreq_driver_lock, flags); + +pr_debug ("%s: cpufreq BOOST %s\n" , __func__, + state ?"enabled" :"disabled" ); + } + +return 0 ; +} + +int cpufreq_boost_supported (void ) +{ +return cpufreq_driver->boost_supported; +} + +int cpufreq_boost_enabled (void ) +{ +return boost_enabled; +} + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/
@@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); +if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n" , + __func__); + goto err_null_driver; + } + ret =subsys_interface_register (&cpufreq_interface);if (ret) goto err_null_driver;
@@ -1992,6 +2085,8 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); + +cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);list_del (&cpufreq_policy_list);
drivers/cpufreq/freq_table.c +36 -7
69 lines not on this page · raw message
include/linux/cpufreq.h +11 -0
@@ -267,6 +267,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_supported; +int (*enable_boost) (int state); };/* flags */
@@ -408,6 +412,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative;#define CPUFREQ_ENTRY_INVALID ~0#define CPUFREQ_TABLE_END ~1 +/* Define index for boost frequency */ +#define CPUFREQ_BOOST_FREQ ~2 +struct cpufreq_frequency_table {unsigned int index;/* any */ unsigned int frequency;/* kHz - doesn't need to be in ascending
@@ -426,11 +433,15 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,unsigned int relation, unsigned int *index); +int cpufreq_boost_trigger_state (int state); +int cpufreq_boost_supported (void ); +int cpufreq_boost_enabled (void );/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu);/* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; +extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs;void cpufreq_frequency_table_get_attr (struct cpufreq_frequency_table *table,unsigned int cpu);
Signature · 1 line
1.7.10.4
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 10 lines · Lukasz Majewski
This commit adds boost frequency support in cpufreq core (Hardware &
drivers/cpufreq/cpufreq.c +1
-0+/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags);
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2031
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n" , + __func__); + goto err_null_driver; + } +
I do not think the boost sysfs should be created at all if boost is not supported.
For intel_pstate the read-only boost would be there for no reason and would cause confusion on the part of the user IMHO
Quoted 11 lines
drivers/cpufreq/cpufreq.c +2
-0ret =subsys_interface_register (&cpufreq_interface);if (ret) goto err_null_driver;@@ -1992,6 +2085,8 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); + +cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 12 lines · On Wed, 19 Jun 2013 10:48:53 -0700 Dirk Brandewie <[email protected]>…
Quoted 11 lines · Lukasz Majewski
This commit adds boost frequency support in cpufreq core (Hardware &
+/*********************************************************************
* REGISTER / UNREGISTER CPUFREQ
DRIVER *
*********************************************************************/drivers/cpufreq/cpufreq.c +0
-0@@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags);
Quoted 14 lines
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2031
Quoted 11 lines
drivers/cpufreq/cpufreq.c +10
-0+if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n", + __func__); + goto err_null_driver; + } +I do not think the boost sysfs should be created at all if boost is not supported.
This was my first thought. But unfortunately this "boost" attribute is always exported at acpi-cpufreq.c and in my opinion is part of a legacy API.
I totally agree with the idea of exporting boost only when supported, but I would like to know the community opinion about this (especially Viresh and Rafael shall speak up).
Quoted 3 lines
For
intel_pstatethe read-only boost would be there for no reason and would cause confusion on the part of the user IMHO
You are probably right here. However I don't know what was the original rationale behind exporting this attribute as read only.
Quoted 8 lines
Quoted 8 lines
drivers/cpufreq/cpufreq.c +0
-0ret =subsys_interface_register (&cpufreq_interface);if (ret)goto
err_null_driver;(quoted diff) +0
-0@@ -1992,6 +2085,8 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) pr_debug("unregistering driver %s\n", driver->name);
Quoted 6 lines
drivers/cpufreq/cpufreq.c int cpufreq_unregister_driver(struct cpufreq_driver *driver) · line 2091
Quoted 5 lines
drivers/cpufreq/cpufreq.c +2
-0subsys_interface_unregister (&cpufreq_interface); + +cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);
Best regards,
Lukasz Majewski
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 30 lines · Lukasz Majewski
Quoted 12 lines · On Wed, 19 Jun 2013 10:48:53 -0700 Dirk Brandewie <[email protected]>…
Quoted 11 lines · Lukasz Majewski
This commit adds boost frequency support in cpufreq core (Hardware &
+/*********************************************************************
* REGISTER / UNREGISTER CPUFREQ
DRIVER *
*********************************************************************/drivers/cpufreq/cpufreq.c +0
-0@@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags);Quoted 14 lines
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2031
Quoted 11 lines
drivers/cpufreq/cpufreq.c +10
-0+if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n", + __func__); + goto err_null_driver; + } +I do not think the boost sysfs should be created at all if boost is not supported.
Quoted 7 lines
This was my first thought. But unfortunately this "boost" attribute is always exported at
acpi-cpufreq.cand in my opinion is part of a legacy API.I totally agree with the idea of exporting boost only when supported, but I would like to know the community opinion about this (especially Viresh and Rafael shall speak up).
Simple: Export it only when supported.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 26 lines · Rafael J. Wysocki
Quoted 25 lines · Lukasz Majewski
Quoted 17 lines · On Wed, 19 Jun 2013 10:48:53 -0700 Dirk Brandewie <[email protected]>…
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct · line 2029
Quoted 12 lines · Lukasz Majewski
drivers/cpufreq/cpufreq.c +10
-0@@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct +if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n", + __func__); + goto err_null_driver; + } +I do not think the boost sysfs should be created at all if boost is not supported.
This was my first thought. But unfortunately this "boost" attribute is always exported at
acpi-cpufreq.cand in my opinion is part of a legacy API.
Quoted 5 lines
Quoted 3 lines
I totally agree with the idea of exporting boost only when supported, but I would like to know the community opinion about this (especially Viresh and Rafael shall speak up).
Simple: Export it only when supported.
Guys,
I got confused here. We originally decided to keep this feature as is for acpi-cpufreq.
So, For acpi-cpufreq:
- when boost isn't supported: create sysfs boost with ro permissions
- when boost is supported: create sysfs boost with rw permissions
So, For others:
- create sysfs boost with rw permissions only when boost is supported
.
Do you want something else? or do you want to change behavior of acpi-cpufreq driver? I don't why it was designed this way and what applications use it.
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 42 lines · Viresh Kumar
Quoted 26 lines · Rafael J. Wysocki
Quoted 25 lines · Lukasz Majewski
Quoted 17 lines · On Wed, 19 Jun 2013 10:48:53 -0700 Dirk Brandewie <[email protected]>…
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct · line 2029
Quoted 12 lines · Lukasz Majewski
drivers/cpufreq/cpufreq.c +10
-0@@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct +if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n", + __func__); + goto err_null_driver; + } +I do not think the boost sysfs should be created at all if boost is not supported.
This was my first thought. But unfortunately this "boost" attribute is always exported at
acpi-cpufreq.cand in my opinion is part of a legacy API.Quoted 5 lines
Quoted 3 lines
I totally agree with the idea of exporting boost only when supported, but I would like to know the community opinion about this (especially Viresh and Rafael shall speak up).
Simple: Export it only when supported.
Guys,
I got confused here. We originally decided to keep this feature as is for acpi-cpufreq.
So, For acpi-cpufreq:
- when boost isn't supported: create sysfs boost with ro permissions
- when boost is supported: create sysfs boost with rw permissions
Quoted 8 lines
So, For others:
- create sysfs boost with rw permissions only when boost is supported.
Do you want something else? or do you want to change behavior of acpi-cpufreq driver? I don't why it was designed this way and what applications use it.
First off, I'm not sure how many applications actually use it and I think, if any, they should be able cope with the attribute not being present.
Of course, if it turns out that yes, there are applications using it and no, they cannot cope with the missing attribute, we'll need to address this. That said such applications wouldn't work with earlier kernels in which that attribute wasn't present at all, so I suppose this is really unlikely.
So, do whichever makes more sense to you: Design things to preserve the old behavior (which is sightly confusing) or design them to expose the attribute if the feature is actually supported and be prepared to address the (unlikely) case when some hypothetical applications break because of that.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 8 lines · Rafael J. Wysocki
First off, I'm not sure how many applications actually use it and I think, if any, they should be able cope with the attribute not being present.
Of course, if it turns out that yes, there are applications using it and no, they cannot cope with the missing attribute, we'll need to address this. That said such applications wouldn't work with earlier kernels in which that attribute wasn't present at all, so I suppose this is really unlikely.
Quoted 4 lines
So, do whichever makes more sense to you: Design things to preserve the old behavior (which is sightly confusing) or design them to expose the attribute if the feature is actually supported and be prepared to address the (unlikely) case when some hypothetical applications break because of that.
Okay. Its better to keep it the way Lukasz designed it in his last patchset.
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
On Wed, 17 Jul 2013 18:31:19 +0530 Viresh Kumar [email protected] wrote,
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines
First off, I'm not sure how many applications actually use it and I think, if any, they should be able cope with the attribute not being present.
Of course, if it turns out that yes, there are applications using it and no, they cannot cope with the missing attribute, we'll need to address this. That said such applications wouldn't work with earlier kernels in which that attribute wasn't present at all, so I suppose this is really unlikely.
Quoted 8 lines
Quoted 5 lines
So, do whichever makes more sense to you: Design things to preserve the old behavior (which is sightly confusing) or design them to expose the attribute if the feature is actually supported and be prepared to address the (unlikely) case when some hypothetical applications break because of that.
Okay. Its better to keep it the way Lukasz designed it in his last patchset.
To be 100% sure - we export boost only when supported (as proposed at v5).
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 1 line · Lukasz Majewski
To be 100% sure - we export boost only when supported (as proposed at v5).
Yes.
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
In reply to Lukasz MajewskiQuoted 3 lines · Lukasz Majewski
Boost sysfs attribute is always exported (to support legacy API). By default boost is exported as read only. One global attribute is available at:
/sys/devices/system/cpu/cpufreq/boost.
You asked me and Rafael a question and posted your next version without even waiting for our replies? That will waste your time and ours too reviewing it.
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 9 lines · Viresh Kumar
Quoted 3 lines · Lukasz Majewski
Boost sysfs attribute is always exported (to support legacy API). By default boost is exported as read only. One global attribute is available at:
/sys/devices/system/cpu/cpufreq/boost.You asked me and Rafael a question and posted your next version without even waiting for our replies? That will waste your time and ours too reviewing it.
I believe I replied to that (in a different branch of the thread).
And the reply was: Do not expose if not supported.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
On Thu, 20 Jun 2013 22:03:45 +0200, Rafael J. Wysocki wrote:
Hi Rafael,
Quoted 8 lines · Viresh Kumar
Quoted 7 lines
Quoted 3 lines · Lukasz Majewski
Boost sysfs attribute is always exported (to support legacy API). By default boost is exported as read only. One global attribute is available at:
/sys/devices/system/cpu/cpufreq/boost.
Quoted 7 lines
Quoted 3 lines
You asked me and Rafael a question and posted your next version without even waiting for our replies? That will waste your time and ours too reviewing it.
I believe I replied to that (in a different branch of the thread).
And the reply was: Do not expose if not supported.
Thanks for reply. Understood :-)
Quoted 5 lines
Thanks,
Rafael
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
In reply to Lukasz MajewskiQuoted 3 lines · Lukasz Majewski
Boost sysfs attribute is always exported (to support legacy API). By default boost is exported as read only. One global attribute is available at:
/sys/devices/system/cpu/cpufreq/boost.
I assume you are going to fix this as discussed in other threads.
Quoted 10 lines
Changes for v4:
- Remove boost parameter fromcpufreq_frequency_table_cpuinfo()function
- Introducecpufreq_boost_supported()method
- Use ofcpufreq_boost_supported()andcpufreq_boost_enabled()to decide if frequency shall be skipped
- Renameset_boost_freq()toenable_boost()
-cpufreq_attr_available_freq()moved tofreq_table.c
- Use policy list to get access to cpufreq policies
- Rename global boost flag (cpufreq_boost_enabled->boost_enabled)
-pr_errcorrected ( %sable)
Quoted 8 lines
- Remove sanity check at
cpufreq_boost_trigger_state()entrance [to test if boost is supported]
- Use either HW (boost_enable) callback or SW managed boost
- Introduce newcpufreq_boost_trigger_state_sw()method to handle boost at SW.
- Protectboost_enabledmanipulation with lock
- Always export boost attribute (preserve legacy behaviour). When boost is not supported this attribute is read only
Very well written changelog. But write it after ---
Quoted 25 lines
drivers/cpufreq/cpufreq.c +10
-0@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool boost_enabled; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */ @@ -316,6 +317,29 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , boost_enabled); +} + +static ssize_t store_boost (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count) +{
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 338
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot enable boost!\n" , __func__); +return -EINVAL ; + }
Probably do boost_enabled = true here.
Quoted 13 lines
drivers/cpufreq/cpufreq.c +11
-0+return count; +} +define_one_global_rw (boost);/********************************************************************* +* BOOST * +*********************************************************************/ +static int cpufreq_boost_trigger_state_sw (void ) +{ +struct cpufreq_frequency_table *freq_table; +struct cpufreq_policy *policy; +int ret = -EINVAL ; +
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1942
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+list_for_each_entry (policy, &cpufreq_policy_list, policy_list) { + freq_table =cpufreq_frequency_get_table (policy->cpu); +if (freq_table) + ret =cpufreq_frequency_table_cpuinfo (policy, + freq_table); + } + +return ret; + +}
add blank line here.
Quoted 12 lines
drivers/cpufreq/cpufreq.c +12
-0+int cpufreq_boost_trigger_state (int state) +{ +unsigned long flags; +int ret =0 ; + +if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; +if (cpufreq_driver->enable_boost) + ret = cpufreq_driver->enable_boost (state); +else + ret =cpufreq_boost_trigger_state_sw ();
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1964
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+ +if (ret) { + boost_enabled =0 ; +write_unlock_irqrestore (&cpufreq_driver_lock, flags); +pr_err ("%s: BOOST cannot enable (%d)\n" , + __func__, ret); + +return ret; + } +write_unlock_irqrestore (&cpufreq_driver_lock, flags);
You can rewrite if (ret) and unlock() code to make it less redundant. unlock and return ret at the end and write other stuff before it.
Quoted 6 lines
drivers/cpufreq/cpufreq.c +6
-0+pr_debug ("%s: cpufreq BOOST %s\n" , __func__, + state ?"enabled" :"disabled" ); + } + +return 0 ; +}
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1981
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+ +int cpufreq_boost_supported (void ) +{ +return cpufreq_driver->boost_supported; +} + +int cpufreq_boost_enabled (void ) +{ +return boost_enabled; +}
EXPORT_SYMBOL_GPL ??
Quoted 7 lines
drivers/cpufreq/cpufreq.c +1
-0+/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags);
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2030
Quoted 10 lines
drivers/cpufreq/cpufreq.c +9
-0+if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n" , + __func__); + goto err_null_driver; + }
This would change.
Quoted 17 lines
drivers/cpufreq/cpufreq.c +2
-0ret =subsys_interface_register (&cpufreq_interface);if (ret) goto err_null_driver;@@ -1992,6 +2085,8 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); + +cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);list_del (&cpufreq_policy_list);drivers/cpufreq/freq_table.c +0
-0
drivers/cpufreq/freq_table.c int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, · line 37
Quoted 4 lines
drivers/cpufreq/freq_table.c +1
-0@@ -34,6 +34,11 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,continue ; } +if (cpufreq_boost_supported ())
Probably remove this check. Assume somebody while testing exynos, just sent boost_supported as false. Then you will not skip this frequency and may burn your chip :)
drivers/cpufreq/freq_table.c int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, · line 40
Quoted 3 lines
drivers/cpufreq/freq_table.c +3
-0+if (!cpufreq_boost_enabled () + && table[i].index ==CPUFREQ_BOOST_FREQ ) +continue ;
This should be enough.
Quoted 14 lines
drivers/cpufreq/freq_table.c +2
-1pr_debug ("table entry %u: %u kHz, %u index\n" , i, freq, table[i].index);if (freq < min_freq)@@ -171,7 +176,8 @@ static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table);/** * show_available_freqs - show available frequencies for the specified CPU */ -static ssize_t show_available_freqs (struct cpufreq_policy *policy,char *buf) +static ssize_t show_available_freqs (struct cpufreq_policy *policy,char *buf, +int show_boost) {unsigned int i =0 ;unsigned int cpu = policy->cpu;
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 194
Quoted 3 lines
drivers/cpufreq/freq_table.c +0
-0@@ -186,6 +192,9 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf)for (i =0 ; (table[i].frequency !=CPUFREQ_TABLE_END ); i++) {if (table[i].frequency ==CPUFREQ_ENTRY_INVALID )continue ;
Add a comment here describing your complex logic.
Quoted 12 lines
drivers/cpufreq/freq_table.c +3
-2+if (show_boost ^ (table[i].index ==CPUFREQ_BOOST_FREQ )) +continue ; + count +=sprintf (&buf[count],"%d " , table[i].frequency); } count +=sprintf (&buf[count],"\n" );@@ -194,14 +203,34 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) } -struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { - .attr = { .name ="scaling_available_frequencies" ,
drivers/cpufreq/freq_table.c static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) · line 211
Quoted 10 lines
drivers/cpufreq/freq_table.c +6
-4- .mode = 0444, - }, - .show = show_available_freqs, -}; +#define cpufreq_attr_available_freq (_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies) + +/** +* show_scaling_available_frequencies - show normal boost frequencies for
You missed this comment earlier. boost??
Quoted 51 lines
drivers/cpufreq/freq_table.c +20
-0+* the specified CPU +*/ +static ssize_t scaling_available_frequencies_show (struct cpufreq_policy *policy, +char *buf) +{ +return show_available_freqs (policy, buf,0 ); +} +cpufreq_attr_available_freq (scaling_available);EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_available_freqs); +/** +* show_available_boost_freqs - show available boost frequencies for +* the specified CPU +*/ +static ssize_t scaling_boost_frequencies_show (struct cpufreq_policy *policy, +char *buf) +{ +return show_available_freqs (policy, buf,1 ); +} +cpufreq_attr_available_freq (scaling_boost); +EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_boost_freqs); +/* * if you use these, you must assure that the frequency table is valid * all the time between get_attr and put_attr! include/linux/cpufreq.h +7
-0@@ -267,6 +267,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_supported; +int (*enable_boost) (int state); };/* flags */ @@ -408,6 +412,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative;#define CPUFREQ_ENTRY_INVALID ~0#define CPUFREQ_TABLE_END ~1 +/* Define index for boost frequency */ +#define CPUFREQ_BOOST_FREQ ~2 +struct cpufreq_frequency_table {unsigned int index;/* any */ unsigned int frequency;/* kHz - doesn't need to be in ascending
include/linux/cpufreq.h int cpufreq_frequency_table_target(struct cpufreq_policy *policy, · line 436
Quoted 4 lines
include/linux/cpufreq.h +1
-0@@ -426,11 +433,15 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,unsigned int relation, unsigned int *index); +int cpufreq_boost_trigger_state (int state);
Why is this present here?
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 6 lines · Viresh Kumar
Quoted 3 lines · Lukasz Majewski
Boost sysfs attribute is always exported (to support legacy API). By default boost is exported as read only. One global attribute is available at:
/sys/devices/system/cpu/cpufreq/boost.I assume you are going to fix this as discussed in other threads.
Yes. Boost attribute will be visible only when boost is supported.
Quoted 21 lines
Quoted 12 lines
Changes for v4:
- Remove boost parameter fromcpufreq_frequency_table_cpuinfo()function
- Introducecpufreq_boost_supported()method
- Use ofcpufreq_boost_supported()andcpufreq_boost_enabled()to decide if frequency shall be skipped
- Renameset_boost_freq()toenable_boost()
-cpufreq_attr_available_freq()moved tofreq_table.c
- Use policy list to get access to cpufreq policies
- Rename global boost flag (cpufreq_boost_enabled->boost_enabled)
-pr_errcorrected ( %sable)Quoted 8 lines
- Remove sanity check at
cpufreq_boost_trigger_state()entrance [to test if boost is supported]
- Use either HW (boost_enable) callback or SW managed boost
- Introduce newcpufreq_boost_trigger_state_sw()method to handle boost at SW.
- Protectboost_enabledmanipulation with lock
- Always export boost attribute (preserve legacy behaviour). When boost is not supported this attribute is read only
Quoted 1 line
Very well written changelog. But write it after ---
I will stick to the rule proposed at patch 1/4, ver 4.
Quoted 32 lines
Quoted 32 lines
drivers/cpufreq/cpufreq.c +1
-0@@ -40,6 +40,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool boost_enabled; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */ @@ -316,6 +317,29 @@
EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /*********************************************************************
* SYSFS
INTERFACE *
*********************************************************************/drivers/cpufreq/cpufreq.c +7
-0+ssize_t show_boost (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , boost_enabled); +} + +static ssize_t store_boost(struct kobject *kobj, struct attribute*attr,
drivers/cpufreq/cpufreq.c +6
-0+ const char *buf, size_t count) +{ + int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 )
Quoted 8 lines
drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 338
Quoted 6 lines
drivers/cpufreq/cpufreq.c +6
-0+return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot enable boost!\n" , __func__); +return -EINVAL ; + }Probably do
boost_enabled= true here.
I would prefer to set boot_enabled at cpufreq_boost_trigger_state() method. It is closer to the cpufreq_driver->enable_boost and cpufreq_boost_trigger_state_sw(); functions, which do change the freq.
Quoted 22 lines
Quoted 22 lines
drivers/cpufreq/cpufreq.c +4
-0+return count; +} +define_one_global_rw (boost);/********************************************************************* +* BOOST *
+ *********************************************************************/drivers/cpufreq/cpufreq.c +6
-0+static int cpufreq_boost_trigger_state_sw(void) +{ +struct cpufreq_frequency_table *freq_table; +struct cpufreq_policy *policy; +int ret = -EINVAL ; + + list_for_each_entry(policy, &cpufreq_policy_list,
policy_list) {
+freq_table=cpufreq_frequency_get_table(policy->cpu);drivers/cpufreq/cpufreq.c +2
-0+if (freq_table) + ret =cpufreq_frequency_table_cpuinfo(policy,
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1942
Quoted 6 lines
drivers/cpufreq/cpufreq.c +6
-0+ freq_table); + } + +return ret; + +}add blank line here.
OK.
Quoted 11 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1952
Quoted 11 lines
drivers/cpufreq/cpufreq.c +10
-0+int cpufreq_boost_trigger_state (int state) +{ +unsigned long flags; +int ret =0 ; + +if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; +if (cpufreq_driver->enable_boost) + ret = cpufreq_driver->enable_boost (state);
^^^^^^^^^^^^^
I would prefer to change this name to enable_boost_hw
It is more informative, since it is tailored to hw based boost (Intel).
Quoted 9 lines
Quoted 9 lines
drivers/cpufreq/cpufreq.c +6
-0+else + ret =cpufreq_boost_trigger_state_sw (); + +if (ret) { + boost_enabled =0 ; +
write_unlock_irqrestore(&cpufreq_driver_lock, flags);drivers/cpufreq/cpufreq.c +2
-0+pr_err ("%s: BOOST cannot enable (%d)\n" , + __func__, ret);
Quoted 8 lines
Quoted 5 lines
drivers/cpufreq/cpufreq.c +4
-0+ +return ret; + } + write_unlock_irqrestore(&cpufreq_driver_lock,flags);
You can rewrite if (ret) and
unlock()code to make it less redundant. unlock and return ret at the end and write other stuff before it.
I will rewrite it as follow:
if (ret)
boost_enabled = 0;
write_unlock_irqrestore(&cpufreq_driver_lock, flags); pr_debug("%s: cpufreq BOOST %s\n", __func__,
state ? "enabled" : "disabled");
return ret;
Quoted 11 lines
Quoted 11 lines
drivers/cpufreq/cpufreq.c +10
-0+pr_debug ("%s: cpufreq BOOST %s\n" , __func__, + state ?"enabled" :"disabled" ); + } + +return 0 ; +} + +int cpufreq_boost_supported (void ) +{ +return cpufreq_driver->boost_supported;
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1981
Quoted 6 lines
drivers/cpufreq/cpufreq.c +6
-0+} + +int cpufreq_boost_enabled (void ) +{ +return boost_enabled; +}
EXPORT_SYMBOL_GPL??
I will export cpufreq_boost_enabled() and cpufreq_boost_supported()
Quoted 6 lines
Quoted 6 lines
+/*********************************************************************
* REGISTER / UNREGISTER CPUFREQ
DRIVER *
*********************************************************************/
Quoted 6 lines
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct · line 2023
Quoted 6 lines
drivers/cpufreq/cpufreq.c +2
-0@@ -1936,6 +2019,16 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); +if (!cpufreq_driver->boost_supported) + boost.attr.mode =0444 ;
Will be removed ^^^^^^^^^^^^^^^
Quoted 10 lines
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2030
Quoted 8 lines
drivers/cpufreq/cpufreq.c +7
-0+ + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n", + __func__); + goto err_null_driver; + }This would change.
This will be only exported when cpufreq_boost_supported() is true.
Quoted 21 lines
Quoted 21 lines
drivers/cpufreq/cpufreq.c +2
-0ret =subsys_interface_register (&cpufreq_interface);if (ret) goto err_null_driver;@@ -1992,6 +2085,8 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) pr_debug("unregistering driver %s\n", driver->name);subsys_interface_unregister (&cpufreq_interface); + +cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);list_del(&cpufreq_policy_list);(quoted diff) +0
-0
b/drivers/cpufreq/freq_table.cindex d7a7966..9c8e71e 100644drivers/cpufreq/freq_table.c +0
-0@@ -34,6 +34,11 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
Quoted 7 lines
drivers/cpufreq/freq_table.c int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, · line 37
Quoted 3 lines
drivers/cpufreq/freq_table.c +1
-0continue ; } +if (cpufreq_boost_supported ())Probably remove this check. Assume somebody while testing exynos, just sent
boost_supportedas false. Then you will not skip this frequency and may burn your chip :)
OK.
Quoted 6 lines
drivers/cpufreq/freq_table.c int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, · line 40
Quoted 4 lines
drivers/cpufreq/freq_table.c +3
-0+if (!cpufreq_boost_enabled () + && table[i].index ==CPUFREQ_BOOST_FREQ ) +continue ;This should be enough.
Let's only rely on the cpufreq_boost_enabled() test here.
Quoted 13 lines
Quoted 13 lines
drivers/cpufreq/freq_table.c +0
-0pr_debug ("table entry %u: %u kHz, %u index\n" , i, freq, table[i].index);if (freq < min_freq)@@ -171,7 +176,8 @@ static DEFINE_PER_CPU(struct
cpufreq_frequency_table*,cpufreq_show_table); /**
*show_available_freqs- show available frequencies for the
specified CPU */
-staticssize_tshow_available_freqs(struct cpufreq_policy *policy, char *buf)+staticssize_tshow_available_freqs(structcpufreq_policy*policy, char *buf,
+ intshow_boost)
{
Quoted 8 lines
Quoted 6 lines
unsigned int i = 0; unsigned int cpu = policy->cpu;drivers/cpufreq/freq_table.c +0
-0@@ -186,6 +192,9 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0;(table[i].frequency !=
CPUFREQ_TABLE_END); i++) { if (table[i].frequency ==CPUFREQ_ENTRY_INVALID) continue;Add a comment here describing your complex logic.
OK.
Quoted 13 lines
Quoted 13 lines
+ if (
show_boost^ (table[i].index ==CPUFREQ_BOOST_FREQ))drivers/cpufreq/freq_table.c +2
-0+continue ; + count += sprintf(&buf[count], "%d ",table[i].frequency); }
count += sprintf(&buf[count], "\n");drivers/cpufreq/freq_table.c +0
-0@@ -194,14 +203,34 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) }
Quoted 15 lines
Quoted 12 lines
drivers/cpufreq/freq_table.c +6
-6-struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { - .attr = { .name ="scaling_available_frequencies" , - .mode =0444 , - }, - .show = show_available_freqs, -}; +#define cpufreq_attr_available_freq (_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies) + +/** +* show_scaling_available_frequencies - show normal boost Quoted 1 line
frequencies for
You missed this comment earlier. boost??
My mistake. This will be corrected.
Quoted 59 lines
Quoted 59 lines
+ * the specified CPU
+ */
+staticssize_tscaling_available_frequencies_show(structcpufreq_policy*policy,drivers/cpufreq/freq_table.c +7
-0+ char *buf) +{ +return show_available_freqs (policy, buf,0 ); +} +cpufreq_attr_available_freq (scaling_available);EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_available_freqs); +/** +* show_available_boost_freqs - show available boost frequencies for
+ * the specified CPU
+ */
+staticssize_tscaling_boost_frequencies_show(structcpufreq_policy*policy,drivers/cpufreq/freq_table.c +7
-0+ char *buf) +{ +return show_available_freqs (policy, buf,1 ); +} +cpufreq_attr_available_freq (scaling_boost); +EXPORT_SYMBOL_GPL (cpufreq_freq_attr_scaling_boost_freqs); +/* * if you use these, you must assure that the frequency table is valid
* all the time betweenget_attrandput_attr!include/linux/cpufreq.h +4
-0@@ -267,6 +267,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_supported; +int (*enable_boost) (int state); };/* flags */ @@ -408,6 +412,9 @@ extern struct cpufreq_governor
cpufreq_gov_conservative; #defineCPUFREQ_ENTRY_INVALID~0
#defineCPUFREQ_TABLE_END~1include/linux/cpufreq.h +3
-0+/* Define index for boost frequency */ +#define CPUFREQ_BOOST_FREQ ~2 +struct cpufreq_frequency_table {unsigned int index;/* any */ unsigned int frequency;/* kHz - doesn't need to be in ascending @@ -426,11 +433,15 @@ int
cpufreq_frequency_table_target(struct cpufreq_policy *policy, unsigned int relation, unsigned int *index);
Quoted 3 lines
Quoted 1 line
+int
cpufreq_boost_trigger_state(int state);Why is this present here?
We had agreed to talk only about cpufreq :-).
This declaration will be removed.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 8 lines · Lukasz Majewski
Quoted 4 lines
Quoted 2 lines
+int
cpufreq_boost_trigger_state(int state);Why is this present here?
We had agreed to talk only about cpufreq :-).
This declaration will be removed.
Correction:
This declaration is needed for allowing disabling cpufreq boost at thermal subsystem (please refer to [PATCH v4 7/7]).
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
In reply to Lukasz MajewskiQuoted 20 lines · Lukasz Majewski
Quoted 18 lines · Viresh Kumar
Quoted 4 lines · Lukasz Majewski
+static
ssize_tstore_boost(struct kobject *kobj, struct attribute *attr,drivers/cpufreq/cpufreq.c +2
-0+ const char *buf, size_t count) +{drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 338
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot enable boost!\n" , __func__); +return -EINVAL ; + }Probably do
boost_enabled= true here.
Quoted 4 lines
I would prefer to set
boot_enabledatcpufreq_boost_trigger_state()method. It is closer to thecpufreq_driver->enable_boostandcpufreq_boost_trigger_state_sw(); functions, which do change the freq.
I said that as this will be more inclined towards the purpose of this routine. This routine should store boost as show_boost() is returning it. So, what would be better is if you just return 0 or err from cpufreq_boost_trigger_state() and then set boost here. This will also solve your problem where you revert back to older boost value for failure cases.
Quoted 5 lines
Quoted 1 line
Quoted 1 line
+ ret =
cpufreq_driver->enable_boost(state);^^^^^^^^^^^^^
I would prefer to change this name toenable_boost_hw
It is more informative, since it is tailored to hw based boost (Intel).
Ok
Quoted 2 lines
Quoted 2 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1954
Quoted 2 lines
drivers/cpufreq/cpufreq.c +2
-0+else + ret =cpufreq_boost_trigger_state_sw ();
then why not enable_boost_sw() here? that would be more relevant.
Quoted 8 lines
I will rewrite it as follow:
if (ret)
boost_enabled = 0;
write_unlock_irqrestore(&cpufreq_driver_lock, flags); pr_debug("%s: cpufreq BOOST %s\n",__func__,state ? "enabled" : "disabled");
So, you will not print error but current state? Probably printing error is better.
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 27 lines · Viresh Kumar
Quoted 21 lines · Lukasz Majewski
Quoted 19 lines · Viresh Kumar
Quoted 4 lines · Lukasz Majewski
+static
ssize_tstore_boost(struct kobject *kobj, struct attribute *attr,drivers/cpufreq/cpufreq.c +2
-0+ const char *buf, size_t count) +{drivers/cpufreq/cpufreq.c EXPORT_SYMBOL_GPL(cpufreq_notify_transition); · line 338
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot enable boost!\n" , __func__); +return -EINVAL ; + }Probably do
boost_enabled= true here.Quoted 4 lines
I would prefer to set
boot_enabledatcpufreq_boost_trigger_state()method. It is closer to thecpufreq_driver->enable_boostandcpufreq_boost_trigger_state_sw(); functions, which do change the freq.
Quoted 6 lines
I said that as this will be more inclined towards the purpose of this routine. This routine should store boost as
show_boost()is returning it. So, what would be better is if you just return 0 or err fromcpufreq_boost_trigger_state()and then set boost here. This will also solve your problem where you revert back to older boost value for failure cases.
I thought about this idea, but at cpufreq_boost_trigger_state_sw() I iterate through all available policies and call cpufreq_frequency_table_cpuinfo()[*] on them. In this routine [*] I use cpufreq_boost_enabled() [**] route to search for maximal (boost) frequency.
The [**] reads boost_enabled flag, which shall be updated before. When this search fails, then I restore the old value of boost_enabled.
Quoted 10 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
+ ret =
cpufreq_driver->enable_boost(state);^^^^^^^^^^^^^
I would prefer to change
this name toenable_boost_hw
It is more informative, since it is tailored to hw based boost (Intel).Ok
OK.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1954
Quoted 3 lines
drivers/cpufreq/cpufreq.c +2
-0+else + ret =cpufreq_boost_trigger_state_sw ();then why not
enable_boost_sw()here? that would be more relevant.
Could you be more specific here?
The distinction here is done on purpose:
You can either call cpufreq_driver->enable_boost for HW controlled boost or cpufreq_boost_trigger_state_sw() for SW controlled one.
I could write:
if (cpufreq_driver->enable_boost) ret = cpufreq_driver->enable_boost(state); ret = cpufreq_boost_trigger_state_sw();
But then for Intel CPUs I will iterate over its policies to seek for CPUFREQ_BOOST_FREQ marked frequencies without any purpose, since HW is taking care of boosting.
Quoted 6 lines
Quoted 6 lines
I will rewrite it as follow:
if (ret)
boost_enabled = 0;
Quoted 6 lines
Quoted 3 lines
write_unlock_irqrestore(&cpufreq_driver_lock, flags); pr_debug("%s: cpufreq BOOST %s\n",__func__,state ? "enabled" : "disabled");So, you will not print error but current state? Probably printing error is better.
I will change it to:
write_unlock_irqrestore(&cpufreq_driver_lock, flags); if (ret)
pr_err("%s: BOOST cannot enable (%d)\n",
__func__, ret);return ret;
I want to avoid time consuming operations (like print) with holding lock (and boost_enabled shall be modified under lock).
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 9 lines · Lukasz Majewski
On Thu, 27 Jun 2013 14:32:57 +0530, Viresh Kumar wrote:
I thought about this idea, but at
cpufreq_boost_trigger_state_sw()I iterate through all available policies and call cpufreq_frequency_table_cpuinfo()[*] on them. In this routine [*] I usecpufreq_boost_enabled()[**] route to search for maximal (boost) frequency.
The [**] readsboost_enabledflag, which shall be updated before. When this search fails, then I restore the old value ofboost_enabled.
Ok.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1954
Quoted 2 lines
drivers/cpufreq/cpufreq.c +2
-0+else + ret =cpufreq_boost_trigger_state_sw ();then why not
enable_boost_sw()here? that would be more relevant.Could you be more specific here?
I meant rename cpufreq_boost_trigger_state_sw() to enable_boost_sw() :)
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 12 lines · Viresh Kumar
Quoted 10 lines · Lukasz Majewski
On Thu, 27 Jun 2013 14:32:57 +0530, Viresh Kumar wrote:
I thought about this idea, but at
cpufreq_boost_trigger_state_sw()I iterate through all available policies and call cpufreq_frequency_table_cpuinfo()[*] on them. In this routine [*] I usecpufreq_boost_enabled()[**] route to search for maximal (boost) frequency.
The [**] readsboost_enabledflag, which shall be updated before. When this search fails, then I restore the old value ofboost_enabled.
Quoted 1 line
Ok.
OK
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
(quoted diff) +2
-0+ else + ret =
cpufreq_boost_trigger_state_sw();
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
then why not
enable_boost_sw()here? that would be more relevant.Could you be more specific here?
I meant rename
cpufreq_boost_trigger_state_sw()toenable_boost_sw():)
No problem:
- For SW there will be
cpufreq_boost_trigger_state_sw() renamed to enable_boost_sw()
- For HW:
cpufreq_driver->enable_boost(state) renamed to cpufreq_driver->enable_boost_hw();
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
In reply to Viresh KumarQuoted 4 lines · Viresh Kumar
Quoted 4 lines
drivers/cpufreq/cpufreq.c +4
-0+int cpufreq_boost_trigger_state (int state) +{ +unsigned long flags; +int ret =0 ;
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1954
Quoted 8 lines
drivers/cpufreq/cpufreq.c +8
-0+ +if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; +if (cpufreq_driver->enable_boost) + ret = cpufreq_driver->enable_boost (state); +else + ret =cpufreq_boost_trigger_state_sw ();
I will use only one call to cpufreq_driver->enable_boost(state) [*] with either cpufreq_boost_enable_sw() (function with SW boost handling) or
the one provided by cpufreq driver.
Only when cpufreq driver doesn't provide [*], it will be filled with "default" cpufreq_boost_enable_sw().
Quoted 12 lines
Quoted 12 lines
drivers/cpufreq/cpufreq.c +4
-0+ +if (ret) { + boost_enabled =0 ; +
write_unlock_irqrestore(&cpufreq_driver_lock, flags);drivers/cpufreq/cpufreq.c +6
-0+pr_err ("%s: BOOST cannot enable (%d)\n" , + __func__, ret); + +return ret; + } + write_unlock_irqrestore(&cpufreq_driver_lock,flags);
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 9 lines · Lukasz Majewski
Quoted 7 lines · Viresh Kumar
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1954
Quoted 7 lines
drivers/cpufreq/cpufreq.c +7
-0+if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; +if (cpufreq_driver->enable_boost) + ret = cpufreq_driver->enable_boost (state); +else + ret =cpufreq_boost_trigger_state_sw ();
Quoted 6 lines
I will use only one call to
cpufreq_driver->enable_boost(state)[*] with eithercpufreq_boost_enable_sw()(function with SW boost handling) or
the one provided by cpufreq driver.Only when cpufreq driver doesn't provide [*], it will be filled with "default"
cpufreq_boost_enable_sw().
I didn't get it completely. You are saying you will send a function pointer now?
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 15 lines · Viresh Kumar
Quoted 14 lines · Lukasz Majewski
Quoted 8 lines · Viresh Kumar
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 1954
Quoted 8 lines
drivers/cpufreq/cpufreq.c +5
-0+if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; +if (cpufreq_driver->enable_boost) + ret =
cpufreq_driver->enable_boost(state);drivers/cpufreq/cpufreq.c +2
-0+else + ret =cpufreq_boost_trigger_state_sw ();I will use only one call to
cpufreq_driver->enable_boost(state)[*] with eithercpufreq_boost_enable_sw()(function with SW boost handling) or the one provided by cpufreq driver.
Quoted 5 lines
Quoted 2 lines
Only when cpufreq driver doesn't provide [*], it will be filled with "default"
cpufreq_boost_enable_sw().I didn't get it completely. You are saying you will send a function pointer now?
No, I will use:
if (boost_enabled != state) {
write_lock_irqsave(&cpufreq_driver_lock, flags);
boost_enabled = state;
ret = cpufreq_driver->enable_boost(state);
^^^^^^^^^^^^^^^^^^^^ only one callback call
if (ret)
boost_enabled = 0;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
if (ret)
pr_err("%s: BOOST cannot enable (%d)\n",
__func__, ret);
}and @ cpufreq_register_driver() I will add following line:
if (!cpufreq_driver->enable_boost)
cpufreq_driver->enable_boost = &cpufreq_boost_enable_sw;
When cpufreq driver doesn't define callback for enable_boost it will be filled with default SW cpufreq_boost_enable_sw callback.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 18 lines · Lukasz Majewski
No, I will use:
if (boost_enabled != state) { write_lock_irqsave(&cpufreq_driver_lock, flags); boost_enabled = state; ret = cpufreq_driver->enable_boost(state); ^^^^^^^^^^^^^^^^^^^^ only one callback call if (ret) boost_enabled = 0; write_unlock_irqrestore(&cpufreq_driver_lock, flags); if (ret) pr_err("%s: BOOST cannot enable (%d)\n", __func__, ret); }
Quoted 7 lines
and @
cpufreq_register_driver()I will add following line:if (!cpufreq_driver->enable_boost)
cpufreq_driver->enable_boost = &cpufreq_boost_enable_sw;When cpufreq driver doesn't define callback for
enable_boostit will be filled with default SWcpufreq_boost_enable_swcallback.
That's some smart code. Good. :)
Re: [PATCH v4 2/7] cpufreq: Add boost frequency support in core
Quoted 21 lines · Viresh Kumar
Quoted 20 lines · Lukasz Majewski
No, I will use:
if (boost_enabled != state) { write_lock_irqsave(&cpufreq_driver_lock, flags); boost_enabled = state; ret = cpufreq_driver->enable_boost(state); ^^^^^^^^^^^^^^^^^^^^ only one callback call if (ret) boost_enabled = 0; write_unlock_irqrestore(&cpufreq_driver_lock, flags); if (ret) pr_err("%s: BOOST cannot enable (%d)\n", __func__, ret); }and @
cpufreq_register_driver()I will add following line:
Quoted 7 lines
Quoted 5 lines
if (!cpufreq_driver->enable_boost)
cpufreq_driver->enable_boost = &cpufreq_boost_enable_sw;When cpufreq driver doesn't define callback for
enable_boostit will be filled with default SWcpufreq_boost_enable_swcallback.That's some smart code. Good. :)
OK
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 3/7 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
In reply to Lukasz MajewskiThe Intel's hardware based boost solution driver has been changed to cooperate with common cpufreq boost framework.
The global sysfs boost attribute entry code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq code. This attribute is always visible. When cpufreq driver doesn't support boost, it is read only.
The boost supported global flag was replaced with the one defined at acpi's cpufreq driver.
The _store_boost() function has been redesigned to be used as set_boost_freq callback.
Changes for v4:
- add _store_boost to acpi_cpufreq_driver structure
Changes for v3:
- Bring back boost_enabled as a global flag
- Move boost_supported to cpufreq_driver structure
Changes for v2:
- Replace boost_enabled and boost_supported global flags with proper entries at struct cpufreq_driver.
- Removal of struct cpufreq_boost
--- drivers/cpufreq/acpi-cpufreq.c | 61 ++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 40 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +21 -40
@@ -80,7 +80,7 @@ static struct acpi_processor_performance __percpu *acpi_perf_data;static struct cpufreq_driver acpi_cpufreq_driver;static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; +static bool boost_enabled;static struct msr __percpu *msrs;static bool boost_state (unsigned int cpu)
@@ -133,20 +133,10 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask)wrmsr_on_cpus (cpumask, msr_addr, msrs); } -static ssize_t _store_boost (const char *buf,size_t count) +static int _store_boost (int val) { -int ret; -unsigned long val =0 ; - -if (!boost_supported) -return -EINVAL ; - - ret =kstrtoul (buf,10 , &val); -if (ret || (val >1 )) -return -EINVAL ; -if ((val && boost_enabled) || (!val && !boost_enabled)) -return count; +return 0 ;get_online_cpus ();
@@ -157,30 +147,31 @@ static ssize_t _store_boost(const char *buf, size_t count) boost_enabled = val;pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" ); -return count; +return 0 ; } -static ssize_t store_global_boost (struct kobject *kobj,struct attribute *attr, -const char *buf,size_t count) +static ssize_t store_boost (const char *buf,size_t count) { -return _store_boost (buf, count); -} +int ret; +unsigned long val =0 ; -static ssize_t show_global_boost (struct kobject *kobj, -struct attribute *attr,char *buf) -{ -return sprintf (buf,"%u\n" , boost_enabled); -} +if (!acpi_cpufreq_driver.boost_supported) +return -EINVAL ; + + ret =kstrtoul (buf,10 , &val); +if (ret || (val >1 )) +return -EINVAL ; -static struct global_attr global_boost =__ATTR (boost,0644 , - show_global_boost, - store_global_boost); +_store_boost ((int ) val); + +return count; +}#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB static ssize_t store_cpb (struct cpufreq_policy *policy,const char *buf,size_t count) { -return _store_boost (buf, count); +return store_boost (buf, count); }static ssize_t show_cpb (struct cpufreq_policy *policy,char *buf)
@@ -920,6 +911,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .name = "acpi-cpufreq", .owner = THIS_MODULE, .attr = acpi_cpufreq_attr, + .enable_boost = _store_boost, };static void __init acpi_cpufreq_boost_init (void )
@@ -930,8 +922,8 @@ static void __init acpi_cpufreq_boost_init(void)if (!msrs)return ; - boost_supported = true; boost_enabled =boost_state (0 ); + acpi_cpufreq_driver.boost_supported = true;get_online_cpus ();
@@ -941,22 +933,11 @@ static void __init acpi_cpufreq_boost_init(void)register_cpu_notifier (&boost_nb);put_online_cpus (); - }else - global_boost.attr.mode =0444 ; - -/* We create the boost file in any case, though for systems without -* hardware support it will be read-only and hardwired to return 0. -*/ -if (cpufreq_sysfs_create_file (&(global_boost.attr))) -pr_warn (PFX "could not register global boost sysfs file\n" ); -else -pr_debug ("registered global boost sysfs file\n" ); + } } static void __exit acpi_cpufreq_boost_exit(void) { -cpufreq_sysfs_remove_file (&(global_boost.attr)); -if (msrs) {unregister_cpu_notifier (&boost_nb);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v4 3/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
drivers/cpufreq/acpi-cpufreq.c static struct acpi_processor_performance __percpu *acpi_perf_data; · line 83
Quoted 5 lines · Lukasz Majewski
drivers/cpufreq/acpi-cpufreq.c +1
-1static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; +static bool boost_enabled;
Instead of this variable use cpufreq_boost_enabled() directly.
And then this patch may change as well..
I couldn't find any more issues with this patch but some Intel guy must review it.
Re: [PATCH v4 3/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
Quoted 9 lines · Viresh Kumar
drivers/cpufreq/acpi-cpufreq.c static struct acpi_processor_performance __percpu *acpi_perf_data; · line 83
Quoted 6 lines · Lukasz Majewski
drivers/cpufreq/acpi-cpufreq.c +1
-1static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; +static bool boost_enabled;Instead of this variable use
cpufreq_boost_enabled()directly.
OK.
Quoted 5 lines
And then this patch may change as well..
I couldn't find any more issues with this patch but some Intel guy must review it.
Yes, indeed Intel review is welcome.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 4/7 cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
In reply to Lukasz MajewskiThe struct cpufreq_driver has been extended to embrace the information related to boost support.
When "boost_mode" device tree attribute is defined for a platform, the boost_supported flag is set. Moreover boost related attributes were exported.
Changes for v4:
- None
Changes for v3:
- Remove low level boost code
- Move boost management code to cpufreq core code
- Use boost_supported flag to indicate if driver supports over clocking
Changes for v2:
- Removal of struct cpufreq_boost
- Removal of the CONFIG_CPU_FREQ_BOOST flag
- low_level_boost with valid address when boost is supported
--- drivers/cpufreq/exynos-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/cpufreq/exynos-cpufreq.c +4 -0
@@ -264,6 +264,7 @@ static int exynos_cpufreq_cpu_exit(struct cpufreq_policy *policy)static struct freq_attr *exynos_cpufreq_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, + &cpufreq_freq_attr_scaling_boost_freqs,NULL , };
@@ -359,6 +360,7 @@ static struct of_device_id exynos_cpufreq_of_match[] __initconst = {static int __init exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *node = pdev->dev.of_node;int ret = -EINVAL ; exynos_info =kzalloc (sizeof (struct exynos_dvfs_info ),GFP_KERNEL );
@@ -391,6 +393,8 @@ static int __init exynos_cpufreq_probe(struct platform_device *pdev) } locking_frequency =exynos_getspeed (0 ); +if (of_property_read_bool (node,"boost_mode" )) + exynos_driver.boost_supported =1 ;register_pm_notifier (&exynos_cpufreq_nb);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v4 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
Quoted 18 lines · Lukasz Majewski
The struct
cpufreq_driverhas been extended to embrace the information related to boost support.When "
boost_mode" device tree attribute is defined for a platform, theboost_supportedflag is set. Moreover boost related attributes were exported.Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>Changes for v4:
- NoneChanges for v3:
- Remove low level boost code
- Move boost management code to cpufreq core code
- Useboost_supportedflag to indicate if driver supports over clocking
Quoted 7 lines
Changes for v2:
- Removal of structcpufreq_boost
- Removal of theCONFIG_CPU_FREQ_BOOSTflag
-low_level_boostwith valid address when boost is supported--- drivers/cpufreq/exynos-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+)
Yes, this looks fine..
I will Ack the whole series in the end, so no individual acks :)
Re: [PATCH v4 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
Quoted 28 lines · Viresh Kumar
Quoted 19 lines · Lukasz Majewski
The struct
cpufreq_driverhas been extended to embrace the information related to boost support.When "
boost_mode" device tree attribute is defined for a platform, theboost_supportedflag is set. Moreover boost related attributes were exported.Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>Changes for v4:
- NoneChanges for v3:
- Remove low level boost code
- Move boost management code to cpufreq core code
- Useboost_supportedflag to indicate if driver supports over clockingQuoted 7 lines
Changes for v2:
- Removal of structcpufreq_boost
- Removal of theCONFIG_CPU_FREQ_BOOSTflag
-low_level_boostwith valid address when boost is supported--- drivers/cpufreq/exynos-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 3 lines
Yes, this looks fine..
I will Ack the whole series in the end, so no individual acks :)
Ok.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 5/7 cpufreq: Calculate number of busy CPUs
In reply to Lukasz MajewskiIn the core governor code, per cpu load value is calculated. This patch uses it to mark processor as a "busy" one, when load value is higher than 90%.
New cpufreq sysfs attribute is created (busy_cpus). It is read only and provides information about number of actually busy CPU.
Changes for v4:
- New patch
--- drivers/cpufreq/cpufreq.c | 31 ++++++++++++++++++++++++++++++- drivers/cpufreq/cpufreq_governor.c | 1 + include/linux/cpufreq.h | 3 +++ 3 files changed, 34 insertions(+), 1 deletion(-)
drivers/cpufreq/cpufreq.c +30 -1
@@ -48,6 +48,7 @@ static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);#endif static DEFINE_RWLOCK (cpufreq_driver_lock);static LIST_HEAD (cpufreq_policy_list); +static cpumask_t cpufreq_busy_cpus;/* * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure
@@ -317,6 +318,13 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_busy_cpus (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,cpufreq_num_busy_cpu ()); +} +define_one_global_ro (busy_cpus); +ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {
@@ -1980,6 +1988,17 @@ int cpufreq_boost_enabled(void)return boost_enabled; } +int cpufreq_num_busy_cpu (void ) +{ +return cpumask_weight (&cpufreq_busy_cpus); +} + +void cpufreq_set_busy_cpu (int cpu,int val) +{ + val ?cpumask_set_cpu (cpu, &cpufreq_busy_cpus) : +cpumask_clear_cpu (cpu, &cpufreq_busy_cpus); +} +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/
@@ -2019,6 +2038,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); + ret =cpufreq_sysfs_create_file (&(busy_cpus.attr)); +if (ret) { +pr_err ("%s: cannot register global busy_cpus sysfs file\n" , + __func__); + goto err_null_driver; + } +if (!cpufreq_driver->boost_supported) boost.attr.mode =0444 ;
@@ -2026,7 +2052,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)if (ret) {pr_err ("%s: cannot register global boost sysfs file\n" , __func__); - goto err_null_driver; + goto err_busy_idle_unreg; } ret =subsys_interface_register (&cpufreq_interface);
@@ -2058,6 +2084,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)return 0 ; err_if_unreg:subsys_interface_unregister (&cpufreq_interface); +err_busy_idle_unreg: +cpufreq_sysfs_remove_file (&(busy_cpus.attr)); err_null_driver:write_lock_irqsave (&cpufreq_driver_lock, flags); cpufreq_driver =NULL ;
@@ -2086,6 +2114,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)subsys_interface_unregister (&cpufreq_interface); +cpufreq_sysfs_remove_file (&(busy_cpus.attr));cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);
drivers/cpufreq/cpufreq_governor.c +1 -0
@@ -148,6 +148,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)continue ; load =100 * (wall_time - idle_time) / wall_time; +cpufreq_set_busy_cpu (j, load >90 ?1 :0 );if (dbs_data->cdata->governor ==GOV_ONDEMAND ) {int freq_avg =__cpufreq_driver_getavg (policy, j);
include/linux/cpufreq.h +3 -0
@@ -436,6 +436,9 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,int cpufreq_boost_trigger_state (int state);int cpufreq_boost_supported (void );int cpufreq_boost_enabled (void ); + +void cpufreq_set_busy_cpu (int cpu,int val); +int cpufreq_num_busy_cpu (void );/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu);
Signature · 1 line
1.7.10.4
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 7 lines · Lukasz Majewski
In the core governor code, per cpu load value is calculated. This patch uses it to mark processor as a "busy" one, when load value is higher than 90%.
New cpufreq sysfs attribute is created (
busy_cpus). It is read only and provides information about number of actually busy CPU.
What is the intended use of this interface?
For drivers that have internal governors it will be misleading/wrong
--Dirk
Quoted 122 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>Changes for v4:
- New patch--- drivers/cpufreq/cpufreq.c | 31 ++++++++++++++++++++++++++++++- drivers/cpufreq/cpufreq_governor.c | 1 + include/linux/cpufreq.h | 3 +++ 3 files changed, 34 insertions(+), 1 deletion(-)drivers/cpufreq/cpufreq.c +30
-1@@ -48,6 +48,7 @@ static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);#endif static DEFINE_RWLOCK (cpufreq_driver_lock);static LIST_HEAD (cpufreq_policy_list); +static cpumask_t cpufreq_busy_cpus;/* * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure @@ -317,6 +318,13 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_busy_cpus (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,cpufreq_num_busy_cpu ()); +} +define_one_global_ro (busy_cpus); +ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {@@ -1980,6 +1988,17 @@ int cpufreq_boost_enabled(void)return boost_enabled; } +int cpufreq_num_busy_cpu (void ) +{ +return cpumask_weight (&cpufreq_busy_cpus); +} + +void cpufreq_set_busy_cpu (int cpu,int val) +{ + val ?cpumask_set_cpu (cpu, &cpufreq_busy_cpus) : +cpumask_clear_cpu (cpu, &cpufreq_busy_cpus); +} +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -2019,6 +2038,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); + ret =cpufreq_sysfs_create_file (&(busy_cpus.attr)); +if (ret) { +pr_err ("%s: cannot register global busy_cpus sysfs file\n" , + __func__); + goto err_null_driver; + } +if (!cpufreq_driver->boost_supported) boost.attr.mode =0444 ;@@ -2026,7 +2052,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)if (ret) {pr_err ("%s: cannot register global boost sysfs file\n" , __func__); - goto err_null_driver; + goto err_busy_idle_unreg; } ret =subsys_interface_register (&cpufreq_interface);@@ -2058,6 +2084,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)return 0 ; err_if_unreg:subsys_interface_unregister (&cpufreq_interface); +err_busy_idle_unreg: +cpufreq_sysfs_remove_file (&(busy_cpus.attr)); err_null_driver:write_lock_irqsave (&cpufreq_driver_lock, flags); cpufreq_driver =NULL ;@@ -2086,6 +2114,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)subsys_interface_unregister (&cpufreq_interface); +cpufreq_sysfs_remove_file (&(busy_cpus.attr));cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);drivers/cpufreq/cpufreq_governor.c +1
-0@@ -148,6 +148,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)continue ; load =100 * (wall_time - idle_time) / wall_time; +cpufreq_set_busy_cpu (j, load >90 ?1 :0 );if (dbs_data->cdata->governor ==GOV_ONDEMAND ) {int freq_avg =__cpufreq_driver_getavg (policy, j);include/linux/cpufreq.h +3
-0@@ -436,6 +436,9 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,int cpufreq_boost_trigger_state (int state);int cpufreq_boost_supported (void );int cpufreq_boost_enabled (void ); + +void cpufreq_set_busy_cpu (int cpu,int val); +int cpufreq_num_busy_cpu (void );/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu);
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 10 lines · On Wed, 19 Jun 2013 11:01:07 -0700 Dirk Brandewie <[email protected]>…
Quoted 7 lines · Lukasz Majewski
In the core governor code, per cpu load value is calculated. This patch uses it to mark processor as a "busy" one, when load value is higher than 90%.
New cpufreq sysfs attribute is created (
busy_cpus). It is read only and provides information about number of actually busy CPU.What is the intended use of this interface?
The kernel API would be handy with boost managed by software (like it is done with exynos) and with LAB governor.
The intention is to have two save valves for boost:
1. Enable SW controlled boost only when we have just one busy CPU.
2. Use the Thermal subsystem to switch off SW managed boost when it detects that SoC is overheating.
The problem with 2 is that, the boost code is compiled in to the cpufreq core (no CONFIG_BOOST flag). Thereof we cannot guarantee, that thermal would be always enabled (the KConfig select option).
I think that thermal subsystem is a suitable place to disable SW boost at emergency. However in my opinion this is not enough and precaution defined at 1 is needed.
I can remove exporting the "busy_cpu" sysfs attribute if you think, that it would confuse userspace. Its purpose is mainly informational.
Quoted 2 lines
For drivers that have internal governors it will be misleading/wrong
Would you be so kind and give me an example of such an internal governor?
Maybe I've overlooked some important information/usecase.
Quoted 121 lines
--Dirk
Quoted 119 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>Changes for v4:
- New patch--- drivers/cpufreq/cpufreq.c | 31 ++++++++++++++++++++++++++++++- drivers/cpufreq/cpufreq_governor.c | 1 + include/linux/cpufreq.h | 3 +++ 3 files changed, 34 insertions(+), 1 deletion(-)drivers/cpufreq/cpufreq.c +0
-0@@ -48,6 +48,7 @@ static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN],
cpufreq_cpu_governor); #endif
staticDEFINE_RWLOCK(cpufreq_driver_lock);
staticLIST_HEAD(cpufreq_policy_list);
+staticcpumask_tcpufreq_busy_cpus;/*
*cpu_policy_rwsemis a per CPU reader-writer semaphore designed
to cure @@ -317,6 +318,13 @@EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /*********************************************************************
* SYSFS
INTERFACE *
*********************************************************************/drivers/cpufreq/cpufreq.c +7
-0+ssize_t show_busy_cpus (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,cpufreq_num_busy_cpu ()); +} +define_one_global_ro (busy_cpus); +ssize_t show_boost (struct kobject *kobj, struct attribute *attr, char*buf) {
drivers/cpufreq/cpufreq.c +11
-0@@ -1980,6 +1988,17 @@ int cpufreq_boost_enabled(void)return boost_enabled; } +int cpufreq_num_busy_cpu (void ) +{ +return cpumask_weight (&cpufreq_busy_cpus); +} + +void cpufreq_set_busy_cpu (int cpu,int val) +{ + val ?cpumask_set_cpu (cpu, &cpufreq_busy_cpus) : +cpumask_clear_cpu (cpu, &cpufreq_busy_cpus); +} +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER *
*********************************************************************/drivers/cpufreq/cpufreq.c +11
-1@@ -2019,6 +2038,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); + ret =cpufreq_sysfs_create_file (&(busy_cpus.attr)); +if (ret) { +pr_err ("%s: cannot register global busy_cpus sysfs file\n", + __func__); + goto err_null_driver; + } +if (!cpufreq_driver->boost_supported) boost.attr.mode =0444 ;@@ -2026,7 +2052,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) if (ret) {pr_err ("%s: cannot register global boost sysfs file\n", __func__); - goto err_null_driver; + goto err_busy_idle_unreg; } ret =subsys_interface_register (&cpufreq_interface);@@ -2058,6 +2084,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) return 0; err_if_unreg:subsys_interface_unregister (&cpufreq_interface); +err_busy_idle_unreg: +cpufreq_sysfs_remove_file (&(busy_cpus.attr)); err_null_driver:write_lock_irqsave (&cpufreq_driver_lock, flags); cpufreq_driver =NULL ;@@ -2086,6 +2114,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) subsys_interface_unregister(&cpufreq_interface); +cpufreq_sysfs_remove_file (&(busy_cpus.attr));cpufreq_sysfs_remove_file (&(boost.attr));unregister_hotcpu_notifier (&cpufreq_cpu_notifier);(quoted diff) +0
-0
b/drivers/cpufreq/cpufreq_governor.cindex 077cea7..3402533 100644drivers/cpufreq/cpufreq_governor.c +1
-0@@ -148,6 +148,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) continue; load =100 * (wall_time - idle_time) / wall_time; +cpufreq_set_busy_cpu (j, load >90 ?1 :0 );if (dbs_data->cdata->governor ==GOV_ONDEMAND ) { int freq_avg =
__cpufreq_driver_getavg(policy, j); diff --gita/include/linux/cpufreq.hb/include/linux/cpufreq.hindex 4783c4c..536abfc 100644 ---a/include/linux/cpufreq.h+++b/include/linux/cpufreq.hdrivers/cpufreq/cpufreq_governor.c +0
-0@@ -436,6 +436,9 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, int cpufreq_boost_trigger_state(int state);int cpufreq_boost_supported (void );int cpufreq_boost_enabled (void );
Quoted 9 lines
drivers/cpufreq/cpufreq_governor.c int cpufreq_frequency_table_target(struct · line 444
Quoted 8 lines
drivers/cpufreq/cpufreq_governor.c +3
-0+ +void cpufreq_set_busy_cpu (int cpu,int val); +int cpufreq_num_busy_cpu (void );/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu);
Best regards,
Lukasz Majewski
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 35 lines · Lukasz Majewski
Quoted 10 lines · On Wed, 19 Jun 2013 11:01:07 -0700 Dirk Brandewie <[email protected]>…
Quoted 7 lines · Lukasz Majewski
In the core governor code, per cpu load value is calculated. This patch uses it to mark processor as a "busy" one, when load value is higher than 90%.
New cpufreq sysfs attribute is created (
busy_cpus). It is read only and provides information about number of actually busy CPU.What is the intended use of this interface?
The kernel API would be handy with boost managed by software (like it is done with exynos) and with LAB governor.
The intention is to have two save valves for boost:
1. Enable SW controlled boost only when we have just one busy CPU.
2. Use the Thermal subsystem to switch off SW managed boost when it detects that SoC is overheating.
The problem with 2 is that, the boost code is compiled in to the cpufreq core (no
CONFIG_BOOSTflag). Thereof we cannot guarantee, that thermal would be always enabled (the KConfig select option).
I think that thermal subsystem is a suitable place to disable SW boost at emergency. However in my opinion this is not enough and precaution defined at 1 is needed.I can remove exporting the "
busy_cpu" sysfs attribute if you think, that it would confuse userspace. Its purpose is mainly informational.Quoted 1 line
Quoted 6 lines
Quoted 1 line
For drivers that have internal governors it will be misleading/wrong
Would you be so kind and give me an example of such an internal governor?
Maybe I've overlooked some important information/usecase.
Please look at intel_pstate.c.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Viresh Kumar
maintainerRe: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
In reply to Lukasz MajewskiQuoted 3 lines · Lukasz Majewski
In the core governor code, per cpu load value is calculated. This patch uses it to mark processor as a "busy" one, when load value is higher than 90%.
How can we take this assumption. What about a cpu which is only 70-80% busy? So, we would be running at around 70% of policy->max.. Now at this point you want to enable boost frequency and so that will happen for all cores... Wouldn't that burn your chip?
Quoted 2 lines
New cpufreq sysfs attribute is created (
busy_cpus). It is read only and provides information about number of actually busy CPU.
Not required.
drivers/cpufreq/cpufreq_governor.c void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) · line 151
Quoted 9 lines
drivers/cpufreq/cpufreq_governor.c +1
-0@@ -148,6 +148,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)continue ; load =100 * (wall_time - idle_time) / wall_time; +cpufreq_set_busy_cpu (j, load >90 ?1 :0 );
do this only when boost is enabled.
Quoted 2 lines
drivers/cpufreq/cpufreq_governor.c +0
-0if (dbs_data->cdata->governor ==GOV_ONDEMAND ) {int freq_avg =__cpufreq_driver_getavg (policy, j);
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 7 lines · Viresh Kumar
Quoted 3 lines · Lukasz Majewski
In the core governor code, per cpu load value is calculated. This patch uses it to mark processor as a "busy" one, when load value is higher than 90%.
How can we take this assumption. What about a cpu which is only 70-80% busy [*]?
Do you have any idea of how to precisely set the load threshold?
As a side note:
I've thought about this patch for some time and for me it looks like we are mixing policy (number of busy CPUs) with abilities, which shall be provided by the driver (boost).
Additionally, we can only roughly "estimate" [*] when boost shall run and when it shall be turned off.
I think that, we shall leave this management [*] to the thermal framework. This framework is designed exactly to protect from over heating (it uses the same freq_table for passive CPU cooling) with several trip points -> e.g. 40 deg (disable boost), 75 deg (impose max freq as 1.0 GHz to cool down, 90 deg (shutdown immediately). Please refer to PATH v4 7/7.
Unfortunately, since we dropped Kconfig flag for BOOST we cannot impose "select THERMAL_FRAMEWORK", when flag for BOOST is enabled at Kconfig.
Ideally kernel shall not even build when CONFIG_CPUFREQ_BOOST Kconfig flag is set and thermal for target architecture is not correctly configured (including proper trip points).
Quoted 3 lines
So, we would be running at around 70% of
policy->max.. Now at this point you want to enable boost frequency and so that will happen for all cores... Wouldn't that burn your chip?
As I've written above, we can only estimate here. Even with the same manufacturer at one SoC revision BOOST will work with 95% of policy max but the other revision will work stable only with 70%.
Quoted 5 lines
Quoted 3 lines
New cpufreq sysfs attribute is created (
busy_cpus). It is read only and provides information about number of actually busy CPU.Not required.
This attribute seems helpful for debug.
Quoted 8 lines
Quoted 8 lines
(quoted diff) +0
-0
b/drivers/cpufreq/cpufreq_governor.cindex 077cea7..3402533 100644drivers/cpufreq/cpufreq_governor.c +0
-0@@ -148,6 +148,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) continue;
Quoted 4 lines
drivers/cpufreq/cpufreq_governor.c void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) · line 151
Quoted 2 lines
drivers/cpufreq/cpufreq_governor.c +1
-0load =100 * (wall_time - idle_time) / wall_time; +cpufreq_set_busy_cpu (j, load >90 ?1 :0 );do this only when boost is enabled.
Please read above side note.
Quoted 4 lines
Quoted 4 lines
drivers/cpufreq/cpufreq_governor.c +0
-0if (dbs_data->cdata->governor ==GOV_ONDEMAND ) {int freq_avg =__cpufreq_driver_getavg (policy, j);
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
@Rafael: We need you to jump into this discussion now, I don't have a good idea about what we should do :)
Quoted 1 line · Lukasz Majewski
Do you have any idea of how to precisely set the load threshold?
I thought we are talking about cpu being in idle state.
Quoted 7 lines
As a side note:
I've thought about this patch for some time and for me it looks like we are mixing policy (number of busy CPUs) with abilities, which shall be provided by the driver (boost).
Additionally, we can only roughly "estimate" [*] when boost shall run and when it shall be turned off.
This is another problem in the patch you sent. User would simply enable or disable boost feature from userspace only once.
Now, if you disable it at high temperatures then its responsibility to enable it again. Which you are missing.
Quoted 6 lines
I think that, we shall leave this management [*] to the thermal framework. This framework is designed exactly to protect from over heating (it uses the same
freq_tablefor passive CPU cooling) with several trip points -> e.g. 40 deg (disable boost), 75 deg (impose max freq as 1.0 GHz to cool down, 90 deg (shutdown immediately). Please refer to PATH v4 7/7.
There might be platforms where overheating isn't a issue with boost, if it is only enabled while only one cpu is in use.
Quoted 3 lines
Unfortunately, since we dropped
Kconfigflag for BOOST we cannot impose "selectTHERMAL_FRAMEWORK", when flag for BOOST is enabled atKconfig.
Not a big deal, we can get that in if required.
Quoted 3 lines
Ideally kernel shall not even build when
CONFIG_CPUFREQ_BOOSTKconfigflag is set and thermal for target architecture is not correctly configured (including proper trip points).
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 7 lines · Viresh Kumar
@Rafael: We need you to jump into this discussion now, I don't have a good idea about what we should do :)
Quoted 1 line · Lukasz Majewski
Do you have any idea of how to precisely set the load threshold?
I thought we are talking about cpu being in idle state.
If we _drop_ the idea with thermal subsystem to disable the boost, the logic as far as I've understood shall here be as follow:
Only enable BOOST when one CPU load > THRESHOLD_MAX and other CPUs < THRESHOLD_MIN
THRESHOLD_MIN & THRESHOLD_MAX are SoC specific.
In my opinion the above constrain imposes policy to the cpufreq driver.
Quoted 11 lines
Quoted 8 lines
As a side note:
I've thought about this patch for some time and for me it looks like we are mixing policy (number of busy CPUs) with abilities, which shall be provided by the driver (boost). Additionally, we can only roughly "estimate" [*] when boost shall run and when it shall be turned off.
This is another problem in the patch you sent. User would simply enable or disable boost feature from userspace only once.
The above statement is definitely true for Intel. There HW manage the frequency.
Quoted 3 lines
Now, if you disable it at high temperatures then its responsibility to enable it again. Which you are missing.
So thermal or "other solution" [*] shall disable boost when overheated and enable it back when things cool down.
[*] @ Viresh & Rafael do you have any idea about the "other solution" here?
Quoted 10 lines
Quoted 7 lines
I think that, we shall leave this management [*] to the thermal framework. This framework is designed exactly to protect from over heating (it uses the same
freq_tablefor passive CPU cooling) with several trip points -> e.g. 40 deg (disable boost), 75 deg (impose max freq as 1.0 GHz to cool down, 90 deg (shutdown immediately). Please refer to PATH v4 7/7.There might be platforms where overheating isn't a issue with boost, if it is only enabled while only one cpu is in use.
Could you elaborate more on this?
I thought, that with multi core one needs to keep itself inside power/thermal dissipation envelope.
Quoted 10 lines
Quoted 4 lines
Unfortunately, since we dropped
Kconfigflag for BOOST we cannot impose "selectTHERMAL_FRAMEWORK", when flag for BOOST is enabled atKconfig.Not a big deal, we can get that in if required.
Quoted 3 lines
Ideally kernel shall not even build when
CONFIG_CPUFREQ_BOOSTKconfigflag is set and thermal for target architecture is not correctly configured (including proper trip points).
This would prevent situation when somebody made a mistake and had enabled boost, but for some reason had forgotten to configure/enable thermal subsystem.
Moreover Kconfig's CONFIG_CPUFREQ_BOOST flag would indicate that user enabled boost for some reason and he/she (presumably) knows what is doing.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 7 lines · Lukasz Majewski
Quoted 6 lines · Viresh Kumar
@Rafael: We need you to jump into this discussion now, I don't have a good idea about what we should do :)
Quoted 1 line · Lukasz Majewski
Do you have any idea of how to precisely set the load threshold?
Quoted 7 lines
Quoted 1 line
I thought we are talking about cpu being in idle state.
If we _drop_ the idea with thermal subsystem to disable the boost, the logic as far as I've understood shall here be as follow:
Only enable BOOST when one CPU load >
THRESHOLD_MAXand other CPUs <THRESHOLD_MIN
Again, I thought that we are talking about cpus being completely idle. i.e. in WFI (wait for interrupt) or deeper states.
Quoted 3 lines
THRESHOLD_MIN&THRESHOLD_MAXare SoC specific.In my opinion the above constrain imposes policy to the cpufreq driver.
Hmm.
Quoted 2 lines
So thermal or "other solution" [*] shall disable boost when overheated and enable it back when things cool down.
yeah..
Quoted 2 lines
[*] @ Viresh & Rafael do you have any idea about the "other solution" here?
Not really sure :)
Quoted 4 lines
Quoted 2 lines
There might be platforms where overheating isn't a issue with boost, if it is only enabled while only one cpu is in use.
Could you elaborate more on this?
I meant platforms where chip doesn't heat up much when only one core is in use and is using boost frequency. So, they may not require support for thermal layer at all.. But I am not aware of what the ground reality is. If such systems can be possible or not.
Quoted 7 lines
This would prevent situation when somebody made a mistake and had enabled boost, but for some reason had forgotten to configure/enable thermal subsystem.
Moreover Kconfig's
CONFIG_CPUFREQ_BOOSTflag would indicate that user enabled boost for some reason and he/she (presumably) knows what is doing.
Yeah.. And drivers like ACPI cpufreq and exynos can simply do a select from their Kconfig entries so that user isn't required to select them.
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 25 lines · Viresh Kumar
Quoted 8 lines · Lukasz Majewski
Quoted 7 lines · Viresh Kumar
@Rafael: We need you to jump into this discussion now, I don't have a good idea about what we should do :)
Quoted 1 line · Lukasz Majewski
Do you have any idea of how to precisely set the load threshold?
Quoted 7 lines
Quoted 1 line
I thought we are talking about cpu being in idle state.
If we _drop_ the idea with thermal subsystem to disable the boost, the logic as far as I've understood shall here be as follow:
Only enable BOOST when one CPU load >
THRESHOLD_MAXand other CPUs <THRESHOLD_MINAgain, I thought that we are talking about cpus being completely idle. i.e. in WFI (wait for interrupt) or deeper states.
Quoted 4 lines
THRESHOLD_MIN&THRESHOLD_MAXare SoC specific.In my opinion the above constrain imposes policy to the cpufreq driver.
Quoted 6 lines
Hmm.
Quoted 2 lines
So thermal or "other solution" [*] shall disable boost when overheated and enable it back when things cool down.
yeah..
For me thermal is a good candidate to enable boost again. I only need to find a proper place for it.
Quoted 5 lines
Quoted 3 lines
[*] @ Viresh & Rafael do you have any idea about the "other solution" here?
Not really sure :)
Not any single one? Then I would like to propose thermal.
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
There might be platforms where overheating isn't a issue with boost, if it is only enabled while only one cpu is in use.
Could you elaborate more on this?
I meant platforms where chip doesn't heat up much when only one core is in use and is using boost frequency. So, they may not require support for thermal layer at all.. But I am not aware of what the ground reality is. If such systems can be possible or not.
Ok.
Quoted 11 lines
Quoted 8 lines
This would prevent situation when somebody made a mistake and had enabled boost, but for some reason had forgotten to configure/enable thermal subsystem.
Moreover Kconfig's
CONFIG_CPUFREQ_BOOSTflag would indicate that user enabled boost for some reason and he/she (presumably) knows what is doing.Yeah.. And drivers like ACPI cpufreq and exynos can simply do a select from their
Kconfigentries so that user isn't required to select them.
Automatic select is not a good option. My goal would be here to define BOOST as NO by default (at lease for SW managed ones). And allow user to enable it explicitly.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 7 lines · Lukasz Majewski
Quoted 4 lines
Quoted 2 lines
So thermal or "other solution" [*] shall disable boost when overheated and enable it back when things cool down.
yeah..
For me thermal is a good candidate to enable boost again. I only need to find a proper place for it.
Unfortunately, after careful investigation it turned out, that thermal is suited to disable boost when overheating is detected. (since it uses thermal subsystem interrupt to take action).
The problem is with enabling boost again, since thermal (at least at my board) only reacts on TMU (thermal) interrupt. Thermal thread may be started, but I don't regard this as a good solution (to extra bloat thermal).
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
[*] @ Viresh & Rafael do you have any idea about the "other solution" here?
Not really sure :)
Not any single one? Then I would like to propose thermal.
Does anybody have any idea here? As written above, thermal is suitable to disable boost.
I'd like to bring those three options under discussion:
1. boost attr is always exported -> do not enable boost automatically when disabled by thermal (as it was proposed at v4).
2. boost attr is always exported -> find a way to enable boost after emergency disablement when thermal detects overheating (newest proposition).
3. boost attr only exported at x86 (when supported) boost attr NOT exported via sysfs for SW controlled boost (e.g. Exynos ARM).
Then we only enable/disable boost at kernel and don't need to take care of the user space interaction. This scenario is my use case. I hadn't planned to expose boost to userspace and use it with LAB as a kernel API.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Hi Lukasz,
Sorry for being late. Actually I didn't had an answer to your mail and wanted to go through it with some fresh mind. This is my first mail this morning, lets see if I can bring something good into the discussion.
Quoted 2 lines · Lukasz Majewski
Does anybody have any idea here? As written above, thermal is suitable to disable boost.
See, one thing is very clear. User space applications aren't responsible for enabling boost again and again. There has to be a internal mechanism inside kernel for that.
Quoted 4 lines
I'd like to bring those three options under discussion:
1. boost attr is always exported -> do not enable boost automatically when disabled by thermal (as it was proposed at v4).
So, that's a problem. I see one more solution to that.
- Create another Macro in cpufreq.c which would contain the time after which we will autoenable boost.
- So, suppose thermal disabled it due to high temperature (Lets not change value of sysfs variable boost_enable, but create another variable like: skip_boost: which means skip boost temporarily).
- Thermal would enable this variable skip_boost.
- Then we will continue to get requests for next frequency and will check eveytime if we have exceeded time for autoenabling boost.
- If yes, then we disable this variable and start boosting again..
- Then thermal can disable it again later.
This variable (time for autoenable) looks to be more platform dependent for now, but lets don't make it like that unless somebody needs it.
Quoted 3 lines
2. boost attr is always exported -> find a way to enable boost after emergency disablement when thermal detects overheating (newest proposition).
My solution above probably.
Quoted 8 lines
3. boost attr only exported at x86 (when supported) boost attr NOT exported via sysfs for SW controlled boost (e.g. Exynos ARM).
Then we only enable/disable boost at kernel and don't need to take care of the user space interaction. This scenario is my use case. I hadn't planned to expose boost to userspace and use it with LAB as a kernel API.
Userspace must have control of this feature after kernel is built. That kernel image may run for ever without changing in a product.
@Rafael: How crazy do you think my solution is? :)
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 36 lines · Viresh Kumar
Hi Lukasz,
Sorry for being late. Actually I didn't had an answer to your mail and wanted to go through it with some fresh mind. This is my first mail this morning, lets see if I can bring something good into the discussion.
Quoted 2 lines · Lukasz Majewski
Does anybody have any idea here? As written above, thermal is suitable to disable boost.
See, one thing is very clear. User space applications aren't responsible for enabling boost again and again. There has to be a internal mechanism inside kernel for that.
Quoted 4 lines
I'd like to bring those three options under discussion:
1. boost attr is always exported -> do not enable boost automatically when disabled by thermal (as it was proposed at v4).
So, that's a problem. I see one more solution to that.
- Create another Macro incpufreq.cwhich would contain the time after which we will autoenable boost.
- So, suppose thermal disabled it due to high temperature (Lets not change value of sysfs variableboost_enable, but create another variable like:skip_boost: which means skip boost temporarily).
- Thermal would enable this variableskip_boost.
- Then we will continue to get requests for next frequency and will check eveytime if we have exceeded time for autoenabling boost.
- If yes, then we disable this variable and start boosting again..
- Then thermal can disable it again later.This variable (time for autoenable) looks to be more platform dependent for now, but lets don't make it like that unless somebody needs it.
Quoted 5 lines
Quoted 3 lines
2. boost attr is always exported -> find a way to enable boost after emergency disablement when thermal detects overheating (newest proposition).
My solution above probably.
This is a possible solution, but I've already modified thermal code a bit and found a solution for the problem.
I use thermal workqueue (which is already in place anyway) to enable the boost again.
Due to that I can provide behaviour similar to HW controlled boost.
Patches with this solution are already prepared. I will post them in a few hours. Ok?
Quoted 14 lines
Quoted 9 lines
3. boost attr only exported at x86 (when supported) boost attr NOT exported via sysfs for SW controlled boost (e.g. Exynos ARM).
Then we only enable/disable boost at kernel and don't need to
take care of the user space interaction. This scenario is my use case. I hadn't planned to expose boost to userspace and use it with LAB as a kernel API.Userspace must have control of this feature after kernel is built. That kernel image may run for ever without changing in a product.
@Rafael: How crazy do you think my solution is? :)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 9 lines · Lukasz Majewski
This is a possible solution, but I've already modified thermal code a bit and found a solution for the problem.
I use thermal workqueue (which is already in place anyway) to enable the boost again.
Due to that I can provide behaviour similar to HW controlled boost.Patches with this solution are already prepared. I will post them in a few hours. Ok?
I don't see any harm in checking them out :)
Please send them.
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
Quoted 8 lines · Viresh Kumar
Quoted 7 lines · Lukasz Majewski
This is a possible solution, but I've already modified thermal code a bit and found a solution for the problem.
I use thermal workqueue (which is already in place anyway) to enable the boost again.
Due to that I can provide behaviour similar to HW controlled boost.
Quoted 5 lines
Quoted 2 lines
Patches with this solution are already prepared. I will post them in a few hours. Ok?
I don't see any harm in checking them out :)
Please send them.
:-)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v4 5/7] cpufreq: Calculate number of busy CPUs
In reply to Viresh KumarQuoted 15 lines · Viresh Kumar
Hi Lukasz,
Sorry for being late. Actually I didn't had an answer to your mail and wanted to go through it with some fresh mind. This is my first mail this morning, lets see if I can bring something good into the discussion.
Quoted 2 lines · Lukasz Majewski
Does anybody have any idea here? As written above, thermal is suitable to disable boost.
See, one thing is very clear. User space applications aren't responsible for enabling boost again and again. There has to be a internal mechanism inside kernel for that.
Quoted 8 lines
Quoted 4 lines
I'd like to bring those three options under discussion:
1. boost attr is always exported -> do not enable boost automatically when disabled by thermal (as it was proposed at v4).
So, that's a problem. I see one more solution to that.
- Create another Macro incpufreq.cwhich would contain the time after which we will autoenable boost.
Well, how can we tell what time is correct here? It may depend on factors not under our control or even variable, like the ambient temperature, so surely it might not be a hard coded value.
Quoted 3 lines
- So, suppose thermal disabled it due to high temperature (Lets not change value of sysfs variable
boost_enable, but create another variable like:skip_boost: which means skip boost temporarily).
What about "block_boost"? Other than that, this particular item is a good idea I think.
Quoted 4 lines
- Thermal would enable this variable
skip_boost.
- Then we will continue to get requests for next frequency and will check eveytime if we have exceeded time for autoenabling boost.
- If yes, then we disable this variable and start boosting again..
I wonder if we could use thermal watermarks instead? Such that a high watermark would cause block_boost to be set and a low watermark would cause it to be reset? And the thermal layer would be in control of both watermarks?
Quoted 1 line
- Then thermal can disable it again later.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
PATCH v4 6/7 cpufreq: Enable software boost only when up to one busy core is running
In reply to Lukasz MajewskiThis patch adds protection from accidental enable of boost at systems, which supports software boosting.
Boost software mode can be only enabled when up to one busy (with heavy load) core is available on the system. Such approach brings extra protection from over heating.
Moreover the boost is automatically disabled, when cpufreq core detects more busy cores.
Changes for v4:
- New patch
--- drivers/cpufreq/cpufreq.c | 9 +++++++-- drivers/cpufreq/cpufreq_governor.c | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +7 -2
@@ -1932,12 +1932,17 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = {/********************************************************************* * BOOST * *********************************************************************/ -static int cpufreq_boost_trigger_state_sw (void ) +static int cpufreq_boost_trigger_state_sw (int state) {struct cpufreq_frequency_table *freq_table;struct cpufreq_policy *policy;int ret = -EINVAL ; +if (state &&cpufreq_num_busy_cpu () >1 ) { + boost_enabled =0 ; +return 0 ; + } +list_for_each_entry (policy, &cpufreq_policy_list, policy_list) { freq_table =cpufreq_frequency_get_table (policy->cpu);if (freq_table)
@@ -1959,7 +1964,7 @@ int cpufreq_boost_trigger_state(int state)if (cpufreq_driver->enable_boost) ret = cpufreq_driver->enable_boost (state);else - ret =cpufreq_boost_trigger_state_sw (); + ret =cpufreq_boost_trigger_state_sw (state);if (ret) { boost_enabled =0 ;
drivers/cpufreq/cpufreq_governor.c +3 -0
@@ -162,6 +162,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) max_load = load; } +if (cpufreq_boost_supported () &&cpufreq_num_busy_cpu () >1 ) +cpufreq_boost_trigger_state (0 ); + dbs_data->cdata->gov_check_cpu (cpu, max_load); }EXPORT_SYMBOL_GPL (dbs_check_cpu);
Signature · 1 line
1.7.10.4
PATCH v4 7/7 thermal:boost: Disable boost when trip point is reached
In reply to Lukasz MajewskiThis patch provides support for disabling cpufreq's boost feature when thermal trip point is reached.
Changes for v4:
- New patch
--- drivers/thermal/cpu_cooling.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/thermal/cpu_cooling.c +3 -0
@@ -323,6 +323,9 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,if (cpumask_test_cpu (policy->cpu, ¬ify_device->allowed_cpus)) max_freq = notify_device->cpufreq_val; +if (cpufreq_boost_supported ()) +cpufreq_boost_trigger_state (0 ); +/* Never exceed user_policy.max */ if (max_freq > policy->user_policy.max) max_freq = policy->user_policy.max;
Signature · 1 line
1.7.10.4
Hi Viresh,
Quoted 55 lines
This patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreqBoost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos). For this reason cpufreq/freq_table code has been reorganized to include common code.
Important design decisions:
- Boost related code is compiled-in unconditionally and disabled by default The
cpufreq_driveris responsibile for settingboost_supportedflag and providingenable_boostcallback(if HW support is needed)- struct
cpufreq_driverhas been extended with boost related fields:
--boost_supported- when driver supports boosting --enable_boost- callback to function, which is necessary to
enable boost in the processor (like it is done at Intel)- Boost sysfs attribute (
/sys/devices/system/cpu/cpufreq/boost) is always provided.
It will be read only, until eithercpufreq_driverdefinesboost_supportedflag or device tree's cpufreq "boost_mode" attribute is defined. It is consistent with legacy acpi API.- No special
spin_lockfor Boost was created. The one from cpufreq core was reused.- All available policies are now stored in a list.
- The Boost code doesn't rely on any policy. When boost state is changed, then the policy list is iterated and proper adjustements are done.
- Number of busy cpus (with load > 90%) is calculated and exported as a global sysfs attribute.
- The SW based boost can be only enabled when up to one core is regarded as a "busy" one. For safety reasons boost is disabled when more cores comes into play.
- To improve safety level, the thermal framework is also extended to disable software boosting, when thermal trip point is reached.
New patches for v4:
cpufreq: Store cpufreq policies in a list
cpufreq: Calculate number of busy CPUs
cpufreq: Enable software boost only when up to one busy core is running thermal:boost: Disable boost when trip point is reached
Quoted 6 lines
Tested at: HW:
Exynos 4412 3.10 linux Exynos 4210 3.10 linuxCompile tested
x86_64defconfig (acpi) - help with HW (Intel Nehalem) test needed
If this is not a problem, I'd like to kindly ask You to review those patches.
Rafael has expressed his opinion about "boost" attribute clearly at the other mail (as a response to v4 patches):
"Simple: Export it only when supported."
Despite the change about the "boost" attribute visibility there were many other changes, which deserve maintainer's look.
Quoted 23 lines
Lukasz Majewski (7):
cpufreq: Store cpufreq policies in a list
cpufreq: Add boost frequency support in core cpufreq:acpi:x86: Adjust theacpi-cpufreq.ccode to work with common
boost solution
cpufreq:exynos:Extend Exynos cpufreq driver to support boost
framework
cpufreq: Calculate number of busy CPUs
cpufreq: Enable software boost only when up to one busy core is
running
thermal:boost: Disable boost when trip point is reacheddrivers/cpufreq/acpi-cpufreq.c | 61 ++++++----------- drivers/cpufreq/cpufreq.c | 132 ++++++++++++++++++++++++++++++++++++ drivers/cpufreq/cpufreq_governor.c | 4 ++ drivers/cpufreq/exynos-cpufreq.c | 4 ++ drivers/cpufreq/freq_table.c | 43 ++++++++++-- drivers/thermal/cpu_cooling.c | 3 + include/linux/cpufreq.h | 15 ++++ 7 files changed, 215insertions(+), 47 deletions(-)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerQuoted 9 lines · Lukasz Majewski
If this is not a problem, I'd like to kindly ask You to review those patches.
Rafael has expressed his opinion about "boost" attribute clearly at the other mail (as a response to v4 patches):
"Simple: Export it only when supported."Despite the change about the "boost" attribute visibility there were many other changes, which deserve maintainer's look.
I haven't got time to review it until now.. I will try to do it this week.
v5 cover cpufreq:boost: CPU Boost mode support
In reply to Lukasz MajewskiThis patch series introduces support for CPU overclocking technique called Boost.
It is a follow up of a LAB governor proposal. Boost is a LAB component:
http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos).
For this reason cpufreq/freq_table code has been reorganized to include common code.
Important design decisions:
- Boost related code is compiled-in unconditionally to cpufreq core and disabled by default. The cpufreq_driver is responsibile for setting boost_supported flag and providing enable_boost callback(if HW support is needed). For software managed boost, special Kconfig flag - CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selectable only when a target platform has thermal framework properly configured.
- struct cpufreq_driver has been extended with boost related fields:
-- boost_supported - when driver supports boosting -- enable_boost - callback to function, which is necessary to
enable boost
- Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is visible _only_ when cpufreq driver supports Boost.
- No special spin_lock for Boost was created. The one from cpufreq core was reused.
- All available policies are now stored in a list.
- The Boost code doesn't rely on any policy. When boost state is changed, then the policy list is iterated and proper adjustements are done.
- To improve safety level, the thermal framework is also extended to disable software boosting, when thermal trip point is reached. Then it starts monitoring of target temperature to evaluate if boost can be enabled again. This emulates behaviour similar to HW managed boost (like x86)
New patches for v5:
cpufreq:boost:Kconfig: Enable software managed BOOST support at Kconfig Documentation:cpufreq:boost: Update BOOST documentation
Patches dropped at v5:
cpufreq: Calculate number of busy CPUs
cpufreq: Enable software boost only when up to one busy core is running
Tested at: HW:
Exynos 4412 3.10 linux
Exynos 4210 3.10 linuxCompile tested x86_64 defconfig (acpi) - help with HW (Intel Nehalem) test
needed
The code has been rebased on top of kernel_pm/bleeding-edge (3.11-rc1)
Lukasz Majewski (7):
cpufreq: Store cpufreq policies in a list
cpufreq: Add boost frequency support in core cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common
boost solution
cpufreq:exynos:Extend Exynos cpufreq driver to support boost
framework
thermal:boost: Automatic enable/disable of BOOST feature cpufreq:boost:Kconfig: Enable software managed BOOST support at
Kconfig
Documentation:cpufreq:boost: Update BOOST documentation
Documentation/cpu-freq/boost.txt | 26 ++++----- drivers/cpufreq/Kconfig | 14 +++++ drivers/cpufreq/acpi-cpufreq.c | 69 +++++++---------------- drivers/cpufreq/cpufreq.c | 115 ++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/exynos-cpufreq.c | 9 ++- drivers/cpufreq/freq_table.c | 47 +++++++++++++--- drivers/thermal/thermal_core.c | 31 ++++++++++ include/linux/cpufreq.h | 13 +++++ include/linux/thermal.h | 2 + 9 files changed, 257 insertions(+), 69 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v5 1/7 cpufreq: Store cpufreq policies in a list
Policies available in a cpufreq framework are now linked together. They are accessible via cpufreq_policy_list defined at cpufreq core.
---
Changes for v5:
- Call list_add() only when device successfully added Changes for v4:
- New patch
drivers/cpufreq/cpufreq.c | 3 +++ include/linux/cpufreq.h | 1 + 2 files changed, 4 insertions(+)
drivers/cpufreq/cpufreq.c +3 -0
@@ -46,6 +46,7 @@ static struct cpufreq_driver *cpufreq_driver; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);static DEFINE_RWLOCK (cpufreq_driver_lock);static DEFINE_MUTEX (cpufreq_governor_lock); +static LIST_HEAD (cpufreq_policy_list);#ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */
@@ -1054,6 +1055,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)if (ret) goto err_out_unregister; +list_add (&policy->policy_list, &cpufreq_policy_list);kobject_uevent (&policy->kobj,KOBJ_ADD );module_put (cpufreq_driver->owner);pr_debug ("initialization complete\n" );
@@ -2056,6 +2058,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)subsys_interface_unregister (&cpufreq_interface);unregister_hotcpu_notifier (&cpufreq_cpu_notifier); +list_del (&cpufreq_policy_list);write_lock_irqsave (&cpufreq_driver_lock, flags); cpufreq_driver =NULL ;write_unlock_irqrestore (&cpufreq_driver_lock, flags);
include/linux/cpufreq.h +1 -0
@@ -117,6 +117,7 @@ struct cpufreq_policy {struct cpufreq_real_policy user_policy; +struct list_head policy_list;struct kobject kobj;struct completion kobj_unregister;int transition_ongoing;/* Tracks transition status */
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v5 1/7] cpufreq: Store cpufreq policies in a list
drivers/cpufreq/cpufreq.c int cpufreq_unregister_driver(struct cpufreq_driver *driver) · line 2061
Quoted 7 lines · Lukasz Majewski
drivers/cpufreq/cpufreq.c +1
-0@@ -2056,6 +2058,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)subsys_interface_unregister (&cpufreq_interface);unregister_hotcpu_notifier (&cpufreq_cpu_notifier); +list_del (&cpufreq_policy_list);
You can't delete the list this way... You must have passed the list entry you wanted to delete. More precisely link from the struct cpufreq_policy.
Over that, it shouldn't be done at the time of unregistering cpufreq driver but as and when cpus are removed and _cpu_remove_dev is called.
Re: [PATCH v5 1/7] cpufreq: Store cpufreq policies in a list
On Tue, 16 Jul 2013 10:51:27 +0200 Viresh Kumar wrote,
Quoted 8 lines · Lukasz Majewski
Quoted 7 lines
drivers/cpufreq/cpufreq.c +0
-0@@ -2056,6 +2058,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) subsys_interface_unregister(&cpufreq_interface);unregister_hotcpu_notifier (&cpufreq_cpu_notifier);
Quoted 5 lines
drivers/cpufreq/cpufreq.c int cpufreq_unregister_driver(struct cpufreq_driver *driver) · line 2061
Quoted 1 line
drivers/cpufreq/cpufreq.c +1
-0+list_del (&cpufreq_policy_list);You can't delete the list this way... You must have passed the list entry you wanted to delete. More precisely link from the struct
cpufreq_policy.
Yes. I shouldn't delete statically defined head of the list. Thanks for spotting.
Quoted 4 lines
Over that, it shouldn't be done at the time of unregistering cpufreq driver but as and when cpus are removed and
_cpu_remove_devis called.
OK, I will iterate the list at __cpufreq_remove_dev() and remove each of them there.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 2/7 cpufreq: Add boost frequency support in core
In reply to Lukasz MajewskiThis commit adds boost frequency support in cpufreq core (Hardware & Software).
Some SoC (like Exynos4 - e.g. 4x12) allow setting frequency above its normal operation limits. Such a mode shall be only used for a short time.
Overclocking (boost) support is essentially provided by platform dependent cpufreq driver.
This commit unifies support for SW and HW (Intel) over clocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code.
By default boost is disabled. One global attribute is available at:/sys/devices/system/cpu/cpufreq/boost.
It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with proper call to sysfs.
---
Changes for v5:
- Rename cpufreq_boost_trigger_state_sw() to cpufreq_boost_enable_sw()
- Extent cpufreq_register_driver() to check if cpufreq driver provided boost_enable callback. If not provided, then use cpufreq_boost_enable_sw()
- Use single call to cpufreq_driver->enable_boost() with cpufreq driver provided callback or default SW boost enable routine
- Move pr_debug call to store_boost() from cpufreq_boost_trigger_state()
- Change the user_policy.max value when SW boost is toggled. It is necessary for proper operation of e.g. thermal subsystem.
- Add check if cpufreq_driver pointer is not NULL at cpufreq_boost_supported() routine
- Add EXPORT_SYMBOL_GPL for cpufreq_boost_supported() and cpufreq_boost_enabled()
- Remove extra check for cpufreq_boost_supported() at cpufreq_freq_table_cpuinfo()
- Explanation of show boost logic at show_available_freqs()
- Add cpufreq_set_boost_enabled() method to set initial value of boost_enabled global flag
Changes for v4:
- Remove boost parameter from cpufreq_frequency_table_cpuinfo() function
- Introduce cpufreq_boost_supported() method
- Use of cpufreq_boost_supported() and cpufreq_boost_enabled() to decide if frequency shall be skipped
- Rename set_boost_freq() to enable_boost()
- cpufreq_attr_available_freq() moved to freq_table.c
- Use policy list to get access to cpufreq policies
- Rename global boost flag (cpufreq_boost_enabled -> boost_enabled)
- pr_err corrected ( %sable)
- Remove sanity check at cpufreq_boost_trigger_state() entrance [to test if boost is supported]
- Use either HW (boost_enable) callback or SW managed boost
- Introduce new cpufreq_boost_trigger_state_sw() method to handle boost at SW.
- Protect boost_enabled manipulation with lock.
Changes for v3:
- Method for reading boost status
- Removal of cpufreq_frequency_table_max()
- Extent cpufreq_frequency_table_cpuinfo() to support boost parameter
- boost_supported flag added to cpufreq_driver struct
- "boost" sysfs attribute control flag removed
- One global flag describing state of the boost defined at cpufreq core
- Rename cpufreq_driver's low_level_boost field to set_boost_freq()
- Usage of cpufreq_sysfs_{remove|add}_file() routines
Changes for v2:
- Removal of cpufreq_boost structure and move its fields to cpufreq_driver structure
- Flag to indicate if global boost attribute is already defined
- Extent the pr_{err|debbug} functions to show current function names
drivers/cpufreq/cpufreq.c | 112 ++++++++++++++++++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 47 +++++++++++++++--- include/linux/cpufreq.h | 12 +++++ 3 files changed, 164 insertions(+), 7 deletions(-)
drivers/cpufreq/cpufreq.c +112 -0
@@ -43,6 +43,7 @@* also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; +static bool boost_enabled; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);static DEFINE_RWLOCK (cpufreq_driver_lock);static DEFINE_MUTEX (cpufreq_governor_lock);
@@ -377,6 +378,32 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , boost_enabled); +} + +static ssize_t store_boost (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count) +{ +int ret, enable; + + ret =sscanf (buf,"%d" , &enable); +if (ret !=1 || enable <0 || enable >1 ) +return -EINVAL ; + +if (cpufreq_boost_trigger_state (enable)) { +pr_err ("%s: Cannot enable boost!\n" , __func__); +return -EINVAL ; + } + +pr_debug ("%s: cpufreq BOOST %s\n" , __func__, + enable ?"enabled" :"disabled" ); + +return count; +} +define_one_global_rw (boost);static struct cpufreq_governor *__find_governor (const char *str_governor) {
@@ -1963,6 +1990,72 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { };/********************************************************************* +* BOOST * +*********************************************************************/ +static int cpufreq_boost_enable_sw (int state) +{ +struct cpufreq_frequency_table *freq_table; +struct cpufreq_policy *policy; +int ret = -EINVAL ; + +list_for_each_entry (policy, &cpufreq_policy_list, policy_list) { + freq_table =cpufreq_frequency_get_table (policy->cpu); +if (freq_table) { + ret =cpufreq_frequency_table_cpuinfo (policy, + freq_table); +if (!ret) + policy->user_policy.max = policy->max; + } + } + +return ret; +} + +int cpufreq_boost_trigger_state (int state) +{ +unsigned long flags; +int ret =0 ; + +if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; + + ret = cpufreq_driver->enable_boost (state); +if (ret) + boost_enabled =0 ; + +write_unlock_irqrestore (&cpufreq_driver_lock, flags); + +if (ret) +pr_err ("%s: BOOST cannot enable (%d)\n" , + __func__, ret); + } + +return ret; +} + +int cpufreq_boost_supported (void ) +{ +if (cpufreq_driver) +return cpufreq_driver->boost_supported; + +return 0 ; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_supported); + +int cpufreq_boost_enabled (void ) +{ +return boost_enabled; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_enabled); + +void cpufreq_set_boost_enabled (int state) +{ + boost_enabled = state; +} +EXPORT_SYMBOL_GPL (cpufreq_set_boost_enabled); + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/
@@ -2001,6 +2094,22 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); +if (cpufreq_driver->boost_supported) { +/* +* Check if boost driver provides function to enable boost - +* if not, use cpufreq_boost_enable_sw as default +*/ +if (!cpufreq_driver->enable_boost) + cpufreq_driver->enable_boost = &cpufreq_boost_enable_sw; + + ret =cpufreq_sysfs_create_file (&(boost.attr)); +if (ret) { +pr_err ("%s: cannot register global boost sysfs file\n" , + __func__); + goto err_null_driver; + } + } + ret =subsys_interface_register (&cpufreq_interface);if (ret) goto err_null_driver;
@@ -2056,6 +2165,9 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)pr_debug ("unregistering driver %s\n" , driver->name);subsys_interface_unregister (&cpufreq_interface); +if (cpufreq_driver->boost_supported) +cpufreq_sysfs_remove_file (&(boost.attr)); +unregister_hotcpu_notifier (&cpufreq_cpu_notifier);list_del (&cpufreq_policy_list);
drivers/cpufreq/freq_table.c +40 -7
73 lines not on this page · raw message
include/linux/cpufreq.h +12 -0
@@ -267,6 +267,10 @@ struct cpufreq_driver {int (*suspend) (struct cpufreq_policy *policy);int (*resume) (struct cpufreq_policy *policy);struct freq_attr **attr; + +/* platform specific boost support code */ +bool boost_supported; +int (*enable_boost) (int state); };/* flags */
@@ -411,6 +415,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative;#define CPUFREQ_ENTRY_INVALID ~0#define CPUFREQ_TABLE_END ~1 +/* Define index for boost frequency */ +#define CPUFREQ_BOOST_FREQ ~2 +struct cpufreq_frequency_table {unsigned int driver_data;/* driver specific data, not used by core */ unsigned int frequency;/* kHz - doesn't need to be in ascending
@@ -429,11 +436,16 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,unsigned int relation, unsigned int *index); +int cpufreq_boost_trigger_state (int state); +void cpufreq_set_boost_enabled (int state); +int cpufreq_boost_supported (void ); +int cpufreq_boost_enabled (void );/* the following 3 funtions are for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table (unsigned int cpu);/* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; +extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs;void cpufreq_frequency_table_get_attr (struct cpufreq_frequency_table *table,unsigned int cpu);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v5 2/7] cpufreq: Add boost frequency support in core
Quoted 9 lines · Lukasz Majewski
drivers/cpufreq/cpufreq.c +7
-0+int cpufreq_boost_trigger_state (int state) +{ +unsigned long flags; +int ret =0 ; + +if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags);
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 2030
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+ boost_enabled = state; + + ret = cpufreq_driver->enable_boost (state); +if (ret) + boost_enabled =0 ; + +write_unlock_irqrestore (&cpufreq_driver_lock, flags); + +if (ret) + pr_err("%s: BOOST cannot enable (%d)\n",
Who said we are enabling it?
Quoted 12 lines
drivers/cpufreq/cpufreq.c +12
-0+ __func__, ret); + } + +return ret; +} + +int cpufreq_boost_supported (void ) +{ +if (cpufreq_driver) +return cpufreq_driver->boost_supported; + +return 0 ;
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 2052
Quoted 10 lines
drivers/cpufreq/cpufreq.c +10
-0+} +EXPORT_SYMBOL_GPL (cpufreq_boost_supported); + +int cpufreq_boost_enabled (void ) +{ +return boost_enabled; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_enabled); + +void cpufreq_set_boost_enabled (int state)
Maybe cpufreq_block_boost? As suggested by Rafael.
Quoted 10 lines
drivers/cpufreq/cpufreq.c +6
-0+{ + boost_enabled = state; +} +EXPORT_SYMBOL_GPL (cpufreq_set_boost_enabled); + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/
drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2103
Quoted 10 lines
drivers/cpufreq/cpufreq.c +7
-0@@ -2001,6 +2094,22 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags); +if (cpufreq_driver->boost_supported) { +/* +* Check if boost driver provides function to enable boost - +* if not, use cpufreq_boost_enable_sw as default +*/ +if (!cpufreq_driver->enable_boost) + cpufreq_driver->enable_boost = &cpufreq_boost_enable_sw;
& is redundant.
Re: [PATCH v5 2/7] cpufreq: Add boost frequency support in core
On Tue, 16 Jul 2013 15:11:54 +0530 Viresh Kumar [email protected] wrote,
Quoted 14 lines · Lukasz Majewski
Quoted 13 lines
drivers/cpufreq/cpufreq.c +11
-0+int cpufreq_boost_trigger_state (int state) +{ +unsigned long flags; +int ret =0 ; + +if (boost_enabled != state) { +write_lock_irqsave (&cpufreq_driver_lock, flags); + boost_enabled = state; + + ret = cpufreq_driver->enable_boost (state); +if (ret)
Quoted 8 lines
drivers/cpufreq/cpufreq.c
Quoted 6 lines
drivers/cpufreq/cpufreq.c +3
-0+ boost_enabled =0 ; + + write_unlock_irqrestore(&cpufreq_driver_lock,flags); +
drivers/cpufreq/cpufreq.c +2
-0+if (ret) + pr_err("%s: BOOST cannot enable (%d)\n",Who said we are enabling it?
You are right here - also disablement could fail. I will fix it.
Quoted 15 lines
Quoted 15 lines
drivers/cpufreq/cpufreq.c +14
-0+ __func__, ret); + } + +return ret; +} + +int cpufreq_boost_supported (void ) +{ +if (cpufreq_driver) +return cpufreq_driver->boost_supported; + +return 0 ; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_supported);
Quoted 8 lines
drivers/cpufreq/cpufreq.c static struct notifier_block __refdata cpufreq_cpu_notifier = { · line 2052
Quoted 8 lines
drivers/cpufreq/cpufreq.c +8
-0+ +int cpufreq_boost_enabled (void ) +{ +return boost_enabled; +} +EXPORT_SYMBOL_GPL (cpufreq_boost_enabled); + +void cpufreq_set_boost_enabled (int state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]
Quoted 2 lines
Maybe
cpufreq_block_boost? As suggested by Rafael.
What do you mean by cpufreq_block_boost()? This name would reverse the logic.
Function [*] is used to change boost_enabled static flag (defined at cpufreq.c file) state according to acpi-cpufreq.c boost support status.
Quoted 15 lines
Quoted 15 lines
drivers/cpufreq/cpufreq.c +6
-0+{ + boost_enabled = state; +} +EXPORT_SYMBOL_GPL (cpufreq_set_boost_enabled); + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER *
*********************************************************************/drivers/cpufreq/cpufreq.c +0
-0@@ -2001,6 +2094,22 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data;write_unlock_irqrestore (&cpufreq_driver_lock, flags);
Quoted 11 lines
Quoted 9 lines
drivers/cpufreq/cpufreq.c +3
-0+if (cpufreq_driver->boost_supported) { +/* +* Check if boost driver provides function to enable boost -
drivers/cpufreq/cpufreq.c +4
-0+* if not, use cpufreq_boost_enable_sw as default +*/ +if (!cpufreq_driver->enable_boost) + cpufreq_driver->enable_boost =
&cpufreq_boost_enable_sw;& is redundant.
Yes, correct. I will change that.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Viresh Kumar
maintainerRe: [PATCH v5 2/7] cpufreq: Add boost frequency support in core
Quoted 8 lines · Lukasz Majewski
On Tue, 16 Jul 2013 15:11:54 +0530 Viresh Kumar [email protected] wrote,
Quoted 3 lines · Lukasz Majewski
Quoted 2 lines
+void
cpufreq_set_boost_enabled(int state)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]Quoted 1 line
Quoted 7 lines
Quoted 1 line
Maybe
cpufreq_block_boost? As suggested by Rafael.What do you mean by
cpufreq_block_boost()? This name would reverse the logic.Function [*] is used to change
boost_enabledstatic flag (defined atcpufreq.cfile) state according toacpi-cpufreq.cboost support status.
I misread it again :(
So, what about adding another field in struct cpufreq_driver: boost_enabled? And get rid of the global boost_enabled we have used? Similar to how boost_supported is used, then we don't need this routine.
Re: [PATCH v5 2/7] cpufreq: Add boost frequency support in core
On Wed, 17 Jul 2013 10:58:40 +0530 Viresh Kumar [email protected] wrote,
Quoted 19 lines · Lukasz Majewski
Quoted 9 lines
On Tue, 16 Jul 2013 15:11:54 +0530 Viresh Kumar
[email protected] wrote,Quoted 4 lines
Quoted 1 line · Lukasz Majewski
+void
cpufreq_set_boost_enabled(int state)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]Quoted 1 line
Quoted 8 lines
Quoted 1 line
Maybe
cpufreq_block_boost? As suggested by Rafael.What do you mean by
cpufreq_block_boost()? This name would reverse the logic.Function [*] is used to change
boost_enabledstatic flag (defined atcpufreq.cfile) state according toacpi-cpufreq.cboost support status.
Quoted 6 lines
I misread it again :(
So, what about adding another field in struct
cpufreq_driver:boost_enabled? And get rid of the globalboost_enabledwe have used? Similar to howboost_supportedis used, then we don't need this routine.
Ok, I will implement this.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 3/7 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
In reply to Lukasz MajewskiThe Intel's hardware based boost solution driver has been changed to cooperate with common cpufreq boost framework.
The global sysfs boost attribute entry code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq code. This attribute is now only visible, when cpufreq driver supports it.
The _store_boost() function has been redesigned to be used as set_boost_freq callback.
---
Changes for v5:
- Remove acpi-cpufreq's boost_enabled global flag and reuse one defined at cpufreq core
Changes for v4:
- add _store_boost to acpi_cpufreq_driver structure
Changes for v3:
- Bring back boost_enabled as a global flag
- Move boost_supported to cpufreq_driver structure
Changes for v2:
- Replace boost_enabled and boost_supported global flags with proper entries at struct cpufreq_driver.
- Removal of struct cpufreq_boost
drivers/cpufreq/acpi-cpufreq.c | 69 ++++++++++++---------------------------- 1 file changed, 21 insertions(+), 48 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +21 -48
@@ -81,7 +81,6 @@ static struct acpi_processor_performance __percpu *acpi_perf_data;static struct cpufreq_driver acpi_cpufreq_driver;static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported;static struct msr __percpu *msrs;static bool boost_state (unsigned int cpu)
@@ -134,49 +133,33 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask)wrmsr_on_cpus (cpumask, msr_addr, msrs); } -static ssize_t _store_boost (const char *buf,size_t count) +static int _store_boost (int val) +{ +get_online_cpus (); +boost_set_msrs (val, cpu_online_mask); +put_online_cpus (); +pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" ); + +return 0 ; +} + +static ssize_t store_boost (const char *buf,size_t count) {int ret;unsigned long val =0 ; -if (!boost_supported) +if (!acpi_cpufreq_driver.boost_supported)return -EINVAL ; ret =kstrtoul (buf,10 , &val);if (ret || (val >1 ))return -EINVAL ; -if ((val && boost_enabled) || (!val && !boost_enabled)) -return count; - -get_online_cpus (); - -boost_set_msrs (val, cpu_online_mask); - -put_online_cpus (); - - boost_enabled = val; -pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" ); +_store_boost ((int ) val);return count; } -static ssize_t store_global_boost (struct kobject *kobj,struct attribute *attr, -const char *buf,size_t count) -{ -return _store_boost (buf, count); -} - -static ssize_t show_global_boost (struct kobject *kobj, -struct attribute *attr,char *buf) -{ -return sprintf (buf,"%u\n" , boost_enabled); -} - -static struct global_attr global_boost =__ATTR (boost,0644 , - show_global_boost, - store_global_boost); -static ssize_t show_freqdomain_cpus (struct cpufreq_policy *policy,char *buf) {struct acpi_cpufreq_data *data =per_cpu (acfreq_data, policy->cpu);
@@ -190,12 +173,12 @@ cpufreq_freq_attr_ro(freqdomain_cpus);static ssize_t store_cpb (struct cpufreq_policy *policy,const char *buf,size_t count) { -return _store_boost (buf, count); +return store_boost (buf, count); }static ssize_t show_cpb (struct cpufreq_policy *policy,char *buf) { -return sprintf (buf,"%u\n" , boost_enabled); +return sprintf (buf,"%u\n" ,cpufreq_boost_enabled ()); }static struct freq_attr cpb =__ATTR (cpb,0644 , show_cpb, store_cpb);
@@ -583,7 +566,7 @@ static int boost_notify(struct notifier_block *nb, unsigned long action,switch (action) {case CPU_UP_PREPARE :case CPU_UP_PREPARE_FROZEN : -boost_set_msrs (boost_enabled, cpumask); +boost_set_msrs (cpufreq_boost_enabled (), cpumask);break ;case CPU_DOWN_PREPARE :
@@ -943,6 +926,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .name = "acpi-cpufreq", .owner = THIS_MODULE, .attr = acpi_cpufreq_attr, + .enable_boost = _store_boost, };static void __init acpi_cpufreq_boost_init (void )
@@ -953,33 +937,22 @@ static void __init acpi_cpufreq_boost_init(void)if (!msrs)return ; - boost_supported = true; - boost_enabled =boost_state (0 ); +cpufreq_set_boost_enabled (boost_state (0 )); + acpi_cpufreq_driver.boost_supported = true;get_online_cpus ();/* Force all MSRs to the same value */ -boost_set_msrs (boost_enabled, cpu_online_mask); +boost_set_msrs (cpufreq_boost_enabled (), cpu_online_mask);register_cpu_notifier (&boost_nb);put_online_cpus (); - }else - global_boost.attr.mode =0444 ; - -/* We create the boost file in any case, though for systems without -* hardware support it will be read-only and hardwired to return 0. -*/ -if (cpufreq_sysfs_create_file (&(global_boost.attr))) -pr_warn (PFX "could not register global boost sysfs file\n" ); -else -pr_debug ("registered global boost sysfs file\n" ); + } } static void __exit acpi_cpufreq_boost_exit(void) { -cpufreq_sysfs_remove_file (&(global_boost.attr)); -if (msrs) {unregister_cpu_notifier (&boost_nb);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v5 3/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
drivers/cpufreq/acpi-cpufreq.c static void __init acpi_cpufreq_boost_init(void) · line 941
Quoted 9 lines · Lukasz Majewski
static void
__initacpi_cpufreq_boost_init(void)drivers/cpufreq/acpi-cpufreq.c +2
-2@@ -953,33 +937,22 @@ static void __init acpi_cpufreq_boost_init(void)if (!msrs)return ; - boost_supported = true; - boost_enabled =boost_state (0 ); +cpufreq_set_boost_enabled (boost_state (0 )); + acpi_cpufreq_driver.boost_supported = true;
You are again doing the same mistake. Boost must be always supported for acpi-cpufreq with read permissions, as it was earlier.
Re: [PATCH v5 3/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution
On Tue, 16 Jul 2013 15:34:02 +0530 Viresh Kumar [email protected] wrote,
Quoted 6 lines · Lukasz Majewski
Quoted 5 lines
static void
__initacpi_cpufreq_boost_init(void)(quoted diff) +0
-0@@ -953,33 +937,22 @@ static void __init acpi_cpufreq_boost_init(void) if (!msrs) return;
Quoted 8 lines
drivers/cpufreq/acpi-cpufreq.c static void __init acpi_cpufreq_boost_init(void) · line 941
Quoted 4 lines
drivers/cpufreq/acpi-cpufreq.c +2
-2- boost_supported = true; - boost_enabled =boost_state (0 ); +cpufreq_set_boost_enabled (boost_state (0 )); + acpi_cpufreq_driver.boost_supported = true;You are again doing the same mistake. Boost must be always supported for acpi-cpufreq with read permissions, as it was earlier.
The boost attribute is exported to sysfs only when boost is supported by the driver (as we had agreed earlier).
The problem here is that the original acpi-cpufreq.c file had two static flags:
static bool boost_enabled, boost_supported;
Both of them are not needed at acpi-cpufreq, since:
1. boost_enabled is defined at cpufreq.c core file.
2. boost_supported is defined at struct cpufreq_driver (acpi_cpufreq_driver).
I've reused the boost_supported from acpi_cpufreq_driver structure to avoid code duplication.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 4/7 cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
In reply to Lukasz MajewskiThe struct cpufreq_driver has been extended to embrace the information related to boost support.
When "boost_mode" device tree attribute is defined for a platform, the boost_supported flag is set. Moreover boost related attributes were exported.
---
Changes for v5:
- None
Changes for v4:
- None
Changes for v3:
- Remove low level boost code
- Move boost management code to cpufreq core code
- Use boost_supported flag to indicate if driver supports over clocking
Changes for v2:
- Removal of struct cpufreq_boost
- Removal of the CONFIG_CPU_FREQ_BOOST flag
- low_level_boost with valid address when boost is supported
drivers/cpufreq/exynos-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/cpufreq/exynos-cpufreq.c +4 -0
@@ -267,6 +267,7 @@ static int exynos_cpufreq_cpu_exit(struct cpufreq_policy *policy)static struct freq_attr *exynos_cpufreq_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, + &cpufreq_freq_attr_scaling_boost_freqs,NULL , };
@@ -287,6 +288,7 @@ static struct cpufreq_driver exynos_driver = {static int __init exynos_cpufreq_init (void ) { +struct device_node *node = pdev->dev.of_node;int ret = -EINVAL ; exynos_info =kzalloc (sizeof (struct exynos_dvfs_info ),GFP_KERNEL );
@@ -317,6 +319,8 @@ static int __init exynos_cpufreq_init(void) } locking_frequency =exynos_getspeed (0 ); +if (of_property_read_bool (node,"boost_mode" )) + exynos_driver.boost_supported =1 ;register_pm_notifier (&exynos_cpufreq_nb);
Signature · 1 line
1.7.10.4
Viresh Kumar
maintainerRe: [PATCH v5 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
Quoted 9 lines · Lukasz Majewski
The struct
cpufreq_driverhas been extended to embrace the information related to boost support.When "
boost_mode" device tree attribute is defined for a platform, theboost_supportedflag is set. Moreover boost related attributes were exported.Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>
Don't we need to mark any frequencies in the freq table with BOOST? How?
Re: [PATCH v5 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework
On Tue, 16 Jul 2013 15:18:57 +0530 Viresh Kumar [email protected] wrote,
Quoted 8 lines · Lukasz Majewski
Quoted 7 lines
The struct
cpufreq_driverhas been extended to embrace the information related to boost support.When "
boost_mode" device tree attribute is defined for a platform, theboost_supportedflag is set. Moreover boost related attributes were exported.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>Don't we need to mark any frequencies in the freq table with BOOST? How?
The (trivial) patch is already prepared to enable BOOST at cpufreq for Exynos4412. I will post it for v6. Sorry for not posting it earlier.
The whole patch is as follow:
static struct clk *cpu_clk;
static struct clk *mout_core;
static struct clk *sclk_mpll;
static struct clk *mout_apll;
static unsigned int exynos4x12_volt_table[] = {
1350000, 1287500, 1250000, 1187500, 1137500, 1087500, 1037500, 1000000, 987500, 975000, 950000, 925000, 900000, 900000
};
static struct cpufreq_frequency_table exynos4x12_freq_table[] = {
- {L0, CPUFREQ_ENTRY_INVALID},
+ {CPUFREQ_BOOST_FREQ, 1500 * 1000},
{L1, 1400 * 1000},
{L2, 1300 * 1000},
{L3, 1200 * 1000},
{L4, 1100 * 1000},
{L5, 1000 * 1000},
{L6, 900 * 1000},
{L7, 800 * 1000},
{L8, 700 * 1000},
{L9, 600 * 1000}, {L10, 500 * 1000},
{L11, 400 * 1000},
{L12, 300 * 1000},
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 5/7 thermal:boost: Automatic enable/disable of BOOST feature
In reply to Lukasz MajewskiThis patch provides auto disable/enable operation for boost. When any defined trip point is passed, the boost is disabled.
In that moment thermal monitor workqueue is woken up and it monitors if the device temperature drops below 75% of the smallest trip point. When device cools down, the boost is enabled again.
---
Changes for v5:
- Move boost disable code from cpu_cooling.c to thermal_core.c
(to handle_non_critical_trips)
- Extent struct thermal_zone_device by adding overheated bool flag
- Implement auto enable of boost after device cools down
- Introduce boost_polling flag, which indicates if thermal uses it's predefined pool delay or has woken up thermal workqueue only to wait until device cools down.
Changes for v4:
- New patch
drivers/thermal/thermal_core.c | 31 +++++++++++++++++++++++++++++++ include/linux/thermal.h | 2 ++ 2 files changed, 33 insertions(+)
drivers/thermal/thermal_core.c +31 -0
@@ -33,6 +33,7 @@#include <linux/idr.h> #include <linux/thermal.h> #include <linux/reboot.h> +#include <linux/cpufreq.h> #include <net/netlink.h> #include <net/genetlink.h>
@@ -326,6 +327,15 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)static void handle_non_critical_trips (struct thermal_zone_device *tz,int trip,enum thermal_trip_type trip_type) { +if (cpufreq_boost_supported ()) { + tz->overheated = true; +cpufreq_boost_trigger_state (0 ); +if (!tz->polling_delay) { + tz->boost_polling = true; + tz->polling_delay =1000 ; + } + } +if (tz->governor) tz->governor->throttle (tz, trip); }
@@ -453,6 +463,27 @@ static void thermal_zone_device_check(struct work_struct *work) struct thermal_zone_device *tz = container_of(work, struct thermal_zone_device, poll_queue.work); +long trip_temp; + +if (cpufreq_boost_supported () && tz->overheated) { + tz->ops->get_trip_temp (tz,0 , &trip_temp); +/* +* Enable boost again only when current temperature is less +* than 75% of trip_temp[0] +*/ +if ((tz->temperature + (trip_temp >>2 )) < trip_temp) { + tz->overheated = false; +if (tz->boost_polling) { + tz->boost_polling = false; + tz->polling_delay =0 ; +monitor_thermal_zone (tz); + } + +cpufreq_boost_trigger_state (1 ); +return ; + } + } +thermal_zone_device_update (tz); }
include/linux/thermal.h +2 -0
@@ -172,6 +172,8 @@ struct thermal_zone_device {int emul_temperature;int passive;unsigned int forced_passive; +bool overheated; +bool boost_polling;const struct thermal_zone_device_ops *ops;const struct thermal_zone_params *tzp;struct thermal_governor *governor;
Signature · 1 line
1.7.10.4
RE: [PATCH v5 5/7] thermal:boost: Automatic enable/disable of BOOST feature
Hi Lukasz,
Quoted 67 lines
-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Lukasz Majewski
Sent: Thursday, July 04, 2013 2:20 PM
To: Viresh Kumar; Rafael J. Wysocki; Zhang, Rui; Eduardo Valentin
Cc: [email protected]; Linux PM list; Jonghwa Lee; Lukasz Majewski; [email protected]; linux-kernel; Andre Przywara; Daniel Lezcano; Kukjin Kim; Myungjoo Ham
Subject: [PATCH v5 5/7] thermal:boost: Automatic enable/disable of BOOST featureThis patch provides auto disable/enable operation for boost. When any defined trip point is passed, the boost is disabled.
In that moment thermal monitor workqueue is woken up and it monitors if the device temperature drops below 75% of the smallest trip point. When device cools down, the boost is enabled again.Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Myungjoo Ham <[email protected]>---
Changes for v5:
- Move boost disable code fromcpu_cooling.ctothermal_core.c
(tohandle_non_critical_trips)
- Extent structthermal_zone_deviceby adding overheated bool flag
- Implement auto enable of boost after device cools down
- Introduceboost_pollingflag, which indicates if thermal uses it's predefined pool delay or has woken up thermal workqueue only to wait until device cools down.Changes for v4:
- New patchdrivers/thermal/thermal_core.c | 31 +++++++++++++++++++++++++++++++ include/linux/thermal.h | 2 ++ 2 files changed, 33 insertions(+)drivers/thermal/thermal_core.c +10
-0@@ -33,6 +33,7 @@#include <linux/idr.h> #include <linux/thermal.h> #include <linux/reboot.h> +#include <linux/cpufreq.h> #include <net/netlink.h> #include <net/genetlink.h> @@ -326,6 +327,15 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)static void handle_non_critical_trips (struct thermal_zone_device *tz,int trip,enum thermal_trip_type trip_type) { +if (cpufreq_boost_supported ()) { + tz->overheated = true; +cpufreq_boost_trigger_state (0 ); +if (!tz->polling_delay) { + tz->boost_polling = true; + tz->polling_delay =1000 ; + } + } +if (tz->governor) tz->governor->throttle (tz, trip);}
drivers/thermal/thermal_core.c static void thermal_zone_device_check(struct · line 469
Quoted 7 lines
drivers/thermal/thermal_core.c +3
-0@@ -453,6 +463,27 @@ static void thermal_zone_device_check(struct work_struct *work) struct thermal_zone_device *tz = container_of(work, struct thermal_zone_device, poll_queue.work); +long trip_temp; + +if (cpufreq_boost_supported () && tz->overheated) {
Not all thermal drivers support trip points. So, we first need a if (tz->ops->get_trip_temp) check here.
drivers/thermal/thermal_core.c static void thermal_zone_device_check(struct work_struct *work) · line 474
Quoted 6 lines
drivers/thermal/thermal_core.c +6
-0+ tz->ops->get_trip_temp (tz,0 , &trip_temp); +/* +* Enable boost again only when current temperature is less +* than 75% of trip_temp[0] +*/ +if ((tz->temperature + (trip_temp >>2 )) < trip_temp) {
Another way would be to use the get_trend APIs for this thermal zone. If the trend is cooling we can re-enable boost otherwise not.
drivers/thermal/thermal_core.c static void thermal_zone_device_check(struct work_struct *work) · line 480
Quoted 6 lines
drivers/thermal/thermal_core.c +6
-0+ tz->overheated = false; +if (tz->boost_polling) { + tz->boost_polling = false; + tz->polling_delay =0 ; +monitor_thermal_zone (tz); + }
Overall, I believe this will work well only if the thermal zone is CPU.
Another suggestion is: We tried hard to remove all throttling logic from thermal_core.c. May be we should include this kind of logic in step_wise.c ? Rui/Eduardo: Any thoughts on this ?
Thanks,
Durga
Quoted 29 lines
drivers/thermal/thermal_core.c +6
-0+ +cpufreq_boost_trigger_state (1 ); +return ; + } + } +thermal_zone_device_update (tz); }include/linux/thermal.h +2
-1@@ -172,6 +172,8 @@ struct thermal_zone_device {int emul_temperature;int passive;unsigned int forced_passive; +bool overheated; +bool boost_polling;const struct thermal_zone_device_ops *ops;const struct thermal_zone_params *tzp;struct thermal_governor *governor; --1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html