Skip to contentSkip to conversation

ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241

PATCH Applied Sumit Gupta 4 participants 6 messages Nov 23, 2023 – Dec 6, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241

From: 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.

---

Sending this patch separately as the other patch in the series is applied by Rafael in v6[1]. Revision history before this version is in the cover letter of v6[1].

Please review and provide ACK if looks fine.

v6[6] -> 7:
- Patch 2: remove CONFIG_HAVE_ARM_SMCCC_DISCOVERY ifdef check [Sudeep]. : replace SMCC macro with CONFIG_ARM64 in internal.h [Sudeep].

[1] https://lore.kernel.org/lkml/[email protected]/

 drivers/acpi/arm64/Makefile          |  1 +
 drivers/acpi/arm64/thermal_cpufreq.c | 20 ++++++++++++
 drivers/acpi/internal.h              |  9 +++++
 drivers/acpi/processor_thermal.c     | 49 +++++++++++++++++++++++-----
 4 files changed, 70 insertions(+), 9 deletions(-)
 create mode 100644 drivers/acpi/arm64/thermal_cpufreq.c
drivers/acpi/arm64/Makefile +1 -0
index 143debc1ba4a..726944648c9b 100644
@@ -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 +20 -0
new file mode 100644
index 000000000000..d524f2cd6044
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/acpi.h>
+
+#include "../internal.h"
+
+#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;
+}
drivers/acpi/internal.h +9 -0
index 8cd2d15dec11..bcef1ce1aed9 100644
@@ -90,6 +90,15 @@ int acpi_passive_trip_temp(struct acpi_device *adev, int *ret_temp);
 int acpi_hot_trip_temp(struct acpi_device *adev, int *ret_temp);
 int acpi_critical_trip_temp(struct acpi_device *adev, int *ret_temp);
 
+#ifdef CONFIG_ARM64
+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
Acked-by on v7 1/1
#1 lore raw
Quoted 14 lines · Sumit Gupta

From: 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.

Quoted 8 lines

---

Sending this patch separately as the other patch in the series is applied by Rafael in v6[1]. Revision history before this version is in the cover letter of v6[1].

Please review and provide ACK if looks fine.

For arm64 specific changes(a minor nit below though),

[...]

drivers/acpi/arm64/thermal_cpufreq.c line 7

Quoted 13 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +7 -0
new file mode 100644
index 000000000000..d524f2cd6044
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/acpi.h>
+
+#include "../internal.h"
+
+#define SMCCC_SOC_ID_T241      0x036b0241
+

[nit] We really need to find better place to define this globally and not locally at each usage site like this. We already have it in GICv3 driver. But that can come as a cleanup later if it causes issue for merging this change.

Signature · 2 lines
Regards,
Sudeep
#2 lore raw
Quoted 27 lines · Sudeep Holla

External email: Use caution opening links or attachments

Quoted 14 lines · Sumit Gupta

From: 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.

Quoted 8 lines

---

Sending this patch separately as the other patch in the series is applied by Rafael in v6[1]. Revision history before this version is in the cover letter of v6[1].

Please review and provide ACK if looks fine.

Quoted 7 lines

For arm64 specific changes(a minor nit below though),

[...]

Thank you.

Quoted 19 lines

drivers/acpi/arm64/thermal_cpufreq.c line 7

Quoted 13 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +7 -0
new file mode 100644
index 000000000000..d524f2cd6044
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/acpi.h>
+
+#include "../internal.h"
+
+#define SMCCC_SOC_ID_T241      0x036b0241
+

[nit] We really need to find better place to define this globally and not locally at each usage site like this. We already have it in GICv3 driver. But that can come as a cleanup later if it causes issue for merging this change.

Quoted 3 lines

--
Regards,
Sudeep

Sure, will check and send a separate patch later on top.

Best Regards,
Sumit Gupta

maintainer Acked-by
#3 lore raw
In reply to Sudeep Holla
Quoted 41 lines · Sudeep Holla
Quoted 14 lines · Sumit Gupta

From: 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.

Quoted 8 lines

---

Sending this patch separately as the other patch in the series is applied by Rafael in v6[1]. Revision history before this version is in the cover letter of v6[1].

Please review and provide ACK if looks fine.

For arm64 specific changes(a minor nit below though),

[...]

Quoted 10 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +4 -0
new file mode 100644
index 000000000000..d524f2cd6044
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/acpi.h>
+
+#include "../internal.h"
Quoted 8 lines

drivers/acpi/arm64/thermal_cpufreq.c line 7

Quoted 3 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +3 -0
+
+#define SMCCC_SOC_ID_T241      0x036b0241
+

[nit] We really need to find better place to define this globally and not locally at each usage site like this. We already have it in GICv3 driver. But that can come as a cleanup later if it causes issue for merging this change.

Agreed.

Looks good to me as well.

Thanks
Hanjun

#4 lore raw
Quoted 50 lines
Quoted 41 lines
Quoted 15 lines

From: 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.

Quoted 8 lines

---

Sending this patch separately as the other patch in the series is applied by Rafael in v6[1]. Revision history before this version is in the cover letter of v6[1].

Please review and provide ACK if looks fine.

For arm64 specific changes(a minor nit below though),

[...]

Quoted 10 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +4 -0
new file mode 100644
index 000000000000..d524f2cd6044
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/acpi.h>
+
+#include "../internal.h"
Quoted 8 lines

drivers/acpi/arm64/thermal_cpufreq.c line 7

Quoted 3 lines
drivers/acpi/arm64/thermal_cpufreq.c new file +3 -0
+
+#define SMCCC_SOC_ID_T241      0x036b0241
+

[nit] We really need to find better place to define this globally and not locally at each usage site like this. We already have it in GICv3 driver. But that can come as a cleanup later if it causes issue for merging this change.

Quoted 6 lines

Agreed.

Looks good to me as well.

Hi Rafael,

If the change seems fine, could you please apply this patch?

Thanks,
Sumit

maintainer Applied
#5 lore raw
In reply to Hanjun Guo
Quoted 23 lines · Hanjun Guo
Quoted 21 lines · Sudeep Holla
Quoted 20 lines · Sumit Gupta

From: 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.

---

Sending this patch separately as the other patch in the series is applied by Rafael in v6[1]. Revision history before this version is in the cover letter of v6[1].

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Please review and provide ACK if looks fine.

For arm64 specific changes(a minor nit below though),

Applied as 6.8 material, thanks!