Skip to contentSkip to conversation

v5.7: new core kernel option missing help text

DISCUSSION Russell King - ARM Linux admin 4 participants 17 messages Jun 3, 2020 – Jun 5, 2020 1 message not in the archive

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

Hi,

A new kernel configuration option ("SCHED_THERMAL_PRESSURE") was recently added, but has no help text. This is most unhelpful when trying to configure the kernel, since one does not know what the effect of answering yes or no to this option would be.

Please supply a proper help text when adding core kernel options so that people can make an informed decision when answering the prompt, rather than just guessing.

One suggestion on IRC has been that this option has something to do with climate change.

Thanks.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up
#1 lore raw
Quoted 11 lines · Russell King - ARM Linux admin

Hi,

A new kernel configuration option ("SCHED_THERMAL_PRESSURE") was recently added, but has no help text. This is most unhelpful when trying to configure the kernel, since one does not know what the effect of answering yes or no to this option would be.

Please supply a proper help text when adding core kernel options so that people can make an informed decision when answering the prompt, rather than just guessing.

Right; does the below look good enough?

---

init/Kconfig +4 -0
index 74a5ac65644f..f40cf852d00a 100644
@@ -441,6 +441,10 @@ config HAVE_SCHED_AVG_IRQ
 config SCHED_THERMAL_PRESSURE
        bool "Enable periodic averaging of thermal pressure"
        depends on SMP
+	help
+	  This option allows the scheduler to be aware of CPU thermal throttling
+	  (i.e. thermal pressure), providing arch_scale_thermal_pressure() is
+	  implemented.
 
 config BSD_PROCESS_ACCT
        bool "BSD Process Accounting"

---

#2 lore raw
Quoted 9 lines · Valentin Schneider
Quoted 7 lines · Russell King - ARM Linux admin

Hi,

A new kernel configuration option ("SCHED_THERMAL_PRESSURE") was recently added, but has no help text. This is most unhelpful when trying to configure the kernel, since one does not know what the effect of answering yes or no to this option would be.

Quoted 6 lines
Quoted 4 lines

Please supply a proper help text when adding core kernel options so that people can make an informed decision when answering the prompt, rather than just guessing.

Right; does the below look good enough?

It's a start. I'm still wondering whether I should answer yes or no for the platforms I'm building for.

So far, all I've found is:

arch/arm/include/asm/topology.h:#define arch_scale_thermal_pressure topology_get_thermal_pressure

which really doesn't tell me anything about this. So I'm still in the dark.

I guess topology_get_thermal_pressure is provided by something in drivers/ which will be conditional on some driver or something.

Quoted 19 lines

---

init/Kconfig +4 -1
index 74a5ac65644f..f40cf852d00a 100644
@@ -441,6 +441,10 @@ config HAVE_SCHED_AVG_IRQ
 config SCHED_THERMAL_PRESSURE
        bool "Enable periodic averaging of thermal pressure"
        depends on SMP
+	help
+	  This option allows the scheduler to be aware of CPU thermal throttling
+	  (i.e. thermal pressure), providing arch_scale_thermal_pressure() is
+	  implemented.
 
 config BSD_PROCESS_ACCT
        bool "BSD Process Accounting"
---
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up
#3 lore raw
Quoted 23 lines · Russell King - ARM Linux admin
Quoted 9 lines · Valentin Schneider
Quoted 7 lines · Russell King - ARM Linux admin

Hi,

A new kernel configuration option ("SCHED_THERMAL_PRESSURE") was recently added, but has no help text. This is most unhelpful when trying to configure the kernel, since one does not know what the effect of answering yes or no to this option would be.

Quoted 6 lines
Quoted 4 lines

Please supply a proper help text when adding core kernel options so that people can make an informed decision when answering the prompt, rather than just guessing.

Right; does the below look good enough?

It's a start. I'm still wondering whether I should answer yes or no for the platforms I'm building for.

