Add support for _TFP and change throttle pctg
Subsystems (4)
v6 cover Add support for _TFP and change throttle pctg
This patch set adds two improvements to get a finer control over the impact of thermal throttling on performance. Requesting to merge the patches if no further changes needed.
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%" for Tegra241 SoC.
Both patches can be applied independently.
---
v5[5] -> 6:
- Patch 1: rename passive_delay variable to delay [Rafael]
: re-structured the if check when reading _TFP [Rafael]
- Patch 2: compile thermal_cpufreq.c by default [Sudeep]
: rename arch hook to acpi_arch_thermal_cpufreq_pctg() [Sudeep] : move null functions from acpi.h to internal.h [Rafael] : rename existing reduction_pctg to reduction_step : rename cpufreq_thermal_pctg to cpufreq_thermal_reduction_pctg : update formula to get same num of max steps as old with 20%
v4[4] -> 5:
- Patch 2: fix kernel robot warning for acpi_thermal_cpufreq_pctg().
v3[3] -> 4:
- Patch 2: move ARM code from generic to new file 'thermal_cpufreq.c'. : get 'cpufreq_thermal_pctg' value for Tegra241 from new file. : move dummy/null function to 'acpi.h'.
v2[2] -> v3:
- Patch1: rebased on top of linux-next.
- Patch2: use __read_mostly for the cpufreq_thermal_* variables. : add static to new function acpi_thermal_cpufreq_config_nvidia. : add null function if CONFIG_HAVE_ARM_SMCCC_DISCOVERY undefined : removed redundant parenthesis.
v1[1] -> v2:
- Patch1: add ACPI spec section info in commit description and rebased.
- Patch2: add info about hardware in the commit description. : switched CPUFREQ THERMAL tuning macros to static variables. : 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/arm64/Makefile | 1 + drivers/acpi/arm64/thermal_cpufreq.c | 22 +++++++++++++ drivers/acpi/internal.h | 9 +++++ drivers/acpi/processor_thermal.c | 49 +++++++++++++++++++++++----- drivers/acpi/thermal.c | 12 +++++-- 5 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 drivers/acpi/arm64/thermal_cpufreq.c
[5] https://lore.kernel.org/all/[email protected]/
[4] https://lore.kernel.org/lkml/[email protected]/
[3] https://lore.kernel.org/linux-acpi/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/lkml/[email protected]/
Signature · 1 line
2.17.1
PATCH v6 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/acpi/thermal.c +9 -3
@@ -90,7 +90,7 @@ struct acpi_thermal_passive {struct acpi_thermal_trip trip;unsigned long tc1;unsigned long tc2; -unsigned long tsp; +unsigned long delay; };struct acpi_thermal_active {
@@ -404,11 +404,17 @@ static bool passive_trip_params_init(struct acpi_thermal *tz) tz->trips.passive.tc2 = tmp; + status =acpi_evaluate_integer (tz->device->handle,"_TFP" ,NULL , &tmp); +if (ACPI_SUCCESS (status)) { + tz->trips.passive.delay = tmp; +return true; + } + status =acpi_evaluate_integer (tz->device->handle,"_TSP" ,NULL , &tmp);if (ACPI_FAILURE (status))return false; - tz->trips.passive.tsp = tmp; + tz->trips.passive.delay = tmp *100 ;return true; }
@@ -904,7 +910,7 @@ static int acpi_thermal_add(struct acpi_device *device) acpi_trip = &tz->trips.passive.trip;if (acpi_thermal_trip_valid (acpi_trip)) { - passive_delay = tz->trips.passive.tsp *100 ; + passive_delay = tz->trips.passive.delay; trip->type =THERMAL_TRIP_PASSIVE ; trip->temperature =acpi_thermal_temp (tz, acpi_trip->temp_dk);
Signature · 1 line
2.17.1
Rafael J. Wysocki
maintainerRe: [Patch v6 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
Quoted 50 lines · Sumit Gupta
From: Jeff Brasen <[email protected]>
Add support of "Thermal fast Sampling Period (
_TFP)" for Passive cooling. As per [1],_TFPoverrides 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)"Signed-off-by Jeff Brasen <[email protected]>Co-developed-by Sumit Gupta <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/acpi/thermal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/acpi/thermal.c +8
-2@@ -90,7 +90,7 @@ struct acpi_thermal_passive {struct acpi_thermal_trip trip;unsigned long tc1;unsigned long tc2; -unsigned long tsp; +unsigned long delay; };struct acpi_thermal_active {@@ -404,11 +404,17 @@ static bool passive_trip_params_init(struct acpi_thermal *tz) tz->trips.passive.tc2 = tmp; + status =acpi_evaluate_integer (tz->device->handle,"_TFP" ,NULL , &tmp); +if (ACPI_SUCCESS (status)) { + tz->trips.passive.delay = tmp; +return true; + } + status =acpi_evaluate_integer (tz->device->handle,"_TSP" ,NULL , &tmp);if (ACPI_FAILURE (status))return false; - tz->trips.passive.tsp = tmp; + tz->trips.passive.delay = tmp *100 ;return true; }
drivers/acpi/thermal.c static int acpi_thermal_add(struct acpi_device *device)
Quoted 9 lines
drivers/acpi/thermal.c +1
-2@@ -904,7 +910,7 @@ static int acpi_thermal_add(struct acpi_device *device) acpi_trip = &tz->trips.passive.trip;if (acpi_thermal_trip_valid (acpi_trip)) { - passive_delay = tz->trips.passive.tsp *100 ; + passive_delay = tz->trips.passive.delay; trip->type =THERMAL_TRIP_PASSIVE ; trip->temperature =acpi_thermal_temp (tz, acpi_trip->temp_dk); --
So does the second patch in the series really depend on this one?
If not, I can apply it I think.
Re: [Patch v6 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
Quoted 60 lines · Rafael J. Wysocki
External email: Use caution opening links or attachments
Quoted 56 lines · Sumit Gupta
From: Jeff Brasen <[email protected]>
Add support of "Thermal fast Sampling Period (
_TFP)" for Passive cooling. As per [1],_TFPoverrides 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)"Signed-off-by Jeff Brasen <[email protected]>Co-developed-by Sumit Gupta <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/acpi/thermal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/acpi/thermal.c +9
-3@@ -90,7 +90,7 @@ struct acpi_thermal_passive {struct acpi_thermal_trip trip;unsigned long tc1;unsigned long tc2; -unsigned long tsp; +unsigned long delay; };struct acpi_thermal_active {@@ -404,11 +404,17 @@ static bool passive_trip_params_init(struct acpi_thermal *tz) tz->trips.passive.tc2 = tmp; + status =acpi_evaluate_integer (tz->device->handle,"_TFP" ,NULL , &tmp); +if (ACPI_SUCCESS (status)) { + tz->trips.passive.delay = tmp; +return true; + } + status =acpi_evaluate_integer (tz->device->handle,"_TSP" ,NULL , &tmp);if (ACPI_FAILURE (status))return false; - tz->trips.passive.tsp = tmp; + tz->trips.passive.delay = tmp *100 ;return true; }@@ -904,7 +910,7 @@ static int acpi_thermal_add(struct acpi_device *device) acpi_trip = &tz->trips.passive.trip;if (acpi_thermal_trip_valid (acpi_trip)) { - passive_delay = tz->trips.passive.tsp *100 ; + passive_delay = tz->trips.passive.delay;
Quoted 7 lines
drivers/acpi/thermal.c static int acpi_thermal_add(struct acpi_device *device)
Quoted 3 lines
drivers/acpi/thermal.c +0
-1trip->type =THERMAL_TRIP_PASSIVE ; trip->temperature =acpi_thermal_temp (tz, acpi_trip->temp_dk); --So does the second patch in the series really depend on this one?
If not, I can apply it I think.
Yes, this patch can be applied independently. Thank you!
Best Regards,
Sumit Gupta
Rafael J. Wysocki
maintainerRe: [Patch v6 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
Quoted 70 lines · Sumit Gupta
Quoted 66 lines · Rafael J. Wysocki
External email: Use caution opening links or attachments
Quoted 50 lines · Sumit Gupta
From: Jeff Brasen <[email protected]>
Add support of "Thermal fast Sampling Period (
_TFP)" for Passive cooling. As per [1],_TFPoverrides 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)"Signed-off-by Jeff Brasen <[email protected]>Co-developed-by Sumit Gupta <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/acpi/thermal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/acpi/thermal.c +8
-2@@ -90,7 +90,7 @@ struct acpi_thermal_passive {struct acpi_thermal_trip trip;unsigned long tc1;unsigned long tc2; -unsigned long tsp; +unsigned long delay; };struct acpi_thermal_active {@@ -404,11 +404,17 @@ static bool passive_trip_params_init(struct acpi_thermal *tz) tz->trips.passive.tc2 = tmp; + status =acpi_evaluate_integer (tz->device->handle,"_TFP" ,NULL , &tmp); +if (ACPI_SUCCESS (status)) { + tz->trips.passive.delay = tmp; +return true; + } + status =acpi_evaluate_integer (tz->device->handle,"_TSP" ,NULL , &tmp);if (ACPI_FAILURE (status))return false; - tz->trips.passive.tsp = tmp; + tz->trips.passive.delay = tmp *100 ;return true; }drivers/acpi/thermal.c static int acpi_thermal_add(struct acpi_device *device)
Quoted 9 lines
drivers/acpi/thermal.c +1
-2@@ -904,7 +910,7 @@ static int acpi_thermal_add(struct acpi_device *device) acpi_trip = &tz->trips.passive.trip;if (acpi_thermal_trip_valid (acpi_trip)) { - passive_delay = tz->trips.passive.tsp *100 ; + passive_delay = tz->trips.passive.delay; trip->type =THERMAL_TRIP_PASSIVE ; trip->temperature =acpi_thermal_temp (tz, acpi_trip->temp_dk); --So does the second patch in the series really depend on this one?
Quoted 3 lines
Quoted 1 line
If not, I can apply it I think.
Yes, this patch can be applied independently. Thank you!
OK, applied as 6.8 material (with some changelog edits), thanks!
PATCH v6 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/arm64/Makefile | 1 + drivers/acpi/arm64/thermal_cpufreq.c | 22 +++++++++++++ drivers/acpi/internal.h | 9 +++++ drivers/acpi/processor_thermal.c | 49 +++++++++++++++++++++++----- 4 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 drivers/acpi/arm64/thermal_cpufreq.c
drivers/acpi/arm64/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_ACPI_GTDT) += gtdt.o obj-$(CONFIG_ACPI_APMT) += apmt.o obj-$(CONFIG_ARM_AMBA) += amba.o obj-y += dma.o init.o +obj-y += thermal_cpufreq.o
drivers/acpi/arm64/thermal_cpufreq.c new file +22 -0
@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include <linux/acpi.h> + +#include "../internal.h" + +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +#define SMCCC_SOC_ID_T241 0x036b0241 + +int acpi_arch_thermal_cpufreq_pctg (void ) +{ +s32 soc_id =arm_smccc_get_soc_id_version (); + +/* +* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) and +* reduce the CPUFREQ Thermal reduction percentage to 5%. +*/ +if (soc_id ==SMCCC_SOC_ID_T241 ) +return 5 ; + +return 0 ; +} +#endif
drivers/acpi/internal.h +9 -0
@@ -85,6 +85,15 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);acpi_status acpi_sysfs_table_handler (u32 event,void *table,void *context);void acpi_scan_table_notify (void ); +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +int acpi_arch_thermal_cpufreq_pctg (void ); +#else +static inline int acpi_arch_thermal_cpufreq_pctg (void ) +{ +return 0 ; +} +#endif +/* -------------------------------------------------------------------------- Device Node Initialization / Removal -------------------------------------------------------------------------- */
drivers/acpi/processor_thermal.c +40 -9
103 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [Patch v6 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
Quoted 37 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]>Co-developed-by Sumit Gupta <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/acpi/arm64/Makefile | 1 + drivers/acpi/arm64/thermal_cpufreq.c | 22 +++++++++++++ drivers/acpi/internal.h | 9 +++++ drivers/acpi/processor_thermal.c | 49 +++++++++++++++++++++++----- 4 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 drivers/acpi/arm64/thermal_cpufreq.cdrivers/acpi/arm64/Makefile +1
-0@@ -5,3 +5,4 @@ obj-$(CONFIG_ACPI_GTDT) += gtdt.o obj-$(CONFIG_ACPI_APMT) += apmt.o obj-$(CONFIG_ARM_AMBA) += amba.o obj-y += dma.o init.o +obj-y += thermal_cpufreq.odrivers/acpi/arm64/thermal_cpufreq.c new file +0
-0
drivers/acpi/arm64/thermal_cpufreq.c line 7
Quoted 7 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +7
-0@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include <linux/acpi.h> + +#include "../internal.h" + +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +#define SMCCC_SOC_ID_T241 0x036b0241
Sorry for missing this earlier. Not sure if the above define needs to be conditional. Even if it has to be, CONFIG_ARM_SMCCC_SOC_ID is more appropriate.
Quoted 20 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +15
-0+ +int acpi_arch_thermal_cpufreq_pctg (void ) +{ +s32 soc_id =arm_smccc_get_soc_id_version (); + +/* +* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) and +* reduce the CPUFREQ Thermal reduction percentage to 5%. +*/ +if (soc_id ==SMCCC_SOC_ID_T241 ) +return 5 ; + +return 0 ; +} +#endif drivers/acpi/internal.h +0
-0
drivers/acpi/internal.h bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent); · line 88
Quoted 4 lines
drivers/acpi/internal.h +1
-0@@ -85,6 +85,15 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);acpi_status acpi_sysfs_table_handler (u32 event,void *table,void *context);void acpi_scan_table_notify (void ); +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
It looks weird to add a such specific ARM config option in generic ACPI code/header.
Does it make sense to add some new config this new feature you are adding or just use ARM64 and have CONFIG_HAVE_ARM_SMCCC_DISCOVERY check internally in the arch specific call.
Signature · 2 lines
Regards, Sudeep
Re: [Patch v6 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241
Quoted 39 lines
Quoted 39 lines
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]>Co-developed-by Sumit Gupta <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/acpi/arm64/Makefile | 1 + drivers/acpi/arm64/thermal_cpufreq.c | 22 +++++++++++++ drivers/acpi/internal.h | 9 +++++ drivers/acpi/processor_thermal.c | 49 +++++++++++++++++++++++----- 4 files changed, 72 insertions(+), 9 deletions(-)create mode 100644
drivers/acpi/arm64/thermal_cpufreq.cdrivers/acpi/arm64/Makefile +1
-0@@ -5,3 +5,4 @@ obj-$(CONFIG_ACPI_GTDT) += gtdt.o obj-$(CONFIG_ACPI_APMT) += apmt.o obj-$(CONFIG_ARM_AMBA) += amba.o obj-y += dma.o init.o +obj-y += thermal_cpufreq.odrivers/acpi/arm64/thermal_cpufreq.c new file +3
-0@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include <linux/acpi.h> +
Quoted 9 lines
drivers/acpi/arm64/thermal_cpufreq.c line 7
Quoted 4 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +4
-0+#include "../internal.h" + +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +#define SMCCC_SOC_ID_T241 0x036b0241Sorry for missing this earlier. Not sure if the above define needs to be conditional. Even if it has to be,
CONFIG_ARM_SMCCC_SOC_IDis more appropriate.
Will remove the ifdef.
Quoted 28 lines
Quoted 20 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +15
-0+ +int acpi_arch_thermal_cpufreq_pctg (void ) +{ +s32 soc_id =arm_smccc_get_soc_id_version (); + +/* +* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) and +* reduce the CPUFREQ Thermal reduction percentage to 5%. +*/ +if (soc_id ==SMCCC_SOC_ID_T241 ) +return 5 ; + +return 0 ; +} +#endif drivers/acpi/internal.h +0
-0drivers/acpi/internal.h bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent); · line 88
Quoted 4 lines
drivers/acpi/internal.h +1
-0@@ -85,6 +85,15 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);acpi_status acpi_sysfs_table_handler (u32 event,void *table,void *context);void acpi_scan_table_notify (void ); +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY It looks weird to add a such specific ARM config option in generic ACPI code/header.
Quoted 7 lines
Does it make sense to add some new config this new feature you are adding or just use ARM64 and have
CONFIG_HAVE_ARM_SMCCC_DISCOVERYcheck internally in the arch specific call.--
Regards,
Sudeep
Ok, will use CONFIG_ARM64 instead.
I think we don't need to check for CONFIG_HAVE_ARM_SMCCC_DISCOVERY inside the arch call as it returns zero if the soc_id value is different from Tegra241.
Best Regards,
Sumit Gupta