Re: [PATCH v4 14/16] sched/core: uclamp: request CAP_SYS_ADMIN by default

From: Peter Zijlstra
Date: Fri Sep 14 2018 - 10:28:26 EST



Just a quick reply because I have to run..

On Fri, Sep 14, 2018 at 03:07:32PM +0100, Patrick Bellasi wrote:
> On 14-Sep 13:10, Peter Zijlstra wrote:

> > I think the problem here is that the two are conflated in the very same
> > interface.
> >
> > Would it make sense to move the available clamp values out to some sysfs
> > interface like thing and guard that with a capability, while keeping the
> > task interface unprivilidged?
>
> You mean something like:
>
> $ cat /proc/sys/kernel/sched_uclamp_min_utils
> 0 10 20 ... 100
>
> to notify users about the set of clamp values which are available ?
>
> > Another thing that has me 'worried' about this interface is the direct
> > tie to CPU capacity (not that I have a better suggestion). But it does
> > raise the point of how userspace is going to discover the relevant
> > values of the platform.
>
> This point worries me too, and that's what I think is addressed in a
> sane way in:
>
> [PATCH v4 13/16] sched/core: uclamp: use percentage clamp values
> https://lore.kernel.org/lkml/20180828135324.21976-14-patrick.bellasi@xxxxxxx/
>
> IMHO percentages are a reasonably safe and generic API to expose to
> user-space. Don't you think this should address your concern above ?

Not at all what I meant, and no, percentages don't help.

The thing is, the values you'd want to use are for example the capacity
of the little CPUs. or the capacity of the most energy efficient OPP
(the knee).

Similarly for boosting, how are we 'easily' going to find the values
that correspond to the various available OPPs.

The EAS thing might have these around; but I forgot if/how they're
exposed to userspace (I'll have to soon look at the latest posting).

But changing the clamp metric to something different than these values
is going to be pain.