So far, all I've found is:

Quoted 7 lines

arch/arm/include/asm/topology.h:#define arch_scale_thermal_pressure topology_get_thermal_pressure

which really doesn't tell me anything about this. So I'm still in the dark.

I guess topology_get_thermal_pressure is provided by something in drivers/ which will be conditional on some driver or something.

You need cpufreq_cooling device to make it useful and only for SMP I don't think that this should not be user configurable because even with the description above, it is not easy to choose. This should be set by the driver that implement the feature which is only cpufreq cooling device for now it

Quoted 24 lines
Quoted 10 lines

---

init/Kconfig +0 -0
index 74a5ac65644f..f40cf852d00a 100644
@@ -441,6 +441,10 @@ config HAVE_SCHED_AVG_IRQ
 config SCHED_THERMAL_PRESSURE

init/Kconfig config HAVE_SCHED_AVG_IRQ

Quoted 10 lines
init/Kconfig +4 -1
        bool "Enable periodic averaging of thermal pressure"
        depends on SMP
+     help
+       This option allows the scheduler to be aware of CPU thermal throttling
+       (i.e. thermal pressure), providing arch_scale_thermal_pressure() is
+       implemented.
 
 config BSD_PROCESS_ACCT
        bool "BSD Process Accounting"
---

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up

#4 lore raw
Quoted 12 lines · Vincent Guittot
Quoted 10 lines · Russell King - ARM Linux admin

It's a start. I'm still wondering whether I should answer yes or no for the platforms I'm building for.

So far, all I've found is:

arch/arm/include/asm/topology.h:#define arch_scale_thermal_pressure topology_get_thermal_pressure

which really doesn't tell me anything about this. So I'm still in the dark.

Quoted 8 lines
Quoted 2 lines

I guess topology_get_thermal_pressure is provided by something in drivers/ which will be conditional on some driver or something.

You need cpufreq_cooling device to make it useful and only for SMP I don't think that this should not be user configurable because even with the description above, it is not easy to choose. This should be set by the driver that implement the feature which is only cpufreq cooling device for now it

As I have CONFIG_CPU_FREQ_THERMAL=y in my config, I'm guessing (and it's only a guess) that I should say y to SCHED_THERMAL_PRESSURE ?

Quoted 4 lines
Quoted 4 lines

init/Kconfig config HAVE_SCHED_AVG_IRQ · line 447

Quoted 4 lines
init/Kconfig +4 -0
+     help
+       This option allows the scheduler to be aware of CPU thermal throttling
+       (i.e. thermal pressure), providing arch_scale_thermal_pressure() is
+       implemented.

Is this feature documented in terms of what it does? Do I assume that as the thermal trip points start tripping, that has an influence on the scheduler? Or is it the case that the scheduler is wanting to know when the cpu frequency changes?

Grepping for "thermal" in Documentation/scheduler brings up nothing.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up
#5 lore raw
Quoted 17 lines · Russell King - ARM Linux admin
Quoted 15 lines · Vincent Guittot
Quoted 12 lines · Russell King - ARM Linux admin

It's a start. I'm still wondering whether I should answer yes or no for the platforms I'm building for.

So far, all I've found is:

arch/arm/include/asm/topology.h:#define arch_scale_thermal_pressure topology_get_thermal_pressure

which really doesn't tell me anything about this. So I'm still in the dark.

I guess topology_get_thermal_pressure is provided by something in drivers/ which will be conditional on some driver or something.

Quoted 8 lines
Quoted 5 lines

You need cpufreq_cooling device to make it useful and only for SMP I don't think that this should not be user configurable because even with the description above, it is not easy to choose. This should be set by the driver that implement the feature which is only cpufreq cooling device for now it

As I have CONFIG_CPU_FREQ_THERMAL=y in my config, I'm guessing (and it's only a guess) that I should say y to SCHED_THERMAL_PRESSURE ?

