From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Steven Rostedt <rostedt@goodmis.org>,
stable@vger.kernel.org,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [4.4,06/28] rcu: Allow for page faults in NMI handlers
Date: Thu, 9 Nov 2017 09:56:54 -0800 [thread overview]
Message-ID: <20171109175654.GK3624@linux.vnet.ibm.com> (raw)
In-Reply-To: <1510240648.2465.46.camel@codethink.co.uk>
On Thu, Nov 09, 2017 at 03:17:28PM +0000, Ben Hutchings wrote:
> On Mon, 2017-10-16 at 18:11 +0200, gregkh@linuxfoundation.org wrote:
> > 4.4-stable review patch. If anyone has any objections, please let me know.
> >
> > ------------------
> >
> > From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> >
> > commit 28585a832602747cbfa88ad8934013177a3aae38 upstream.
> >
> > A number of architecture invoke rcu_irq_enter() on exception entry in
> > order to allow RCU read-side critical sections in the exception handler
> > when the exception is from an idle or nohz_full CPU. This works, at
> > least unless the exception happens in an NMI handler. In that case,
> > rcu_nmi_enter() would already have exited the extended quiescent state,
> > which would mean that rcu_irq_enter() would (incorrectly) cause RCU
> > to think that it is again in an extended quiescent state. This will
> > in turn result in lockdep splats in response to later RCU read-side
> > critical sections.
> >
> > This commit therefore causes rcu_irq_enter() and rcu_irq_exit() to
> > take no action if there is an rcu_nmi_enter() in effect, thus avoiding
> > the unscheduled return to RCU quiescent state. This in turn should
> > make the kernel safe for on-demand RCU voyeurism.
> >
> > Link: http://lkml.kernel.org/r/20170922211022.GA18084@linux.vnet.ibm.com
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 0be964be0 ("module: Sanitize RCU usage and locking")
> > > Reported-by: Steven Rostedt <rostedt@goodmis.org>
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > kernel/rcu/tree.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -759,6 +759,12 @@ void rcu_irq_exit(void)
> >
> > local_irq_save(flags);
> > rdtp = this_cpu_ptr(&rcu_dynticks);
> > +
> > + /* Page faults can happen in NMI handlers, so check... */
> > + if (READ_ONCE(rdtp->dynticks_nmi_nesting))
> > + return;
>
> Shouldn't there be a local_irq_restore() on this return path? Or does
> this condition imply that IRQs were already disabled?
>
> > + RCU_LOCKDEP_WARN(!irqs_disabled(), "rcu_irq_exit() invoked with irqs enabled!!!");
>
> I don't see why you added RCU_LOCKDEP_WARN() here. Prior to 4.5 it's
> not an error to call this function with IRQs disabled. And after
> calling local_irq_save(), it's redundant to assert that IRQs are
> disabled.
>
> > oldval = rdtp->dynticks_nesting;
> > rdtp->dynticks_nesting--;
> > WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
> > @@ -887,6 +893,12 @@ void rcu_irq_enter(void)
> >
> > local_irq_save(flags);
> > rdtp = this_cpu_ptr(&rcu_dynticks);
> > +
> > + /* Page faults can happen in NMI handlers, so check... */
> > + if (READ_ONCE(rdtp->dynticks_nmi_nesting))
> > + return;
> > +
> > + RCU_LOCKDEP_WARN(!irqs_disabled(), "rcu_irq_enter() invoked with irqs enabled!!!");
>
> Same problems here.
Indeed, it looks like I need to rework this for 4.5 and earlier.
Sorry for the noise!
Thanx, Paul
WARNING: multiple messages have this Message-ID (diff)
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Steven Rostedt <rostedt@goodmis.org>,
stable@vger.kernel.org,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [4.4,06/28] rcu: Allow for page faults in NMI handlers
Date: Thu, 9 Nov 2017 09:56:54 -0800 [thread overview]
Message-ID: <20171109175654.GK3624@linux.vnet.ibm.com> (raw)
In-Reply-To: <1510240648.2465.46.camel@codethink.co.uk>
On Thu, Nov 09, 2017 at 03:17:28PM +0000, Ben Hutchings wrote:
> On Mon, 2017-10-16 at 18:11 +0200, gregkh@linuxfoundation.org wrote:
> > 4.4-stable review patch.��If anyone has any objections, please let me know.
> >
> > ------------------
> >
> > From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> >
> > commit 28585a832602747cbfa88ad8934013177a3aae38 upstream.
> >
> > A number of architecture invoke rcu_irq_enter() on exception entry in
> > order to allow RCU read-side critical sections in the exception handler
> > when the exception is from an idle or nohz_full CPU.��This works, at
> > least unless the exception happens in an NMI handler.��In that case,
> > rcu_nmi_enter() would already have exited the extended quiescent state,
> > which would mean that rcu_irq_enter() would (incorrectly) cause RCU
> > to think that it is again in an extended quiescent state.��This will
> > in turn result in lockdep splats in response to later RCU read-side
> > critical sections.
> >
> > This commit therefore causes rcu_irq_enter() and rcu_irq_exit() to
> > take no action if there is an rcu_nmi_enter() in effect, thus avoiding
> > the unscheduled return to RCU quiescent state.��This in turn should
> > make the kernel safe for on-demand RCU voyeurism.
> >
> > Link: http://lkml.kernel.org/r/20170922211022.GA18084@linux.vnet.ibm.com
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 0be964be0 ("module: Sanitize RCU usage and locking")
> > > Reported-by: Steven Rostedt <rostedt@goodmis.org>
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > �kernel/rcu/tree.c |���12 ++++++++++++
> > �1 file changed, 12 insertions(+)
> >
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -759,6 +759,12 @@ void rcu_irq_exit(void)
> > �
> > � local_irq_save(flags);
> > � rdtp = this_cpu_ptr(&rcu_dynticks);
> > +
> > + /* Page faults can happen in NMI handlers, so check... */
> > + if (READ_ONCE(rdtp->dynticks_nmi_nesting))
> > + return;
>
> Shouldn't there be a local_irq_restore() on this return path? Or does
> this condition imply that IRQs were already disabled?
>
> > + RCU_LOCKDEP_WARN(!irqs_disabled(), "rcu_irq_exit() invoked with irqs enabled!!!");
>
> I don't see why you added RCU_LOCKDEP_WARN() here. Prior to 4.5 it's
> not an error to call this function with IRQs disabled. And after
> calling local_irq_save(), it's redundant to assert that IRQs are
> disabled.
>
> > � oldval = rdtp->dynticks_nesting;
> > � rdtp->dynticks_nesting--;
> > � WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
> > @@ -887,6 +893,12 @@ void rcu_irq_enter(void)
> > �
> > � local_irq_save(flags);
> > � rdtp = this_cpu_ptr(&rcu_dynticks);
> > +
> > + /* Page faults can happen in NMI handlers, so check... */
> > + if (READ_ONCE(rdtp->dynticks_nmi_nesting))
> > + return;
> > +
> > + RCU_LOCKDEP_WARN(!irqs_disabled(), "rcu_irq_enter() invoked with irqs enabled!!!");
>
> Same problems here.
Indeed, it looks like I need to rework this for 4.5 and earlier.
Sorry for the noise!
Thanx, Paul
next prev parent reply other threads:[~2017-11-09 17:57 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 16:11 [PATCH 4.4 00/28] 4.4.93-stable review Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 4.4 01/28] brcmfmac: add length check in brcmf_cfg80211_escan_handler() Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 4.4 02/28] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 4.4 03/28] CIFS: Reconnect expired SMB sessions Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 4.4 04/28] nl80211: Define policy for packet pattern attributes Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 4.4 05/28] iwlwifi: mvm: use IWL_HCMD_NOCOPY for MCAST_FILTER_CMD Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 4.4 06/28] rcu: Allow for page faults in NMI handlers Greg Kroah-Hartman
2017-11-09 15:17 ` [4.4,06/28] " Ben Hutchings
2017-11-09 17:35 ` Steven Rostedt
2017-11-09 17:56 ` Paul E. McKenney [this message]
2017-11-09 17:56 ` Paul E. McKenney
2017-10-16 16:12 ` [PATCH 4.4 07/28] USB: dummy-hcd: Fix deadlock caused by disconnect detection Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 08/28] MIPS: math-emu: Remove pr_err() calls from fpu_emu() Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 09/28] dmaengine: edma: Align the memcpy acnt array size with the transfer Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 10/28] HID: usbhid: fix out-of-bounds bug Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 12/28] KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 13/28] usb: renesas_usbhs: Fix DMAC sequence for receiving zero-length packet Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 14/28] iommu/amd: Finish TLB flush in amd_iommu_unmap() Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 15/28] ALSA: usb-audio: Kill stray URB at exiting Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 16/28] ALSA: seq: Fix use-after-free at creating a port Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 17/28] ALSA: seq: Fix copy_from_user() call inside lock Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 18/28] ALSA: caiaq: Fix stray URB at probe error path Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 19/28] ALSA: line6: Fix leftover URB at error-path during probe Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 20/28] usb: gadget: composite: Fix use-after-free in usb_composite_overwrite_options Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 21/28] direct-io: Prevent NULL pointer access in submit_page_section Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 22/28] fix unbalanced page refcounting in bio_map_user_iov Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 23/28] USB: serial: ftdi_sio: add id for Cypress WICED dev board Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 24/28] USB: serial: cp210x: add support for ELV TFD500 Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 25/28] USB: serial: option: add support for TP-Link LTE module Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 26/28] USB: serial: qcserial: add Dell DW5818, DW5819 Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 27/28] USB: serial: console: fix use-after-free after failed setup Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 4.4 28/28] x86/alternatives: Fix alt_max_short macro to really be a max() Greg Kroah-Hartman
2017-10-17 0:02 ` [PATCH 4.4 00/28] 4.4.93-stable review Shuah Khan
2017-10-17 0:24 ` Guenter Roeck
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=20171109175654.GK3624@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=ben.hutchings@codethink.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.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.