All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: joel@joelfernandes.org, max.byungchul.park@gmail.com,
	Byungchul Park <byungchul.park@lge.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-team@lge.com
Subject: Re: [RFC 2/2] rcu: Remove ->dynticks_nmi_nesting from struct rcu_dynticks
Date: Fri, 22 Jun 2018 09:12:05 -0700	[thread overview]
Message-ID: <20180622161205.GQ3593@linux.vnet.ibm.com> (raw)
In-Reply-To: <CALCETrXgubD2BBx9Xe2PALbStgPYc=_GTNkoH03469rpN5JwZw@mail.gmail.com>

On Fri, Jun 22, 2018 at 07:19:13AM -0700, Andy Lutomirski wrote:
> On Fri, Jun 22, 2018 at 6:26 AM Paul E. McKenney
> <paulmck@linux.vnet.ibm.com> wrote:
> >
> > On Thu, Jun 21, 2018 at 10:56:59PM -0700, Joel Fernandes wrote:
> > > Hi Paul,
> > >
> > > On Wed, Jun 20, 2018 at 09:49:02AM -0700, Paul E. McKenney wrote:
> > > > On Thu, Jun 21, 2018 at 01:05:22AM +0900, Byungchul Park wrote:
> > > > > On Wed, Jun 20, 2018 at 11:58 PM, Paul E. McKenney
> > > > > <paulmck@linux.vnet.ibm.com> wrote:
> > > > > > On Wed, Jun 20, 2018 at 05:47:20PM +0900, Byungchul Park wrote:
> > > > > >> Hello folks,
> > > > > >>
> > > > > >> I'm careful in saying that ->dynticks_nmi_nesting can be removed but I
> > > > > >> think it's possible since the only thing we are interested in with
> > > > > >> regard to ->dynticks_nesting or ->dynticks_nmi_nesting is whether rcu is
> > > > > >> idle or not.
> > > > > >
> > > > > > Please keep in mind that NMIs cannot be masked, which means that the
> > > > > > rcu_nmi_enter() and rcu_nmi_exit() pair can be invoked at any point in
> > > > > > the process, between any consecutive pair of instructions.  The saving
> > > >
> > > > And yes, I should have looked at this patch more closely before replying.
> > > > But please see below.
> > > >
> > > > > I believe I understand what NMI is and why you introduced
> > > > > ->dynticks_nmi_nesting. Or am I missing something?
> > > >
> > > > Perhaps the fact that there are architectures that can enter interrupt
> > > > handlers and never leave them when the CPU is non-idle.  One example of
> > > > this is the usermode upcalls in the comment that you removed.
> > >
> > > I spent some time tonight and last night trying to understand this concept of
> > > never leaving an interrupt, I hope you don't mind me asking this dumb
> > > question... perhaps I will learn something : Could you let me know how is it
> > > possible that an interrupt never exits?
> > >
> > > Typically an interrupt never exiting sounds like a hard-lockup. This is how
> > > hardlock detector works: Since regular interrupts in linux can't nest, the
> > > hardlockup detector checks if hrtimer interrupts are being handled and if
> > > not, then it throws a splat, panics the kernel etc. So I am a bit troubled by
> > > this interrupt never exiting concept..
> > >
> > > Further since an interrupt is an atomic context, it cannot sleep or schedule
> > > into usermode so how are these upcalls handled from the interrupt?
> >
> > It has been some years since I traced the code flow, but what happened
> > back then is that it switches itself from an interrupt handler to not
> > without actually returning from the interrupt.  This can only happen when
> > interrupting a non-idle process, thankfully, and RCU's dyntick-idle code
> > relies on this restriction.  If I remember correctly, the code ends up
> > executing in the context of the interrupted process, but it has been some
> > years, so please apply appropriate skepticism.
> 
> ...
> 
> >
> > I have never seen NMIs be unpaired or improperly nested.  However,
> > given that rcu_irq_enter() invokes rcu_nmi_enter() and rcu_irq_exit()
> > invokes rcu_nmi_exit(), it is definitely the case that rcu_nmi_enter()
> > and rcu_nmi_exit() need to deal with unpaired and improperly nested
> > invocations.
> 
> This is very strange.  There are certainly cases in x86 where an
> interrupt-ish code path can become less interrupt-ish without
> returning (killing a task that overflows a kernel stack is an
> example), but the RCU calls should still nest correctly.  Do you know
> the history of this requirement?

