[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210922195938.GD880162@paulmck-ThinkPad-P17-Gen-1>
Date: Wed, 22 Sep 2021 12:59:38 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: gor@...ux.ibm.com, jpoimboe@...hat.com, jikos@...nel.org,
mbenes@...e.cz, pmladek@...e.com, mingo@...nel.org,
linux-kernel@...r.kernel.org, joe.lawrence@...hat.com,
fweisbec@...il.com, tglx@...utronix.de, hca@...ux.ibm.com,
svens@...ux.ibm.com, sumanthk@...ux.ibm.com,
live-patching@...r.kernel.org
Subject: Re: [RFC][PATCH 6/7] context_tracking: Provide SMP ordering using RCU
On Wed, Sep 22, 2021 at 09:47:59PM +0200, Peter Zijlstra wrote:
> On Wed, Sep 22, 2021 at 09:33:43PM +0200, Peter Zijlstra wrote:
>
> > Anyway, lemme see if I get your proposal; lets say the counter starts at
> > 0 and is in kernel space.
> >
> > 0x00(0) - kernel
> > 0x02(2) - user
> > 0x04(0) - kernel
> >
> > So far so simple, then NMI on top of that goes:
> >
> > 0x00(0) - kernel
> > 0x03(3) - kernel + nmi
> > 0x04(0) - kernel
> > 0x06(2) - user
> > 0x09(1) - user + nmi
> > 0x0a(2) - user
> >
> > Which then gives us:
> >
> > (0) := kernel
> > (1) := nmi-from-user
> > (2) := user
> > (3) := nmi-from-kernel
> >
> > Which should work I suppose. But like I said above, I'd be happier if
> > this counter would live in context_tracking rather than RCU.
>
> Furthermore, if we have this counter, the we can also do things like:
>
> seq = context_tracking_seq_cpu(that_cpu);
> if ((seq & 3) != USER)
> // nohz_fail, do something
> set_tsk_thread_flag(curr_task(that_cpu), TIF_DO_SOME_WORK);
> if (seq == context_tracking_seq_cpu(that_cpu))
> // success!!
>
> To remotely set pending state. Allowing yet more NOHZ_FULL fixes, like,
> for example, eliding the text_poke IPIs.
Nice!
There have been several instances where I thought that the extra state
would help RCU, but each time there turned out to be a simpler way to
get things done. Or that it eventually turned out that RCU didn't need
to care about the difference between idle and nohz_full userspace.
Thanx, Paul
Powered by blists - more mailing lists