yes, you're right

Quoted 10 lines
Quoted 5 lines
Quoted 5 lines

init/Kconfig config HAVE_SCHED_AVG_IRQ · line 447

Quoted 5 lines
init/Kconfig +4 -0
+     help
+       This option allows the scheduler to be aware of CPU thermal throttling
+       (i.e. thermal pressure), providing arch_scale_thermal_pressure() is
+       implemented.

Is this feature documented in terms of what it does? Do I assume that as the thermal trip points start tripping, that has an influence on the scheduler? Or is it the case that the scheduler is wanting to know when the cpu frequency changes?

When the thermal trip points start tripping, we take into account the decrease of the compute capacity of the CU. This reduced capacity is used instead of max capacity when we balance the tasks between CPUs.

A similar mechanism is used to account the time "stolen" by IRQ or RT/DL tasks to CFS tasks

Quoted 2 lines

Grepping for "thermal" in Documentation/scheduler brings up nothing.

John Mathew sent a patch to add documentation:
https://lkml.org/lkml/2020/5/14/290

Quoted 4 lines

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up

#6 lore raw
In reply to Russell King - ARM Linux admin
Quoted 16 lines · Russell King - ARM Linux admin
Quoted 15 lines · Vincent Guittot
Quoted 12 lines · Russell King - ARM Linux admin

It's a start. I'm still wondering whether I should answer yes or no for the platforms I'm building for.

So far, all I've found is:

arch/arm/include/asm/topology.h:#define arch_scale_thermal_pressure topology_get_thermal_pressure

which really doesn't tell me anything about this. So I'm still in the dark.

I guess topology_get_thermal_pressure is provided by something in drivers/ which will be conditional on some driver or something.

Quoted 9 lines
Quoted 5 lines

You need cpufreq_cooling device to make it useful and only for SMP I don't think that this should not be user configurable because even with the description above, it is not easy to choose. This should be set by the driver that implement the feature which is only cpufreq cooling device for now it

As I have CONFIG_CPU_FREQ_THERMAL=y in my config, I'm guessing (and it's only a guess) that I should say y to SCHED_THERMAL_PRESSURE ?

arm and arm64 implement arch_scale_thermal_pressure(); the actual implementation is in the arch_topology "driver" (GENERIC_ARCH_TOPOLOGY).

Then, the caller of arch_set_thermal_pressure() is cpufreq_cooling (see below); that'll only get called if you have thermal zones using CPU cooling devices.

AFAICT the current state of things imply we should have something like

        depends on (ARM || ARM64) && GENERIC_ARCH_TOPOLOGY

for that option.

Quoted 11 lines
Quoted 4 lines
Quoted 4 lines

init/Kconfig config HAVE_SCHED_AVG_IRQ · line 447

Quoted 4 lines
init/Kconfig +4 -0
+     help
+       This option allows the scheduler to be aware of CPU thermal throttling
+       (i.e. thermal pressure), providing arch_scale_thermal_pressure() is
+       implemented.

Is this feature documented in terms of what it does? Do I assume that as the thermal trip points start tripping, that has an influence on the scheduler? Or is it the case that the scheduler is wanting to know when the cpu frequency changes?

Grepping for "thermal" in Documentation/scheduler brings up nothing.

The former; changing a CPU cooling device's state (IOW changing its max allowed frequency for thermal reasons) leads to a call to arch_set_thermal_pressure() (see cpufreq_cooling.c::cpufreq_set_cur_state()).

It's somewhat interesting to have, at least in theory. On plain SMP that would let the scheduler see if some CPUs are more throttled that others, which would be leveraged when doing load balancing. It's more interesting for big.LITTLE & co, where in the worst cases we can have things like capacity inversion, i.e. the bigs are so thermally throttled that they give less oomf than a LITTLE.

