cpuidle: Make cpuidle governor switchable to be the default behaviour
RFC PATCH 1/1 cpuidle: Make cpuidle governor switchable to be the default behaviour
For now cpuidle governor can be switched via sysfs only when the boot option "cpuidle_sysfs_switch" is passed, but it's important to switch the governor to adapt to different workloads, especially after TEO and haltpoll governor were introduced.
Introduce a CONFIG option to make cpuidle governor switchable to be the default behaviour, which will not break the boot option behaviour.
--- drivers/cpuidle/Kconfig | 9 +++++++++ drivers/cpuidle/sysfs.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/cpuidle/Kconfig +9 -0
@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL config DT_IDLE_STATES bool +config CPU_IDLE_SWITCH_GOV_IN_DEFAULT + bool "Switch the CPU idle governor via sysfs at runtime in default behaviour" + help + Make the CPU idle governor switchable at runtime, and make it as the + default behaviour even the boot option "cpuidle_sysfs_switch" is not + passed in cmdline. + + Say N if you unsure about this. + menu "ARM CPU Idle Drivers" depends on ARM || ARM64 source "drivers/cpuidle/Kconfig.arm"
drivers/cpuidle/sysfs.c +1 -1
@@ -146,7 +146,7 @@ static DEVICE_ATTR(current_governor, 0644, show_current_governor,*/ int cpuidle_add_interface (struct device *dev) { -if (sysfs_switch) +if (IS_ENABLED (CONFIG_CPU_IDLE_SWITCH_GOV_IN_DEFAULT ) || sysfs_switch) cpuidle_attr_group.attrs = cpuidle_switch_attrs;return sysfs_create_group (&dev->kobj, &cpuidle_attr_group);
Signature · 1 line
1.7.12.4
Quoted 20 lines · Hanjun Guo
For now cpuidle governor can be switched via sysfs only when the boot option "
cpuidle_sysfs_switch" is passed, but it's important to switch the governor to adapt to different workloads, especially after TEO and haltpoll governor were introduced.Introduce a CONFIG option to make cpuidle governor switchable to be the default behaviour, which will not break the boot option behaviour.
Signed-off-by Hanjun Guo <[email protected]>--- drivers/cpuidle/Kconfig | 9 +++++++++ drivers/cpuidle/sysfs.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/cpuidle/Kconfig +0
-0@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL config DT_IDLE_STATES
drivers/cpuidle/Kconfig config CPU_IDLE_GOV_HALTPOLL · line 57
Quoted 10 lines
drivers/cpuidle/Kconfig +8
-0bool +config CPU_IDLE_SWITCH_GOV_IN_DEFAULT + bool "Switch the CPU idle governor via sysfs at runtime in default behaviour" + help + Make the CPU idle governor switchable at runtime, and make it as the + default behaviour even the boot option "cpuidle_sysfs_switch" is not + passed in cmdline. + + Say N if you unsure about this.
Well I wouldn't make this optional but just remove the sysfs_switch.
However, there is the '_ro' suffix when the option is not set. In order to not break the existing tools, may be let both files co-exist and add in the ABI/obselete the '_ro' file as candidate for removal ?
Quoted 17 lines
drivers/cpuidle/Kconfig +0
-0menu "ARM CPU Idle Drivers" depends on ARM || ARM64 source "drivers/cpuidle/Kconfig.arm"drivers/cpuidle/sysfs.c +1
-1@@ -146,7 +146,7 @@ static DEVICE_ATTR(current_governor, 0644, show_current_governor,*/ int cpuidle_add_interface (struct device *dev) { -if (sysfs_switch) +if (IS_ENABLED (CONFIG_CPU_IDLE_SWITCH_GOV_IN_DEFAULT ) || sysfs_switch) cpuidle_attr_group.attrs = cpuidle_switch_attrs;return sysfs_create_group (&dev->kobj, &cpuidle_attr_group);
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
I very much support this RFC.
I have been running only with "cpuidle_sysfs_switch" for about 2 years.
Some changes would be required for the documentation files also.
Quoted 23 lines · On 2020.04.27 06:37 Daniel Lezcano wrote:
Quoted 22 lines · Hanjun Guo
For now cpuidle governor can be switched via sysfs only when the boot option "
cpuidle_sysfs_switch" is passed, but it's important to switch the governor to adapt to different workloads, especially after TEO and haltpoll governor were introduced.Introduce a CONFIG option to make cpuidle governor switchable to be the default behaviour, which will not break the boot option behaviour.
Signed-off-by Hanjun Guo <[email protected]>--- drivers/cpuidle/Kconfig | 9 +++++++++ drivers/cpuidle/sysfs.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/cpuidle/Kconfig +0
-0@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL config DT_IDLE_STATES bool
Quoted 10 lines
drivers/cpuidle/Kconfig config CPU_IDLE_GOV_HALTPOLL · line 57
Quoted 8 lines
drivers/cpuidle/Kconfig +8
-0+config CPU_IDLE_SWITCH_GOV_IN_DEFAULT + bool "Switch the CPU idle governor via sysfs at runtime in default behaviour" + help + Make the CPU idle governor switchable at runtime, and make it as the + default behaviour even the boot option "cpuidle_sysfs_switch" is not + passed in cmdline. + + Say N if you unsure about this.Well I wouldn't make this optional but just remove the
sysfs_switch.
Agree.
Quoted 3 lines
However, there is the '
_ro' suffix when the option is not set. In order to not break the existing tools, may be let both files co-exist and add in the ABI/obselete the '_ro' file as candidate for removal ?
I do not like this _ro thing, and got hit by it with turbostat one time. Agree it should be made a candidate for removal.
Quoted 2 lines · Doug Smythies
I very much support this RFC.
I have been running only with "cpuidle_sysfs_switch" for about 2 years.
Thanks, glad to hear that switch cpuidle governor at runtime works for years.
Quoted 2 lines
Some changes would be required for the documentation files also.
I will update them in next version.
Quoted 36 lines · On 2020.04.27 06:37 Daniel Lezcano wrote:
Quoted 23 lines · Hanjun Guo
Quoted 22 lines
For now cpuidle governor can be switched via sysfs only when the boot option "
cpuidle_sysfs_switch" is passed, but it's important to switch the governor to adapt to different workloads, especially after TEO and haltpoll governor were introduced.Introduce a CONFIG option to make cpuidle governor switchable to be the default behaviour, which will not break the boot option behaviour.
Signed-off-by Hanjun Guo <[email protected]>--- drivers/cpuidle/Kconfig | 9 +++++++++ drivers/cpuidle/sysfs.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/cpuidle/Kconfig +0
-0@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL config DT_IDLE_STATES boolQuoted 10 lines
drivers/cpuidle/Kconfig config CPU_IDLE_GOV_HALTPOLL · line 57
Quoted 8 lines
drivers/cpuidle/Kconfig +8
-0+config CPU_IDLE_SWITCH_GOV_IN_DEFAULT + bool "Switch the CPU idle governor via sysfs at runtime in default behaviour" + help + Make the CPU idle governor switchable at runtime, and make it as the + default behaviour even the boot option "cpuidle_sysfs_switch" is not + passed in cmdline. + + Say N if you unsure about this.Well I wouldn't make this optional but just remove the
sysfs_switch.
Quoted 8 lines
Agree.
Quoted 3 lines
However, there is the '
_ro' suffix when the option is not set. In order to not break the existing tools, may be let both files co-exist and add in the ABI/obselete the '_ro' file as candidate for removal ?I do not like this
_rothing, and got hit by it with turbostat one time. Agree it should be made a candidate for removal.
OK, I will prepare another RFC patch set to remove sysfs_switch.
Thanks
Hanjun
Rafael J. Wysocki
maintainerQuoted 51 lines · Hanjun Guo
Quoted 2 lines · Doug Smythies
I very much support this RFC.
I have been running only with "cpuidle_sysfs_switch" for about 2 years.Thanks, glad to hear that switch cpuidle governor at runtime works for years.
Quoted 2 lines
Some changes would be required for the documentation files also.
I will update them in next version.
Quoted 38 lines · On 2020.04.27 06:37 Daniel Lezcano wrote:
Quoted 23 lines · Hanjun Guo
Quoted 22 lines
For now cpuidle governor can be switched via sysfs only when the boot option "
cpuidle_sysfs_switch" is passed, but it's important to switch the governor to adapt to different workloads, especially after TEO and haltpoll governor were introduced.Introduce a CONFIG option to make cpuidle governor switchable to be the default behaviour, which will not break the boot option behaviour.
Signed-off-by Hanjun Guo <[email protected]>--- drivers/cpuidle/Kconfig | 9 +++++++++ drivers/cpuidle/sysfs.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/cpuidle/Kconfig +0
-0@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL config DT_IDLE_STATES boolQuoted 10 lines
drivers/cpuidle/Kconfig config CPU_IDLE_GOV_HALTPOLL · line 57
Quoted 8 lines
drivers/cpuidle/Kconfig +8
-0+config CPU_IDLE_SWITCH_GOV_IN_DEFAULT + bool "Switch the CPU idle governor via sysfs at runtime in default behaviour" + help + Make the CPU idle governor switchable at runtime, and make it as the + default behaviour even the boot option "cpuidle_sysfs_switch" is not + passed in cmdline. + + Say N if you unsure about this.Well I wouldn't make this optional but just remove the
sysfs_switch.Agree.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
However, there is the '
_ro' suffix when the option is not set. In order to not break the existing tools, may be let both files co-exist and add in the ABI/obselete the '_ro' file as candidate for removal ?I do not like this
_rothing, and got hit by it with turbostat one time. Agree it should be made a candidate for removal.OK, I will prepare another RFC patch set to remove
sysfs_switch.
I would just do it in one series, though, as suggested by Daniel.
Also, I wouldn't worry about the _ro thing too much, as the changes effectively make "cpuidle_sysfs_switch" be the default (and the tools should be able to cope with "cpuidle_sysfs_switch" anyway) without an alternative (but who cares?).
Cheers!
Quoted 56 lines · Rafael J. Wysocki
Quoted 55 lines · Hanjun Guo
Quoted 2 lines · Doug Smythies
I very much support this RFC.
I have been running only with "cpuidle_sysfs_switch" for about 2 years.Thanks, glad to hear that switch cpuidle governor at runtime works for years.
Quoted 2 lines
Some changes would be required for the documentation files also.
I will update them in next version.
Quoted 42 lines · On 2020.04.27 06:37 Daniel Lezcano wrote:
Quoted 23 lines · Hanjun Guo
Quoted 22 lines
For now cpuidle governor can be switched via sysfs only when the boot option "
cpuidle_sysfs_switch" is passed, but it's important to switch the governor to adapt to different workloads, especially after TEO and haltpoll governor were introduced.Introduce a CONFIG option to make cpuidle governor switchable to be the default behaviour, which will not break the boot option behaviour.
Signed-off-by Hanjun Guo <[email protected]>--- drivers/cpuidle/Kconfig | 9 +++++++++ drivers/cpuidle/sysfs.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/cpuidle/Kconfig +0
-0@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL config DT_IDLE_STATES boolQuoted 10 lines
drivers/cpuidle/Kconfig config CPU_IDLE_GOV_HALTPOLL · line 57
Quoted 8 lines
drivers/cpuidle/Kconfig +8
-0+config CPU_IDLE_SWITCH_GOV_IN_DEFAULT + bool "Switch the CPU idle governor via sysfs at runtime in default behaviour" + help + Make the CPU idle governor switchable at runtime, and make it as the + default behaviour even the boot option "cpuidle_sysfs_switch" is not + passed in cmdline. + + Say N if you unsure about this.Well I wouldn't make this optional but just remove the
sysfs_switch.Agree.
Quoted 3 lines
However, there is the '
_ro' suffix when the option is not set. In order to not break the existing tools, may be let both files co-exist and add in the ABI/obselete the '_ro' file as candidate for removal ?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I do not like this
_rothing, and got hit by it with turbostat one time. Agree it should be made a candidate for removal.OK, I will prepare another RFC patch set to remove
sysfs_switch.I would just do it in one series, though, as suggested by Daniel.
OK, will sent out the patchset today.
Quoted 5 lines
Also, I wouldn't worry about the
_rothing too much, as the changes effectively make "cpuidle_sysfs_switch" be the default (and the tools should be able to cope with "cpuidle_sysfs_switch" anyway) without an alternative (but who cares?).
Thanks
Hanjun
Quoted 23 lines · Daniel Lezcano
Quoted 22 lines · Hanjun Guo
For now cpuidle governor can be switched via sysfs only when the boot option "
cpuidle_sysfs_switch" is passed, but it's important to switch the governor to adapt to different workloads, especially after TEO and haltpoll governor were introduced.Introduce a CONFIG option to make cpuidle governor switchable to be the default behaviour, which will not break the boot option behaviour.
Signed-off-by Hanjun Guo <[email protected]>--- drivers/cpuidle/Kconfig | 9 +++++++++ drivers/cpuidle/sysfs.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/cpuidle/Kconfig +0
-0@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL config DT_IDLE_STATES bool
Quoted 10 lines
drivers/cpuidle/Kconfig config CPU_IDLE_GOV_HALTPOLL · line 57
Quoted 8 lines
drivers/cpuidle/Kconfig +8
-0+config CPU_IDLE_SWITCH_GOV_IN_DEFAULT + bool "Switch the CPU idle governor via sysfs at runtime in default behaviour" + help + Make the CPU idle governor switchable at runtime, and make it as the + default behaviour even the boot option "cpuidle_sysfs_switch" is not + passed in cmdline. + + Say N if you unsure about this.Well I wouldn't make this optional but just remove the
sysfs_switch.
That's my first solution but I send this RFC patch as it's less aggressive :), I'm happy to get your comments to remove the sysfs_switch, I will prepare patches for this solution.
Quoted 4 lines
However, there is the '
_ro' suffix when the option is not set. In order to not break the existing tools, may be let both files co-exist and add in the ABI/obselete the '_ro' file as candidate for removal ?
Agreed.
Thanks
Hanjun