Add support for _TFP and change throttle pctg
Subsystems (3)
v2 cover Add support for _TFP and change throttle pctg
This patch set adds support for two features to get a finer control over the impact of Thermal Throttling on performance.
1) Patch 1: Adds support to read Thermal fast Sampling Period (_TFP) ACPI object and use it over "Thermal Sampling Period (_TSP)" for Passive cooling if both are present.
2) Patch 2: Adds support to reduce the CPUFREQ reduction percentage and not always cause throttling in steps of "20%".
Both patches can be applied independently.
---
v1[1] -> v2:
- Patch 1: add ACPI spec section info in commit description and rebased.
- Patch 2: add info about hardware in the commit description.
- Patch 2: switched CPUFREQ THERMAL tuning macros to static variables.
- Patch 2: update the tunings for Tegra241 SoC only using soc_id check.
Jeff Brasen (1):
ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
Srikar Srimath Tirumala (1):
ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
drivers/acpi/processor_thermal.c | 41 +++++++++++++++++++++++++++++--- drivers/acpi/thermal.c | 25 ++++++++++--------- 2 files changed, 52 insertions(+), 14 deletions(-)
[1] https://lore.kernel.org/lkml/[email protected]/
Signature · 1 line
2.17.1
PATCH v2 1/2 ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
From: Jeff Brasen <[email protected]>
Add support of "Thermal fast Sampling Period (_TFP)" for Passive cooling. As per [1], _TFP overrides the "Thermal Sampling Period (_TSP)" if both are present in a Thermal zone.
[1] ACPI Specification 6.4 - section 11.4.17. _TFP (Thermal fast Sampling Period)"
--- drivers/acpi/thermal.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/acpi/thermal.c +14 -11
@@ -102,7 +102,7 @@ struct acpi_thermal_passive {struct acpi_handle_list devices;unsigned long tc1;unsigned long tc2; -unsigned long tsp; +unsigned long passive_delay; };struct acpi_thermal_active {
@@ -287,11 +287,17 @@ static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) tz->trips.passive.tc2 = tmp; status =acpi_evaluate_integer (tz->device->handle, -"_TSP" ,NULL , &tmp); -if (ACPI_FAILURE (status)) - tz->trips.passive.trip.valid = false; -else - tz->trips.passive.tsp = tmp; +"_TFP" ,NULL , &tmp); +if (ACPI_FAILURE (status)) { + status =acpi_evaluate_integer (tz->device->handle, +"_TSP" ,NULL , &tmp); +if (ACPI_FAILURE (status)) + tz->trips.passive.trip.valid = false; +else + tz->trips.passive.passive_delay = tmp *100 ; + }else { + tz->trips.passive.passive_delay = tmp; + } } } }
@@ -683,7 +689,6 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) {struct acpi_thermal_trip *acpi_trip;struct thermal_trip *trip; -int passive_delay =0 ;int trip_count =0 ;int result;int i;
@@ -694,10 +699,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)if (tz->trips.hot.valid) trip_count++; -if (tz->trips.passive.trip.valid) { +if (tz->trips.passive.trip.valid) trip_count++; - passive_delay = tz->trips.passive.tsp *100 ; - }for (i =0 ; i <ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].trip.valid; i++) trip_count++;
@@ -746,7 +749,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)0 , tz, &acpi_thermal_zone_ops,NULL , - passive_delay, + tz->trips.passive.passive_delay, tz->polling_frequency * 100);if (IS_ERR (tz->thermal_zone)) { result =PTR_ERR (tz->thermal_zone);
Signature · 1 line
2.17.1
PATCH v2 2/2 ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
In reply to Sumit GuptaFrom: Srikar Srimath Tirumala <[email protected]>
Current implementation of processor_thermal performs software throttling in fixed steps of "20%" which can be too coarse for some platforms. We observed some performance gain after reducing the throttle percentage. Change the CPUFREQ thermal reduction percentage and maximum thermal steps to be configurable. Also, update the default values of both for Nvidia Tegra241 (Grace) SoC. The thermal reduction percentage is reduced to "5%" and accordingly the maximum number of thermal steps are increased as they are derived from the reduction percentage.
--- drivers/acpi/processor_thermal.c | 41 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)
drivers/acpi/processor_thermal.c +38 -3
@@ -26,7 +26,16 @@*/ #define CPUFREQ_THERMAL_MIN_STEP 0 -#define CPUFREQ_THERMAL_MAX_STEP 3 + +static int cpufreq_thermal_max_step =3 ; + +/* +* Minimum throttle percentage for processor_thermal cooling device. +* The processor_thermal driver uses it to calculate the percentage amount by +* which cpu frequency must be reduced for each cooling state. This is also used +* to calculate the maximum number of throttling steps or cooling states. +*/ +static int cpufreq_thermal_pctg =20 ; static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg);
@@ -71,7 +80,7 @@ static int cpufreq_get_max_state(unsigned int cpu)if (!cpu_has_cpufreq (cpu))return 0 ; -return CPUFREQ_THERMAL_MAX_STEP ; +return cpufreq_thermal_max_step; }static int cpufreq_get_cur_state (unsigned int cpu)
@@ -113,7 +122,8 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)if (!policy)return -EINVAL ; - max_freq = (policy->cpuinfo.max_freq * (100 -reduction_pctg (i) *20 )) /100 ; + max_freq = (policy->cpuinfo.max_freq * + (100 -reduction_pctg (i) * cpufreq_thermal_pctg)) /100 ;cpufreq_cpu_put (policy);
@@ -126,10 +136,35 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)return 0 ; } +#define SMCCC_SOC_ID_T241 0x036b0241 + +void acpi_thermal_cpufreq_config_nvidia (void ) +{ +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +s32 soc_id =arm_smccc_get_soc_id_version (); + +/* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) */ +if ((soc_id <0 ) || (soc_id !=SMCCC_SOC_ID_T241 )) +return ; + +/* Reduce the CPUFREQ Thermal reduction percentage to 5% */ + cpufreq_thermal_pctg =5 ; + +/* +* Derive the MAX_STEP from minimum throttle percentage so that the reduction +* percentage doesn't end up becoming negative. Also, cap the MAX_STEP so that +* the CPU performance doesn't become 0. +*/ + cpufreq_thermal_max_step = ((100 / cpufreq_thermal_pctg) -1 ); +#endif +} +void acpi_thermal_cpufreq_init (struct cpufreq_policy *policy) {unsigned int cpu; +acpi_thermal_cpufreq_config_nvidia (); +for_each_cpu (cpu, policy->related_cpus) {struct acpi_processor *pr =per_cpu (processors, cpu);int ret;
Signature · 1 line
2.17.1
kernel test robot
build botRe: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
kernel test robot noticed the following build warnings:
Hi Sumit,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.6-rc1 next-20230913] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sumit-Gupta/ACPI-thermal-Add-Thermal-fast-Sampling-Period-_TFP-support/20230914-004929 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20230913164659.9345-3-sumitg%40nvidia.com patch subject: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 config: i386-defconfig (https://download.01.org/0day-ci/archive/20230914/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/acpi/processor_thermal.c:141:6: warning: no previous declaration for 'acpi_thermal_cpufreq_config_nvidia' [-Wmissing-declarations]
void acpi_thermal_cpufreq_config_nvidia(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~vim +/acpi_thermal_cpufreq_config_nvidia +141 drivers/acpi/processor_thermal.c
140
> 141 void acpi_thermal_cpufreq_config_nvidia(void)
142 {
143 #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
144 s32 soc_id = arm_smccc_get_soc_id_version();
145
146 /* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) */
147 if ((soc_id < 0) || (soc_id != SMCCC_SOC_ID_T241))
148 return;
149
150 /* Reduce the CPUFREQ Thermal reduction percentage to 5% */
151 cpufreq_thermal_pctg = 5;
152
153 /*
154 * Derive the MAX_STEP from minimum throttle percentage so that the reduction
155 * percentage doesn't end up becoming negative. Also, cap the MAX_STEP so that
156 * the CPU performance doesn't become 0.
157 */
158 cpufreq_thermal_max_step = ((100 / cpufreq_thermal_pctg) - 1);
159 #endif
160 }
161
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
Quoted 25 lines
Hi Sumit,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.6-rc1 next-20230913] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Sumit-Gupta/ACPI-thermal-Add-Thermal-fast-Sampling-Period-_TFP-support/20230914-004929 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20230913164659.9345-3-sumitg%40nvidia.com patch subject: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 config: i386-defconfig (https://download.01.org/0day-ci/archive/20230914/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 6 lines
All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/acpi/processor_thermal.c:141:6: warning: no previous declaration for 'acpi_thermal_cpufreq_config_nvidia' [-Wmissing-declarations]void acpi_thermal_cpufreq_config_nvidia(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thank you for the report.
The below change fixes the warning for me.
-void acpi_thermal_cpufreq_config_nvidia(void) +static void acpi_thermal_cpufreq_config_nvidia(void)
Hi Rafael,
If there is no other comment. Could you please add the change while applying or you prefer me sending new version ?
Thank you,
Sumit Gupta
Quoted 29 lines
vim +/acpi_thermal_cpufreq_config_nvidia +141
drivers/acpi/processor_thermal.c140Quoted 1 line
141 void
acpi_thermal_cpufreq_config_nvidia(void)142 { 143 #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY 144 s32 soc_id = arm_smccc_get_soc_id_version(); 145 146 /* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) */ 147 if ((soc_id < 0) || (soc_id != SMCCC_SOC_ID_T241)) 148 return; 149 150 /* Reduce the CPUFREQ Thermal reduction percentage to 5% */ 151 cpufreq_thermal_pctg = 5; 152 153 /* 154 * Derive the MAX_STEP from minimum throttle percentage so that the reduction 155 * percentage doesn't end up becoming negative. Also, cap the MAX_STEP so that 156 * the CPU performance doesn't become 0. 157 */ 158 cpufreq_thermal_max_step = ((100 / cpufreq_thermal_pctg) - 1); 159 #endif 160 } 161--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Rafael J. Wysocki
maintainerRe: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
Quoted 36 lines · Sumit Gupta
Quoted 26 lines
Hi Sumit,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.6-rc1 next-20230913] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Sumit-Gupta/ACPI-thermal-Add-Thermal-fast-Sampling-Period-_TFP-support/20230914-004929 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20230913164659.9345-3-sumitg%40nvidia.com patch subject: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 config: i386-defconfig (https://download.01.org/0day-ci/archive/20230914/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/Quoted 6 lines
All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/acpi/processor_thermal.c:141:6: warning: no previous declaration for 'acpi_thermal_cpufreq_config_nvidia' [-Wmissing-declarations]void acpi_thermal_cpufreq_config_nvidia(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Thank you for the report.
The below change fixes the warning for me.
Quoted 7 lines
-void
acpi_thermal_cpufreq_config_nvidia(void)+static voidacpi_thermal_cpufreq_config_nvidia(void)Hi Rafael,
If there is no other comment. Could you please add the change while applying or you prefer me sending new version ?
Please update.
Besides, I haven't said that I will apply it without changes yet.
Thanks!
Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
Quoted 44 lines
Quoted 36 lines
Quoted 26 lines
Hi Sumit,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.6-rc1 next-20230913] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Sumit-Gupta/ACPI-thermal-Add-Thermal-fast-Sampling-Period-_TFP-support/20230914-004929 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20230913164659.9345-3-sumitg%40nvidia.com patch subject: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 config: i386-defconfig (https://download.01.org/0day-ci/archive/20230914/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/Quoted 6 lines
All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/acpi/processor_thermal.c:141:6: warning: no previous declaration for 'acpi_thermal_cpufreq_config_nvidia' [-Wmissing-declarations]void acpi_thermal_cpufreq_config_nvidia(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Thank you for the report.
The below change fixes the warning for me.Quoted 7 lines
-void
acpi_thermal_cpufreq_config_nvidia(void)+static voidacpi_thermal_cpufreq_config_nvidia(void)Hi Rafael,
If there is no other comment. Could you please add the change while applying or you prefer me sending new version ?
Quoted 5 lines
Please update.
Besides, I haven't said that I will apply it without changes yet.
Thanks!
Sure, will wait for more comments and add this change in v2.
Thank you,
Sumit Gupta
kernel test robot
build botRe: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
In reply to Sumit Guptakernel test robot noticed the following build warnings:
Hi Sumit,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.6-rc1 next-20230913] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sumit-Gupta/ACPI-thermal-Add-Thermal-fast-Sampling-Period-_TFP-support/20230914-004929 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20230913164659.9345-3-sumitg%40nvidia.com patch subject: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 config: arm64-defconfig (https://download.01.org/0day-ci/archive/20230914/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/acpi/processor_thermal.c:141:6: warning: no previous prototype for 'acpi_thermal_cpufreq_config_nvidia' [-Wmissing-prototypes]
141 | void acpi_thermal_cpufreq_config_nvidia(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/acpi_thermal_cpufreq_config_nvidia +141 drivers/acpi/processor_thermal.c
140
> 141 void acpi_thermal_cpufreq_config_nvidia(void)
142 {
143 #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
144 s32 soc_id = arm_smccc_get_soc_id_version();
145
146 /* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) */
147 if ((soc_id < 0) || (soc_id != SMCCC_SOC_ID_T241))
148 return;
149
150 /* Reduce the CPUFREQ Thermal reduction percentage to 5% */
151 cpufreq_thermal_pctg = 5;
152
153 /*
154 * Derive the MAX_STEP from minimum throttle percentage so that the reduction
155 * percentage doesn't end up becoming negative. Also, cap the MAX_STEP so that
156 * the CPU performance doesn't become 0.
157 */
158 cpufreq_thermal_max_step = ((100 / cpufreq_thermal_pctg) - 1);
159 #endif
160 }
161
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
In reply to Sumit Guptakernel test robot noticed the following build warnings:
Hi Sumit,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.6-rc1 next-20230913] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sumit-Gupta/ACPI-thermal-Add-Thermal-fast-Sampling-Period-_TFP-support/20230914-004929 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20230913164659.9345-3-sumitg%40nvidia.com patch subject: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 config: i386-randconfig-062-20230914 (https://download.01.org/0day-ci/archive/20230914/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/acpi/processor_thermal.c:141:6: sparse: sparse: symbol 'acpi_thermal_cpufreq_config_nvidia' was not declared. Should it be static?
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Rafael J. Wysocki
maintainerRe: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
In reply to Sumit GuptaQuoted 23 lines · Sumit Gupta
From: Srikar Srimath Tirumala <[email protected]>
Current implementation of
processor_thermalperforms software throttling in fixed steps of "20%" which can be too coarse for some platforms. We observed some performance gain after reducing the throttle percentage. Change the CPUFREQ thermal reduction percentage and maximum thermal steps to be configurable. Also, update the default values of both for Nvidia Tegra241 (Grace) SoC. The thermal reduction percentage is reduced to "5%" and accordingly the maximum number of thermal steps are increased as they are derived from the reduction percentage.Signed-off-by Srikar Srimath Tirumala <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/acpi/processor_thermal.c | 41 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)drivers/acpi/processor_thermal.c +0
-0
drivers/acpi/processor_thermal.c line 30
Quoted 6 lines
drivers/acpi/processor_thermal.c +2
-1@@ -26,7 +26,16 @@*/ #define CPUFREQ_THERMAL_MIN_STEP 0 -#define CPUFREQ_THERMAL_MAX_STEP 3 + +static int cpufreq_thermal_max_step =3 ;
__read_mostly I suppose?
drivers/acpi/processor_thermal.c line 33
Quoted 3 lines
drivers/acpi/processor_thermal.c +3
-0+ +/* +* Minimum throttle percentage for processor_thermal cooling device.
+ *
drivers/acpi/processor_thermal.c line 38
Quoted 5 lines
drivers/acpi/processor_thermal.c +5
-0+* The processor_thermal driver uses it to calculate the percentage amount by +* which cpu frequency must be reduced for each cooling state. This is also used +* to calculate the maximum number of throttling steps or cooling states. +*/ +static int cpufreq_thermal_pctg =20 ;
__read_mostly here too?
Quoted 23 lines
drivers/acpi/processor_thermal.c +3
-2static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg);@@ -71,7 +80,7 @@ static int cpufreq_get_max_state(unsigned int cpu)if (!cpu_has_cpufreq (cpu))return 0 ; -return CPUFREQ_THERMAL_MAX_STEP ; +return cpufreq_thermal_max_step; }static int cpufreq_get_cur_state (unsigned int cpu)@@ -113,7 +122,8 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)if (!policy)return -EINVAL ; - max_freq = (policy->cpuinfo.max_freq * (100 -reduction_pctg (i) *20 )) /100 ; + max_freq = (policy->cpuinfo.max_freq * + (100 -reduction_pctg (i) * cpufreq_thermal_pctg)) /100 ;cpufreq_cpu_put (policy);
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 138
Quoted 3 lines
drivers/acpi/processor_thermal.c +0
-0@@ -126,10 +136,35 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)return 0 ; }
#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 141
Quoted 3 lines
drivers/acpi/processor_thermal.c +3
-0+#define SMCCC_SOC_ID_T241 0x036b0241 + +void acpi_thermal_cpufreq_config_nvidia (void )
static void ?
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 147
Quoted 6 lines
drivers/acpi/processor_thermal.c +6
-0+{ +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +s32 soc_id =arm_smccc_get_soc_id_version (); + +/* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) */ +if ((soc_id <0 ) || (soc_id !=SMCCC_SOC_ID_T241 ))
Inner parens are redundant.
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 158
Quoted 11 lines
drivers/acpi/processor_thermal.c +11
-0+return ; + +/* Reduce the CPUFREQ Thermal reduction percentage to 5% */ + cpufreq_thermal_pctg =5 ; + +/* +* Derive the MAX_STEP from minimum throttle percentage so that the reduction +* percentage doesn't end up becoming negative. Also, cap the MAX_STEP so that +* the CPU performance doesn't become 0. +*/ + cpufreq_thermal_max_step = ((100 / cpufreq_thermal_pctg) -1 );
Outer parens are redundant.
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 160
Quoted 2 lines
drivers/acpi/processor_thermal.c +2
-0+#endif +}
#else
static inline void void acpi_thermal_cpufreq_config_nvidia(void) {} #endif
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state)
Quoted 11 lines
drivers/acpi/processor_thermal.c +3
-1+void acpi_thermal_cpufreq_init (struct cpufreq_policy *policy) {unsigned int cpu; +acpi_thermal_cpufreq_config_nvidia (); +for_each_cpu (cpu, policy->related_cpus) {struct acpi_processor *pr =per_cpu (processors, cpu);int ret; --
And patch [1/2] needs to be rebased on the current ACPI thermal material in linux-next.
Thanks!
Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
Quoted 29 lines · Rafael J. Wysocki
External email: Use caution opening links or attachments
Quoted 25 lines · Sumit Gupta
From: Srikar Srimath Tirumala <[email protected]>
Current implementation of
processor_thermalperforms software throttling in fixed steps of "20%" which can be too coarse for some platforms. We observed some performance gain after reducing the throttle percentage. Change the CPUFREQ thermal reduction percentage and maximum thermal steps to be configurable. Also, update the default values of both for Nvidia Tegra241 (Grace) SoC. The thermal reduction percentage is reduced to "5%" and accordingly the maximum number of thermal steps are increased as they are derived from the reduction percentage.Signed-off-by Srikar Srimath Tirumala <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/acpi/processor_thermal.c | 41 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)drivers/acpi/processor_thermal.c +0
-0@@ -26,7 +26,16 @@*/
Quoted 7 lines
drivers/acpi/processor_thermal.c line 30
Quoted 4 lines
drivers/acpi/processor_thermal.c +2
-1#define CPUFREQ_THERMAL_MIN_STEP 0 -#define CPUFREQ_THERMAL_MAX_STEP 3 + +static int cpufreq_thermal_max_step =3 ;
__read_mostlyI suppose?
Added in v3.
Quoted 6 lines
drivers/acpi/processor_thermal.c line 33
Quoted 3 lines
drivers/acpi/processor_thermal.c +3
-0+ +/* +* Minimum throttle percentage for processor_thermal cooling device. + *
Quoted 8 lines
drivers/acpi/processor_thermal.c line 38
Quoted 5 lines
drivers/acpi/processor_thermal.c +5
-0+* The processor_thermal driver uses it to calculate the percentage amount by +* which cpu frequency must be reduced for each cooling state. This is also used +* to calculate the maximum number of throttling steps or cooling states. +*/ +static int cpufreq_thermal_pctg =20 ;
__read_mostlyhere too?
Added in v3.
Quoted 29 lines
Quoted 23 lines
drivers/acpi/processor_thermal.c +3
-2static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg);@@ -71,7 +80,7 @@ static int cpufreq_get_max_state(unsigned int cpu)if (!cpu_has_cpufreq (cpu))return 0 ; -return CPUFREQ_THERMAL_MAX_STEP ; +return cpufreq_thermal_max_step; }static int cpufreq_get_cur_state (unsigned int cpu)@@ -113,7 +122,8 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)if (!policy)return -EINVAL ; - max_freq = (policy->cpuinfo.max_freq * (100 -reduction_pctg (i) *20 )) /100 ; + max_freq = (policy->cpuinfo.max_freq * + (100 -reduction_pctg (i) * cpufreq_thermal_pctg)) /100 ;cpufreq_cpu_put (policy);drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 138
Quoted 3 lines
drivers/acpi/processor_thermal.c +0
-0@@ -126,10 +136,35 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)return 0 ; }#ifdef
CONFIG_HAVE_ARM_SMCCC_DISCOVERY
Quoted 6 lines
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 141
Quoted 3 lines
drivers/acpi/processor_thermal.c +3
-0+#define SMCCC_SOC_ID_T241 0x036b0241 + +void acpi_thermal_cpufreq_config_nvidia (void )static void ?
Added in v3.
Quoted 9 lines
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 147
Quoted 6 lines
drivers/acpi/processor_thermal.c +6
-0+{ +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +s32 soc_id =arm_smccc_get_soc_id_version (); + +/* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) */ +if ((soc_id <0 ) || (soc_id !=SMCCC_SOC_ID_T241 ))Inner parens are redundant.
Removed in v3.
Quoted 5 lines
Quoted 5 lines
drivers/acpi/processor_thermal.c +5
-0+return ; + +/* Reduce the CPUFREQ Thermal reduction percentage to 5% */ + cpufreq_thermal_pctg =5 ; +
Quoted 9 lines
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 158
Quoted 6 lines
drivers/acpi/processor_thermal.c +6
-0+/* +* Derive the MAX_STEP from minimum throttle percentage so that the reduction +* percentage doesn't end up becoming negative. Also, cap the MAX_STEP so that +* the CPU performance doesn't become 0. +*/ + cpufreq_thermal_max_step = ((100 / cpufreq_thermal_pctg) -1 );Outer parens are redundant.
ACK.
Quoted 12 lines
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state) · line 160
Quoted 2 lines
drivers/acpi/processor_thermal.c +2
-0+#endif +}#else
static inline void voidacpi_thermal_cpufreq_config_nvidia(void){} #endifQuoted 5 lines
drivers/acpi/processor_thermal.c +1
-0+void acpi_thermal_cpufreq_init (struct cpufreq_policy *policy) {unsigned int cpu;
Quoted 10 lines
drivers/acpi/processor_thermal.c static int cpufreq_set_cur_state(unsigned int cpu, int state)
Quoted 6 lines
drivers/acpi/processor_thermal.c +2
-1+acpi_thermal_cpufreq_config_nvidia (); +for_each_cpu (cpu, policy->related_cpus) {struct acpi_processor *pr =per_cpu (processors, cpu);int ret; --And patch [1/2] needs to be rebased on the current ACPI thermal material in linux-next.
Ok.
Quoted 1 line
Thanks!