I believe that they are called "usermode helpers", and are (were?)
used on a number of architectures to implement system calls from
within the kernel.

							Thanx, Paul


  reply	other threads:[~2018-06-22 16:10 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20  8:47 [RFC 1/2] rcu: Do prepare and cleanup idle depending on in_nmi() Byungchul Park
2018-06-20  8:47 ` [RFC 2/2] rcu: Remove ->dynticks_nmi_nesting from struct rcu_dynticks Byungchul Park
2018-06-20 14:58   ` Paul E. McKenney
2018-06-20 16:05     ` Byungchul Park
2018-06-20 16:49       ` Paul E. McKenney
2018-06-20 17:15         ` Byungchul Park
2018-06-20 17:40           ` Paul E. McKenney
2018-06-21  6:39             ` Byungchul Park
2018-06-21  6:48               ` Byungchul Park
2018-06-21 10:08               ` Byungchul Park
2018-06-21 15:05                 ` Paul E. McKenney
2018-06-21 15:04               ` Paul E. McKenney
2018-06-22  3:00                 ` Byungchul Park
2018-06-22 13:36                   ` Paul E. McKenney
2018-06-22  5:56         ` Joel Fernandes
2018-06-22 13:28           ` Paul E. McKenney
2018-06-22 14:19             ` Andy Lutomirski
2018-06-22 16:12               ` Paul E. McKenney [this message]
2018-06-22 16:01             ` Steven Rostedt
2018-06-22 18:14               ` Paul E. McKenney
2018-06-22 18:19             ` Joel Fernandes
2018-06-22 18:32               ` Steven Rostedt
2018-06-22 20:05                 ` Joel Fernandes
2018-06-25  8:28                   ` Byungchul Park
2018-06-25 16:39                     ` Joel Fernandes
2018-06-25 17:19                       ` Paul E. McKenney
2018-06-25 19:15                         ` Joel Fernandes
2018-06-25 20:25                       ` Steven Rostedt
2018-06-25 20:47                         ` Paul E. McKenney
2018-06-25 20:47                           ` Andy Lutomirski
2018-06-25 22:16                             ` Steven Rostedt
2018-06-25 23:30                               ` Andy Lutomirski
2018-06-25 22:15                           ` Steven Rostedt
2018-06-25 23:32                             ` Andy Lutomirski
2018-06-25 21:25                         ` Joel Fernandes
2018-06-22 20:58                 ` Paul E. McKenney
2018-06-22 20:58               ` Paul E. McKenney
2018-06-22 21:00                 ` Steven Rostedt
2018-06-22 21:16                   ` Paul E. McKenney
2018-06-22 22:03                     ` Andy Lutomirski
2018-06-23 17:53                       ` Paul E. McKenney
2018-06-28 20:02                         ` Paul E. McKenney
2018-06-28 21:13                           ` Joel Fernandes
2018-06-28 21:41                             ` Paul E. McKenney
2018-06-23 15:48                     ` Joel Fernandes
2018-06-23 17:56                       ` Paul E. McKenney
2018-06-24  3:02                         ` Joel Fernandes
2018-06-20 13:33 ` [RFC 1/2] rcu: Do prepare and cleanup idle depending on in_nmi() Steven Rostedt
2018-06-20 14:58   ` Paul E. McKenney
2018-06-20 15:25   ` Byungchul Park
2018-06-20 14:50 ` Paul E. McKenney
2018-06-20 15:43   ` Steven Rostedt
2018-06-20 15:56     ` Paul E. McKenney
2018-06-20 16:11       ` Byungchul Park
2018-06-20 16:14         ` Steven Rostedt
2018-06-20 16:37           ` Byungchul Park
2018-06-20 16:11       ` Steven Rostedt
2018-06-20 16:30         ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180622161205.GQ3593@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=byungchul.park@lge.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=max.byungchul.park@gmail.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.