#7 lore raw
Quoted 35 lines · Valentin Schneider
Quoted 16 lines · Russell King - ARM Linux admin
Quoted 15 lines · Vincent Guittot
Quoted 12 lines · Russell King - ARM Linux admin

It's a start. I'm still wondering whether I should answer yes or no for the platforms I'm building for.

So far, all I've found is:

arch/arm/include/asm/topology.h:#define arch_scale_thermal_pressure topology_get_thermal_pressure

which really doesn't tell me anything about this. So I'm still in the dark.

I guess topology_get_thermal_pressure is provided by something in drivers/ which will be conditional on some driver or something.

Quoted 9 lines
Quoted 5 lines

You need cpufreq_cooling device to make it useful and only for SMP I don't think that this should not be user configurable because even with the description above, it is not easy to choose. This should be set by the driver that implement the feature which is only cpufreq cooling device for now it

As I have CONFIG_CPU_FREQ_THERMAL=y in my config, I'm guessing (and it's only a guess) that I should say y to SCHED_THERMAL_PRESSURE ?

arm and arm64 implement arch_scale_thermal_pressure(); the actual implementation is in the arch_topology "driver" (GENERIC_ARCH_TOPOLOGY).

Then, the caller of arch_set_thermal_pressure() is cpufreq_cooling (see below); that'll only get called if you have thermal zones using CPU cooling devices.

Quoted 5 lines

AFAICT the current state of things imply we should have something like

         depends on (ARM || ARM64) && GENERIC_ARCH_TOPOLOGY

for that option.

Hi Russel/Valentin

The feature itself like Valentin explained below allows scheduler to be aware of cpu capacity reduced due to thermal throttling. arch_set_thermal_pressure feeds the capped capacity to the scheduler and hence the feature makes sense only if arch_set_thermal_pressure is implemented. Having said that arch_set_thermal_pressure is implemented in arch_topology driver for arm and arm64 platforms. But the feature itself is not bound to arm/arm64 platforms. So it would make it wrong to add a "depends on (ARM || ARM64) option."

I agree with Vincent that allowing user to choose this option is probably not the best. IMO, this should be enabled by default in arm64 defconfig considering both GENERIC_ARCH_TOPOLOGY and CPU_FREQ_THERMAL are enabled by default. So if it is acceptable three things to be done are:
1. Add the help text.
2. Don't allow SCHED_THERMAL_PRESSURE configurable by user
3. Enable it by default in arm64 defconfig

Quoted 25 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

init/Kconfig config HAVE_SCHED_AVG_IRQ · line 447

Quoted 5 lines
init/Kconfig +4 -0
+     help
+       This option allows the scheduler to be aware of CPU thermal throttling
+       (i.e. thermal pressure), providing arch_scale_thermal_pressure() is
+       implemented.
Quoted 6 lines

Is this feature documented in terms of what it does? Do I assume that as the thermal trip points start tripping, that has an influence on the scheduler? Or is it the case that the scheduler is wanting to know when the cpu frequency changes?

Grepping for "thermal" in Documentation/scheduler brings up nothing.

The former; changing a CPU cooling device's state (IOW changing its max allowed frequency for thermal reasons) leads to a call to arch_set_thermal_pressure() (see cpufreq_cooling.c::cpufreq_set_cur_state()).

It's somewhat interesting to have, at least in theory. On plain SMP that would let the scheduler see if some CPUs are more throttled that others, which would be leveraged when doing load balancing. It's more interesting for big.LITTLE & co, where in the worst cases we can have things like capacity inversion, i.e. the bigs are so thermally throttled that they give less oomf than a LITTLE.

Signature · 2 lines
Warm Regards
Thara
#8 lore raw
Quoted 11 lines · Thara Gopinath

Hi Russel/Valentin

