lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200625113407.awok7pd64fgt7cii@e107158-lin.cambridge.arm.com>
Date:   Thu, 25 Jun 2020 12:34:07 +0100
From:   Qais Yousef <qais.yousef@....com>
To:     Valentin Schneider <valentin.schneider@....com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Patrick Bellasi <patrick.bellasi@...bug.net>,
        Chris Redpath <chris.redpath@....com>,
        Lukasz Luba <lukasz.luba@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] sched/uclamp: Protect uclamp fast path code with
 static key

On 06/25/20 12:26, Valentin Schneider wrote:
> 
> On 25/06/20 12:00, Qais Yousef wrote:
> > Hi Valentin
> >
> > On 06/25/20 01:16, Valentin Schneider wrote:
> >> In schedutil_cpu_util(), when uclamp isn't compiled it, we have an explicit
> >> 'goto max'. When uclamp *is* compiled in, that's taken care of by the
> >> "natural" RT uclamp aggregation... Which doesn't happen until we flip the
> >> static key.
> >>
> >> It's yucky, but if you declare the key in the internal sched header, you
> >> could reuse it in the existing 'goto max' (or sysctl value, when we make
> >> that tweakable) path.
> >
> > Not sure if this is the best way forward. I need to think about it.
> > While I am not keen on enabling in kernel users of util clamp, but there was
> > already an attempt to do so. This approach will not allow us to implement
> > something in the future for that. Which maybe is what we want..
> >
> 
> Just to be clear, I'm not suggesting to add any in-kernel toggling of
> uclamp outside of the scheduler: by keeping that to the internal sched
> header & schedutil, we're keeping it contained to internal scheduler land.
> 
> Since a diff is worth a thousand words, here's what I was thinking of (not
> even compiled):

Yeah I understood and already thought about this. But this approach could
prevent potential in kernel-users. Whether we care or not about this now,
I don't know. But it seems the simplest thing to do.

> 
> >> > -	if (update_root_tg)
> >> > +	if (update_root_tg) {
> >> >            uclamp_update_root_tg();
> >> > +		static_branch_enable(&sched_uclamp_used);
> >>
> >> I don't think it matters ATM, but shouldn't we flip that *before* updating
> >> the TG's to avoid any future surprises?
> >
> > What sort of surprises are you thinking of?
> >
> 
> Say if we end up adding static key checks in some other uclamp functions
> (which are called in the TG update) and don't change this here, someone
> will have to scratch their heads to figure out the key enablement needs to
> be moved one line higher. It's harmless future-proofing, I think.

Hehe okay, I'll change that.

Thanks

--
Qais Yousef

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