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: <e3e4fa67-17d0-42ac-aab4-a4b83a652ee7@paulmck-laptop>
Date:   Thu, 24 Aug 2023 06:29:22 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Joel Fernandes <joel@...lfernandes.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Huacai Chen <chenhuacai@...nel.org>,
        Z qiang <qiang.zhang1211@...il.com>,
        Huacai Chen <chenhuacai@...ngson.cn>,
        Frederic Weisbecker <frederic@...nel.org>,
        Neeraj Upadhyay <quic_neeraju@...cinc.com>,
        Josh Triplett <josh@...htriplett.org>,
        Boqun Feng <boqun.feng@...il.com>,
        Ingo Molnar <mingo@...nel.org>,
        John Stultz <jstultz@...gle.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Lai Jiangshan <jiangshanlai@...il.com>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        rcu@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org, Binbin Zhou <zhoubinbin@...ngson.cn>
Subject: Re: [PATCH V4 2/2] rcu: Update jiffies in rcu_cpu_stall_reset()

On Thu, Aug 24, 2023 at 01:21:55PM +0000, Joel Fernandes wrote:
> Hello Thomas,
> 
> On Thu, Aug 24, 2023 at 12:03:25AM +0200, Thomas Gleixner wrote:
> > On Thu, Aug 17 2023 at 16:06, Huacai Chen wrote:
> > > On Thu, Aug 17, 2023 at 3:27 AM Joel Fernandes <joel@...lfernandes.org> wrote:
> > >> > If  do_update_jiffies_64() cannot be used in NMI context,
> > >>
> > >> Can you not make the jiffies update conditional on whether it is
> > >> called within NMI context?
> > 
> > Which solves what? If KGDB has a breakpoint in the jiffies lock held
> > region then you still dead lock.
> 
> Yes, we had already discussed this that jiffies update is not possible from
> here. There are too many threads since different patch revisions were being
> reviewed in different threads.

One of the nice properties of the jiffies counter is its trivially
provable NMI safety  ;-)

							Thanx, Paul

> > >> I dislike that..
> > > Is this acceptable?
> > >
> > > void rcu_cpu_stall_reset(void)
> > > {
> > >         unsigned long delta;
> > >
> > >         delta = nsecs_to_jiffies(ktime_get_ns() - ktime_get_coarse_ns());
> > >
> > >         WRITE_ONCE(rcu_state.jiffies_stall,
> > >                    jiffies + delta + rcu_jiffies_till_stall_check());
> > > }
> > >
> > > This can update jiffies_stall without updating jiffies (but has the
> > > same effect).
> > 
> > Now you traded the potential dead lock on jiffies lock for a potential
> > live lock vs. tk_core.seq. Not really an improvement, right?
> > 
> > The only way you can do the above is something like the incomplete and
> > uncompiled below. NMI safe and therefore livelock proof time interfaces
> > exist for a reason.
> 
> Yes, I had already mentioned exactly this issue here of not using an NMI-safe
> interface:
> https://lore.kernel.org/all/CAEXW_YT+uw5JodtrqjY0B2xx0J8ukF=FAB9-p5rxgWobSU2P2A@mail.gmail.com/
> I like your suggestion of using last_jiffies_update though (which as you
> mentioned needs to be explored more).
> 
> There are too many threads which makes the discussion hard to follow. Huacai,
> it would be great if we can keep the discussions in the same thread (Say for
> example by passing options like --in-reply-to to "git send-email" command).
> 
> thanks,
> 
>  - Joel
> 
> 
> > 
> > Thanks,
> > 
> >         tglx
> > ---
> > --- a/kernel/time/tick-sched.c
> > +++ b/kernel/time/tick-sched.c
> > @@ -51,6 +51,13 @@ struct tick_sched *tick_get_tick_sched(i
> >   */
> >  static ktime_t last_jiffies_update;
> >  
> > +unsigned long tick_estimate_stale_jiffies(void)
> > +{
> > +	ktime_t delta = ktime_get_mono_fast_ns() - READ_ONCE(last_jiffies_update);
> > +
> > +	return delta < 0 ? 0 : div_s64(delta, TICK_NSEC);
> > +}
> > +
> >  /*
> >   * Must be called with interrupts disabled !
> >   */
> > 
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