The feature itself like Valentin explained below allows scheduler to be aware of cpu capacity reduced due to thermal throttling. arch_set_thermal_pressure feeds the capped capacity to the scheduler and hence the feature makes sense only if arch_set_thermal_pressure is implemented. Having said that arch_set_thermal_pressure is implemented in arch_topology driver for arm and arm64 platforms. But the feature itself is not bound to arm/arm64 platforms. So it would make it wrong to add a "depends on (ARM || ARM64) option."

Quoted 4 lines

I agree with Vincent that allowing user to choose this option is probably not the best. IMO, this should be enabled by default in arm64 defconfig considering both GENERIC_ARCH_TOPOLOGY and CPU_FREQ_THERMAL are enabled by default.

Right, I had skimmed over that but it probably does make more sense not to bother users with it.

Quoted 4 lines

So if it is acceptable three things to be done are:
1. Add the help text.
2. Don't allow SCHED_THERMAL_PRESSURE configurable by user
3. Enable it by default in arm64 defconfig

... and arm as well, I suppose?

#9 lore raw
Quoted 21 lines · Valentin Schneider
Quoted 11 lines · Thara Gopinath

Hi Russel/Valentin

The feature itself like Valentin explained below allows scheduler to be aware of cpu capacity reduced due to thermal throttling. arch_set_thermal_pressure feeds the capped capacity to the scheduler and hence the feature makes sense only if arch_set_thermal_pressure is implemented. Having said that arch_set_thermal_pressure is implemented in arch_topology driver for arm and arm64 platforms. But the feature itself is not bound to arm/arm64 platforms. So it would make it wrong to add a "depends on (ARM || ARM64) option."

Quoted 4 lines

I agree with Vincent that allowing user to choose this option is probably not the best. IMO, this should be enabled by default in arm64 defconfig considering both GENERIC_ARCH_TOPOLOGY and CPU_FREQ_THERMAL are enabled by default.

Right, I had skimmed over that but it probably does make more sense not to bother users with it.

Quoted 6 lines
Quoted 4 lines

So if it is acceptable three things to be done are:
1. Add the help text.
2. Don't allow SCHED_THERMAL_PRESSURE configurable by user
3. Enable it by default in arm64 defconfig

... and arm as well, I suppose?

If it's not a user visible option, then there's no point it being in defconfig.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up
#10 lore raw
Quoted 27 lines · Russell King - ARM Linux admin
Quoted 26 lines · Valentin Schneider
Quoted 11 lines · Thara Gopinath

Hi Russel/Valentin

The feature itself like Valentin explained below allows scheduler to be aware of cpu capacity reduced due to thermal throttling. arch_set_thermal_pressure feeds the capped capacity to the scheduler and hence the feature makes sense only if arch_set_thermal_pressure is implemented. Having said that arch_set_thermal_pressure is implemented in arch_topology driver for arm and arm64 platforms. But the feature itself is not bound to arm/arm64 platforms. So it would make it wrong to add a "depends on (ARM || ARM64) option."

Quoted 4 lines

I agree with Vincent that allowing user to choose this option is probably not the best. IMO, this should be enabled by default in arm64 defconfig considering both GENERIC_ARCH_TOPOLOGY and CPU_FREQ_THERMAL are enabled by default.

Right, I had skimmed over that but it probably does make more sense not to bother users with it.

Quoted 4 lines

So if it is acceptable three things to be done are:
1. Add the help text.
2. Don't allow SCHED_THERMAL_PRESSURE configurable by user
3. Enable it by default in arm64 defconfig

Quoted 4 lines
Quoted 1 line

... and arm as well, I suppose?

If it's not a user visible option, then there's no point it being in defconfig.

Right, s/defconfig/arch kconfig/ or somesuch.

#12 lore raw
In reply to a message not in the archive
Quoted 5 lines · Thara Gopinath

On Thu, 4 Jun 2020 at 06:56, Valentin Schneider <[email protected]>

Quoted 3 lines

Right, s/defconfig/arch kconfig/ or somesuch.

Quoted 8 lines

