* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-09-13 16:46 ` [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Sumit Gupta
@ 2023-09-14 2:09 ` kernel test robot
2023-09-19 11:27 ` Sumit Gupta
2023-09-14 2:51 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: kernel test robot @ 2023-09-14 2:09 UTC (permalink / raw)
To: Sumit Gupta, rafael, rui.zhang, lenb, treding, jonathanh,
linux-acpi, linux-kernel, linux-tegra
Cc: oe-kbuild-all, sumitg, sanjayc, ksitaraman, srikars, jbrasen,
bbasu
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/202309140915.2J9OzWIZ-lkp@intel.com/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/202309140915.2J9OzWIZ-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309140915.2J9OzWIZ-lkp@intel.com/
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
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-09-14 2:09 ` kernel test robot
@ 2023-09-19 11:27 ` Sumit Gupta
2023-09-19 13:54 ` Rafael J. Wysocki
0 siblings, 1 reply; 11+ messages in thread
From: Sumit Gupta @ 2023-09-19 11:27 UTC (permalink / raw)
To: kernel test robot, rafael, rui.zhang, lenb, treding, jonathanh,
linux-acpi, linux-kernel, linux-tegra
Cc: oe-kbuild-all, sanjayc, ksitaraman, srikars, jbrasen, bbasu,
Sumit Gupta
> 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/202309140915.2J9OzWIZ-lkp@intel.com/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/202309140915.2J9OzWIZ-lkp@intel.com/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 <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202309140915.2J9OzWIZ-lkp@intel.com/
>
> 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)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
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
>
> 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
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-09-19 11:27 ` Sumit Gupta
@ 2023-09-19 13:54 ` Rafael J. Wysocki
2023-09-19 16:59 ` Sumit Gupta
0 siblings, 1 reply; 11+ messages in thread
From: Rafael J. Wysocki @ 2023-09-19 13:54 UTC (permalink / raw)
To: Sumit Gupta
Cc: kernel test robot, rafael, rui.zhang, lenb, treding, jonathanh,
linux-acpi, linux-kernel, linux-tegra, oe-kbuild-all, sanjayc,
ksitaraman, srikars, jbrasen, bbasu
On Tue, Sep 19, 2023 at 1:27 PM Sumit Gupta <sumitg@nvidia.com> wrote:
>
>
>
> > 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/202309140915.2J9OzWIZ-lkp@intel.com/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/202309140915.2J9OzWIZ-lkp@intel.com/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 <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202309140915.2J9OzWIZ-lkp@intel.com/
> >
> > 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)
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
>
> 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 ?
Please update.
Besides, I haven't said that I will apply it without changes yet.
Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-09-19 13:54 ` Rafael J. Wysocki
@ 2023-09-19 16:59 ` Sumit Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Sumit Gupta @ 2023-09-19 16:59 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: kernel test robot, rui.zhang, lenb, treding, jonathanh,
linux-acpi, linux-kernel, linux-tegra, oe-kbuild-all, sanjayc,
ksitaraman, srikars, jbrasen, bbasu, Sumit Gupta
>>
>>> 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/202309140915.2J9OzWIZ-lkp@intel.com/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/202309140915.2J9OzWIZ-lkp@intel.com/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 <lkp@intel.com>
>>> | Closes: https://lore.kernel.org/oe-kbuild-all/202309140915.2J9OzWIZ-lkp@intel.com/
>>>
>>> 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)
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>
>> 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 ?
>
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-09-13 16:46 ` [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Sumit Gupta
2023-09-14 2:09 ` kernel test robot
@ 2023-09-14 2:51 ` kernel test robot
2023-09-14 4:39 ` kernel test robot
2023-10-03 19:37 ` Rafael J. Wysocki
3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2023-09-14 2:51 UTC (permalink / raw)
To: Sumit Gupta, rafael, rui.zhang, lenb, treding, jonathanh,
linux-acpi, linux-kernel, linux-tegra
Cc: oe-kbuild-all, sumitg, sanjayc, ksitaraman, srikars, jbrasen,
bbasu
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/202309141006.XkUm1rIu-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/202309141006.XkUm1rIu-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309141006.XkUm1rIu-lkp@intel.com/
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
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-09-13 16:46 ` [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Sumit Gupta
2023-09-14 2:09 ` kernel test robot
2023-09-14 2:51 ` kernel test robot
@ 2023-09-14 4:39 ` kernel test robot
2023-10-03 19:37 ` Rafael J. Wysocki
3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2023-09-14 4:39 UTC (permalink / raw)
To: Sumit Gupta, rafael, rui.zhang, lenb, treding, jonathanh,
linux-acpi, linux-kernel, linux-tegra
Cc: oe-kbuild-all, sumitg, sanjayc, ksitaraman, srikars, jbrasen,
bbasu
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/202309141242.CUDGcSdC-lkp@intel.com/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/202309141242.CUDGcSdC-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309141242.CUDGcSdC-lkp@intel.com/
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?
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-09-13 16:46 ` [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Sumit Gupta
` (2 preceding siblings ...)
2023-09-14 4:39 ` kernel test robot
@ 2023-10-03 19:37 ` Rafael J. Wysocki
2023-10-06 15:14 ` Sumit Gupta
3 siblings, 1 reply; 11+ messages in thread
From: Rafael J. Wysocki @ 2023-10-03 19:37 UTC (permalink / raw)
To: Sumit Gupta
Cc: rafael, rui.zhang, lenb, treding, jonathanh, linux-acpi,
linux-kernel, linux-tegra, sanjayc, ksitaraman, srikars, jbrasen,
bbasu
On Wed, Sep 13, 2023 at 6:47 PM Sumit Gupta <sumitg@nvidia.com> wrote:
>
> From: Srikar Srimath Tirumala <srikars@nvidia.com>
>
> 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.
>
> Signed-off-by: Srikar Srimath Tirumala <srikars@nvidia.com>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
> drivers/acpi/processor_thermal.c | 41 +++++++++++++++++++++++++++++---
> 1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
> index b7c6287eccca..30f2801abce6 100644
> --- a/drivers/acpi/processor_thermal.c
> +++ b/drivers/acpi/processor_thermal.c
> @@ -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?
> +
> +/*
> + * 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;
__read_mostly here too?
>
> 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;
> }
>
#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
> +#define SMCCC_SOC_ID_T241 0x036b0241
> +
> +void acpi_thermal_cpufreq_config_nvidia(void)
static 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))
Inner parens are redundant.
> + 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.
> +#endif
> +}
#else
static inline void void acpi_thermal_cpufreq_config_nvidia(void) {}
#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;
> --
And patch [1/2] needs to be rebased on the current ACPI thermal
material in linux-next.
Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
2023-10-03 19:37 ` Rafael J. Wysocki
@ 2023-10-06 15:14 ` Sumit Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Sumit Gupta @ 2023-10-06 15:14 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: rui.zhang, lenb, treding, jonathanh, linux-acpi, linux-kernel,
linux-tegra, sanjayc, ksitaraman, srikars, jbrasen, bbasu,
Sumit Gupta
On 04/10/23 01:07, Rafael J. Wysocki wrote:
> External email: Use caution opening links or attachments
>
>
> On Wed, Sep 13, 2023 at 6:47 PM Sumit Gupta <sumitg@nvidia.com> wrote:
>>
>> From: Srikar Srimath Tirumala <srikars@nvidia.com>
>>
>> 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.
>>
>> Signed-off-by: Srikar Srimath Tirumala <srikars@nvidia.com>
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
>> drivers/acpi/processor_thermal.c | 41 +++++++++++++++++++++++++++++---
>> 1 file changed, 38 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
>> index b7c6287eccca..30f2801abce6 100644
>> --- a/drivers/acpi/processor_thermal.c
>> +++ b/drivers/acpi/processor_thermal.c
>> @@ -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?
>
Added in v3.
>> +
>> +/*
>> + * 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;
>
> __read_mostly here too?
>
Added in v3.
>>
>> 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;
>> }
>>
>
> #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
>
>> +#define SMCCC_SOC_ID_T241 0x036b0241
>> +
>> +void acpi_thermal_cpufreq_config_nvidia(void)
>
> static void ?
>
Added in v3.
>> +{
>> +#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.
>> + 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.
>
ACK.
>> +#endif
>> +}
>
> #else
> static inline void void acpi_thermal_cpufreq_config_nvidia(void) {}
> #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;
>> --
>
> And patch [1/2] needs to be rebased on the current ACPI thermal
> material in linux-next.
>
Ok.
> Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread