mbox series

[0/4] Allow cpuidle governors to be compiled as modules

Message ID 1637830481-21709-1-git-send-email-quic_mkshah@quicinc.com (mailing list archive)
Headers show
Series Allow cpuidle governors to be compiled as modules | expand

Message

Maulik Shah Nov. 25, 2021, 8:54 a.m. UTC
This series makes changes to allow cpuidle governors menu, ladder and teo
to compiled as modules when building with allmodconfig.

Patch 3 of the series is taken from [1] which brings back the change
removed in Commit 83788c0caed3 ("cpuidle: remove unused exports").

[1] https://lore.kernel.org/all/010101746fc98add-45e77496-d2d6-4bc1-a1ce-0692599a9a7a-000000@us-west-2.amazonses.com/

Lina Iyer (1):
  cpuidle: governor: export cpuidle governor functions

Maulik Shah (3):
  tick/sched: Export symbols used by cpuidle governors
  sched/core: Export symbols used by cpuidle governors
  cpuidle: governors: Allow the governors to be compiled as modules

 drivers/cpuidle/Kconfig            | 6 +++---
 drivers/cpuidle/governor.c         | 2 ++
 drivers/cpuidle/governors/ladder.c | 4 ++++
 drivers/cpuidle/governors/menu.c   | 4 ++++
 drivers/cpuidle/governors/teo.c    | 4 ++++
 kernel/sched/core.c                | 1 +
 kernel/time/tick-sched.c           | 5 +++++
 7 files changed, 23 insertions(+), 3 deletions(-)

Comments

Rafael J. Wysocki Nov. 25, 2021, 12:27 p.m. UTC | #1
On Thu, Nov 25, 2021 at 9:55 AM Maulik Shah <quic_mkshah@quicinc.com> wrote:
>
> This series makes changes to allow cpuidle governors menu, ladder and teo
> to compiled as modules when building with allmodconfig.

What's the purpose of this?
Maulik Shah Nov. 25, 2021, 1:18 p.m. UTC | #2
Hi Rafael,

On 11/25/2021 5:57 PM, Rafael J. Wysocki wrote:
> On Thu, Nov 25, 2021 at 9:55 AM Maulik Shah <quic_mkshah@quicinc.com> wrote:
>> This series makes changes to allow cpuidle governors menu, ladder and teo
>> to compiled as modules when building with allmodconfig.
> What's the purpose of this?

There are two purposes of this series.

1. The series enables cpuidle governors to be allowed to compiled as 
modules.
     This is something similar to what cpufreq/devfreq governors do 
today as they can be be compiled as modules or built-in depending on the 
build config.

2. The series will also enable custom cpuidle governor to be able to 
register with cpuidle framework by using cpuidle_register_governor() API.
     This will be already achieved by (1) since it will export the 
required APIs for menu/ladder/teo governors to be compiled as module.

Thanks,
Maulik
Rafael J. Wysocki Nov. 25, 2021, 3:46 p.m. UTC | #3
On Thu, Nov 25, 2021 at 2:18 PM Maulik Shah <quic_mkshah@quicinc.com> wrote:
>
> Hi Rafael,
>
> On 11/25/2021 5:57 PM, Rafael J. Wysocki wrote:
> > On Thu, Nov 25, 2021 at 9:55 AM Maulik Shah <quic_mkshah@quicinc.com> wrote:
> >> This series makes changes to allow cpuidle governors menu, ladder and teo
> >> to compiled as modules when building with allmodconfig.
> > What's the purpose of this?
>
> There are two purposes of this series.
>
> 1. The series enables cpuidle governors to be allowed to compiled as
> modules.
>      This is something similar to what cpufreq/devfreq governors do
> today as they can be be compiled as modules or built-in depending on the
> build config.

Which is not the case for all of them, though, and I don't see why
this would imply that making cpuidle governors modular would be
useful.

> 2. The series will also enable custom cpuidle governor to be able to
> register with cpuidle framework by using cpuidle_register_governor() API.
>      This will be already achieved by (1) since it will export the
> required APIs for menu/ladder/teo governors to be compiled as module.

No custom cpuidle governors in the mainline, please.  If you have one
you want to be included, please submit it.

So from the mainline perspective this series doesn't serve any useful
purpose at all.

Sorry about that.
Doug Smythies Nov. 25, 2021, 5:16 p.m. UTC | #4
Hi All,

I realize that previous replies render this one useless
but sending anyhow.

On 2021.11.25 00:55 Maulik Shah wrote:

> This series makes changes to allow cpuidle governors
> menu, ladder and teo to compiled as modules when
> building with allmodconfig.

One current issue with governors being available as modules
is that they don't appear on the available governors list unless
they are loaded.

Example with this patch set, all done as modules:

~$ grep . /sys/devices/system/cpu/cpuidle/*
/sys/devices/system/cpu/cpuidle/current_driver:none
/sys/devices/system/cpu/cpuidle/current_governor:none
/sys/devices/system/cpu/cpuidle/current_governor_ro:none

However, and based on my systems power consumption,
some sort of idle must be running.

~$ echo teo | sudo tee /sys/devices/system/cpu/cpuidle/current_governor
teo
tee: /sys/devices/system/cpu/cpuidle/current_governor: Invalid argument

~$ sudo modprobe teo
~$ grep . /sys/devices/system/cpu/cpuidle/*
/sys/devices/system/cpu/cpuidle/available_governors:teo
/sys/devices/system/cpu/cpuidle/current_driver:none
/sys/devices/system/cpu/cpuidle/current_governor:teo
/sys/devices/system/cpu/cpuidle/current_governor_ro:teo

By the way, for the cpufreq stuff, while governors that
are actually available, but are modules, changing to them
without first force loading the module works:

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors:performance schedutil
/sys/devices/system/cpu/cpu10/cpufreq/scaling_available_governors:performance schedutil
...

$ echo ondemand | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
ondemand

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors:ondemand performance schedutil
/sys/devices/system/cpu/cpu10/cpufreq/scaling_available_governors:ondemand performance schedutil

... Doug