CPU_FREQ_THERMAL also has to be enabled for this to be effective.
Since arm64 defconfig enables CPU_FREQ_THERMAL (by enabling CPU_THERMAL), it should be ok to enable it in arm64/Kconfig. (same with arm/Kconfig)

Another option is to select the SCHED_THERMAL_PRESSURE when CPU_FREQ_THERMAL
is enabled in drivers/thermal/Kconfig.

So interestingly while arch_set_thermal_pressure() (which just writes to a pcpu variable) is defined in sched/core.c, arch_scale_thermal_pressure() (which just returns aforementionned pcpu variable) is defined in arch_topology...

I'm thinking at this point we might as well turn the arch_scale_thermal_pressure() stub into what arch_topology does. This would effectively let any architecture use thermal pressure, providing they use cpufreq cooling.

If we want to keep changes contained to Kconfigs, for now I think the safest would be:

---

arch/arm/Kconfig +1 -0
index 16fbf74030fe..1e92080dc275 100644
@@ -46,6 +46,7 @@ config ARM
        select EDAC_ATOMIC_SCRUB
        select GENERIC_ALLOCATOR
        select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY
+	select SCHED_THERMAL_PRESSURE if GENERIC_ARCH_TOPOLOGY
        select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
        select GENERIC_CPU_AUTOPROBE
arch/arm64/Kconfig +1 -0
index 552d36cacc05..cc1944fbae51 100644
@@ -98,6 +98,7 @@ config ARM64
        select FRAME_POINTER
        select GENERIC_ALLOCATOR
        select GENERIC_ARCH_TOPOLOGY
+	select SCHED_THERMAL_PRESSURE
        select GENERIC_CLOCKEVENTS
        select GENERIC_CLOCKEVENTS_BROADCAST
        select GENERIC_CPU_AUTOPROBE
init/Kconfig +4 -1
index 74a5ac65644f..ba846f6e805b 100644
@@ -439,8 +439,11 @@ config HAVE_SCHED_AVG_IRQ
        depends on SMP
 
 config SCHED_THERMAL_PRESSURE
-	bool "Enable periodic averaging of thermal pressure"
+	def_bool n
        depends on SMP
+	depends on CPU_FREQ_THERMAL
+	help
+	  <helpful thing here>
 
 config BSD_PROCESS_ACCT
        bool "BSD Process Accounting"

---

Quoted 2 lines

Warm Regards
Thara

#13 lore raw
Quoted 21 lines · Valentin Schneider
Quoted 5 lines · Thara Gopinath

On Thu, 4 Jun 2020 at 06:56, Valentin Schneider <[email protected]>

Quoted 3 lines

Right, s/defconfig/arch kconfig/ or somesuch.

Quoted 8 lines

CPU_FREQ_THERMAL also has to be enabled for this to be effective.
Since arm64 defconfig enables CPU_FREQ_THERMAL (by enabling CPU_THERMAL), it should be ok to enable it in arm64/Kconfig. (same with arm/Kconfig)

Another option is to select the SCHED_THERMAL_PRESSURE when CPU_FREQ_THERMAL
is enabled in drivers/thermal/Kconfig.

So interestingly while arch_set_thermal_pressure() (which just writes to a pcpu variable) is defined in sched/core.c, arch_scale_thermal_pressure() (which just returns aforementionned pcpu variable) is defined in arch_topology...

Quoted 7 lines

I'm thinking at this point we might as well turn the arch_scale_thermal_pressure() stub into what arch_topology does. This would effectively let any architecture use thermal pressure, providing they use cpufreq cooling.

If we want to keep changes contained to Kconfigs, for now I think the safest would be:

Thanks Valentin. This looks good to me for now. Although, I want to state that the thermal pressure can be set by some other entity other than cpufreq cooling as well. But currently only cpufreq cooling handles it. So for now the below looks good.

Quoted 49 lines

