Re: [PATCH] powercap/drivers/idle_inject: Specify idle state max latency

From: Rafael J. Wysocki
Date: Thu Mar 26 2020 - 15:37:35 EST


On Thu, Mar 26, 2020 at 8:20 PM Daniel Lezcano
<daniel.lezcano@xxxxxxxxxx> wrote:
>
> On 26/03/2020 20:14, Rafael J. Wysocki wrote:
> > On Thu, Mar 26, 2020 at 3:48 PM Daniel Lezcano
> > <daniel.lezcano@xxxxxxxxxx> wrote:
> >>
> >> Currently the idle injection framework uses the play_idle()
> >> function which puts the current CPU in an idle state. The idle
> >> state is the deepest one, as specified by the latency constraint
> >> when calling the subsequent play_idle_precise() function with the
> >> INT_MAX.
> >>
> >> The idle_injection is used by the cpuidle_cooling device which
> >> computes the idle / run duration to mitigate the temperature by
> >> injecting idle cycles. The cooling device has no control on the
> >> depth of the idle state.
> >>
> >> Allow finer control of the idle injection mechanism by allowing
> >> to specify the latency for the idle state. Thus the cooling
> >> device has the ability to have a guarantee on the exit latency of
> >> the idle states it is injecting.
> >>
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> ---
> >> drivers/powercap/idle_inject.c | 27 ++++++++++++++++++++++++++-
> >> include/linux/idle_inject.h | 6 ++++++ 2 files changed, 32
> >> insertions(+), 1 deletion(-)
>
> [ ... ]
>
> >> + +void idle_inject_set_latency(struct idle_inject_device
> >> *ii_dev, + unsigned int latency_ns);
> >> + +unsigned int idle_inject_get_latency(struct idle_inject_device
> >> *ii_dev); + #endif /* __IDLE_INJECT_H__ */ --
> >
> > I would like to see a user of idle_inject_get_latency() before this
> > goes in.
>
> Do you mean a user for the set/get or the get only? If the latter,
> there is no user yet I just added it to have an usual get/set helpers,
> if that hurts, I can resend by removing it. If the former, there is a
> patch I'm about to send which depends on the 'set'.

So I wouldn't add the "get" thing at all if it has no users.

Also it would be better to send this patch along with the other one
depending on it.