---

arch/arm/Kconfig +1 -0
index 16fbf74030fe..1e92080dc275 100644
@@ -46,6 +46,7 @@ config ARM
         select EDAC_ATOMIC_SCRUB
         select GENERIC_ALLOCATOR
         select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY
+	select SCHED_THERMAL_PRESSURE if GENERIC_ARCH_TOPOLOGY
         select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI
         select GENERIC_CLOCKEVENTS_BROADCAST if SMP
         select GENERIC_CPU_AUTOPROBE
arch/arm64/Kconfig +1 -0
index 552d36cacc05..cc1944fbae51 100644
@@ -98,6 +98,7 @@ config ARM64
         select FRAME_POINTER
         select GENERIC_ALLOCATOR
         select GENERIC_ARCH_TOPOLOGY
+	select SCHED_THERMAL_PRESSURE
         select GENERIC_CLOCKEVENTS
         select GENERIC_CLOCKEVENTS_BROADCAST
         select GENERIC_CPU_AUTOPROBE
init/Kconfig +4 -2
index 74a5ac65644f..ba846f6e805b 100644
@@ -439,8 +439,11 @@ config HAVE_SCHED_AVG_IRQ
         depends on SMP
 
  config SCHED_THERMAL_PRESSURE
-	bool "Enable periodic averaging of thermal pressure"
+	def_bool n
         depends on SMP
+	depends on CPU_FREQ_THERMAL
+	help
+	  <helpful thing here>
 
  config BSD_PROCESS_ACCT
         bool "BSD Process Accounting"
---
Quoted 5 lines

Warm Regards
Thara

Signature · 2 lines
Warm Regards
Thara
#14 lore raw
In reply to Valentin Schneider
Quoted 36 lines · Valentin Schneider
Quoted 5 lines · Thara Gopinath

On Thu, 4 Jun 2020 at 06:56, Valentin Schneider <[email protected]>

Quoted 3 lines

Right, s/defconfig/arch kconfig/ or somesuch.

Quoted 8 lines

CPU_FREQ_THERMAL also has to be enabled for this to be effective.
Since arm64 defconfig enables CPU_FREQ_THERMAL (by enabling CPU_THERMAL), it should be ok to enable it in arm64/Kconfig. (same with arm/Kconfig)

Another option is to select the SCHED_THERMAL_PRESSURE when CPU_FREQ_THERMAL
is enabled in drivers/thermal/Kconfig.

So interestingly while arch_set_thermal_pressure() (which just writes to a pcpu variable) is defined in sched/core.c, arch_scale_thermal_pressure() (which just returns aforementionned pcpu variable) is defined in arch_topology...

I'm thinking at this point we might as well turn the arch_scale_thermal_pressure() stub into what arch_topology does. This would effectively let any architecture use thermal pressure, providing they use cpufreq cooling.

If we want to keep changes contained to Kconfigs, for now I think the safest would be:

---

arch/arm/Kconfig +0 -0
index 16fbf74030fe..1e92080dc275 100644

arch/arm/Kconfig config ARM · line 49

Quoted 4 lines
arch/arm/Kconfig +1 -0
@@ -46,6 +46,7 @@ config ARM
        select EDAC_ATOMIC_SCRUB
        select GENERIC_ALLOCATOR
        select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY
+       select SCHED_THERMAL_PRESSURE if GENERIC_ARCH_TOPOLOGY

I think that SCHED_THERMAL_PRESSURE depends on ARM_CPU_TOPOLOGY but not on GENERIC_ARCH_TOPOLOGY.
ARM_CPU_TOPOLOGY is used to define arch_scale_thermal_pressure for arm architecture
and we only use the header file of the generic arch_topology.h. Function like arch_set_thermal_pressure() is in sched/core.c

Quoted 38 lines
arch/arm/Kconfig +0 -0
        select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
        select GENERIC_CPU_AUTOPROBE
arch/arm64/Kconfig +1 -0
index 552d36cacc05..cc1944fbae51 100644
@@ -98,6 +98,7 @@ config ARM64
        select FRAME_POINTER
        select GENERIC_ALLOCATOR
        select GENERIC_ARCH_TOPOLOGY
+       select SCHED_THERMAL_PRESSURE
        select GENERIC_CLOCKEVENTS
        select GENERIC_CLOCKEVENTS_BROADCAST
        select GENERIC_CPU_AUTOPROBE
init/Kconfig +4 -2
index 74a5ac65644f..ba846f6e805b 100644
@@ -439,8 +439,11 @@ config HAVE_SCHED_AVG_IRQ
        depends on SMP
 
 config SCHED_THERMAL_PRESSURE
-       bool "Enable periodic averaging of thermal pressure"
+       def_bool n
        depends on SMP
+       depends on CPU_FREQ_THERMAL
+       help
+         <helpful thing here>
 
 config BSD_PROCESS_ACCT
        bool "BSD Process Accounting"
---
Quoted 5 lines

Warm Regards
Thara

#16 lore raw
In reply to Valentin Schneider

init/Kconfig config HAVE_SCHED_AVG_IRQ · line 442

Quoted 10 lines · Valentin Schneider
init/Kconfig +1 -1
index 74a5ac65644f..ba846f6e805b 100644
@@ -439,8 +439,11 @@ config HAVE_SCHED_AVG_IRQ
        depends on SMP
 
 config SCHED_THERMAL_PRESSURE
-	bool "Enable periodic averaging of thermal pressure"
+	def_bool n

You don't need to specify this default, as the default default is "n". "bool" will do.

You should never need to use "def_bool n" or "default n" for anything this simple. There are more complex cases where there may be multiple conditional "default" lines where it may be necessary, but the majority of cases where people use these are completely unnecessary.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up
#15 lore raw
In reply to Vincent Guittot
Quoted 11 lines · Vincent Guittot
Quoted 9 lines · Valentin Schneider

---

arch/arm/Kconfig +0 -0
index 16fbf74030fe..1e92080dc275 100644
@@ -46,6 +46,7 @@ config ARM
        select EDAC_ATOMIC_SCRUB
        select GENERIC_ALLOCATOR
        select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY
Quoted 9 lines

arch/arm/Kconfig config ARM · line 49

Quoted 1 line
arch/arm/Kconfig +1 -0
+       select SCHED_THERMAL_PRESSURE if GENERIC_ARCH_TOPOLOGY

I think that SCHED_THERMAL_PRESSURE depends on ARM_CPU_TOPOLOGY but not on GENERIC_ARCH_TOPOLOGY.
ARM_CPU_TOPOLOGY is used to define arch_scale_thermal_pressure for arm architecture
and we only use the header file of the generic arch_topology.h. Function like arch_set_thermal_pressure() is in sched/core.c

You're right, oh well... Let me spend a bit more time on this and I'll send actual patches.

#17 lore raw
In reply to Russell King - ARM Linux admin
Quoted 15 lines · Russell King - ARM Linux admin

init/Kconfig config HAVE_SCHED_AVG_IRQ · line 442

Quoted 10 lines · Valentin Schneider
init/Kconfig +1 -1
index 74a5ac65644f..ba846f6e805b 100644
@@ -439,8 +439,11 @@ config HAVE_SCHED_AVG_IRQ
        depends on SMP
 
 config SCHED_THERMAL_PRESSURE
-	bool "Enable periodic averaging of thermal pressure"
+	def_bool n

You don't need to specify this default, as the default default is "n". "bool" will do.

Quoted 4 lines

You should never need to use "def_bool n" or "default n" for anything this simple. There are more complex cases where there may be multiple conditional "default" lines where it may be necessary, but the majority of cases where people use these are completely unnecessary.

Right, thanks!