From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
"paulmck@linux.vnet.ibm.com" <paulmck@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
"x86@kernel.org" <x86@kernel.org>,
"Wang, Xiaoming" <xiaoming.wang@intel.com>,
"Li, Zhuangzhi" <zhuangzhi.li@intel.com>,
"Liu, Chuansheng" <chuansheng.liu@intel.com>
Subject: Re: [PATCH] x86: Remove WARN_ON(in_nmi()) from vmalloc_fault
Date: Wed, 16 Oct 2013 15:08:57 +0200 [thread overview]
Message-ID: <20131016130856.GE12773@localhost.localdomain> (raw)
In-Reply-To: <20131016084518.44eaf61a@gandalf.local.home>
On Wed, Oct 16, 2013 at 08:45:18AM -0400, Steven Rostedt wrote:
> On Wed, 16 Oct 2013 13:40:37 +0200
> Frederic Weisbecker <fweisbec@gmail.com> wrote:
>
> > On Tue, Oct 15, 2013 at 04:39:06PM -0400, Steven Rostedt wrote:
> > > Since the NMI iretq nesting has been fixed, there's no reason that
> > > an NMI handler can not take a page fault for vmalloc'd code. No locks
> > > are taken in that code path, and the software now handles nested NMIs
> > > when the fault re-enables NMIs on iretq.
> > >
> > > Not only that, if the vmalloc_fault() WARN_ON_ONCE() is hit, and that
> > > warn on triggers a vmalloc fault for some reason, then we can go into
> > > an infinite loop (the WARN_ON_ONCE() does the WARN() before updating
> > > the variable to make it happen "once").
> > >
> > > Reported-by: "Liu, Chuansheng" <chuansheng.liu@intel.com>
> > > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> >
> > Thanks! For now we probably indeed want this patch. But I hope it's only
> > for the short term.
>
> Why?
>
> >
> > I still think that allowing faults in NMIs is very nasty, as we expect NMIs to never
> > be disturbed.
>
> We do faults (well, breakpoints really) in NMI to enable tracing.
>
> > I'm not even sure if that interacts correctly with the rcu_nmi_enter()
> > and preempt_count & NMI_MASK things. Not sure how perf is ready for that either (now
> > hardware events can be interrupted by fault trace events).
>
> I'm a bit confused. What doesn't interact correctly with
> rcu_nmi_enter()?
Faults can call rcu_user_exit() / rcu_user_enter(). This is not supposed to happen
between rcu_nmi_enter() and rcu_nmi_exit(). rdtp->dynticks would be incremented in the
wrong way.
Ah but we have an in_interrupt() check in context_tracking_user_enter() that protects
us against that.
>
> >
> > So I hope we can think about something else for the long term.
>
> I still don't understand what's wrong with it. As long as the faulting
> code does not grab any locks there shouldn't be anything wrong with
> faulting in NMI. For vmalloc, it is just updating page tables.
NMI code is written with the idea that it can't be interrupted. May be that
paranoia (again), you know. And I can't point you any problem in practice.
I just think that allowing such a thing is asking for troubles.
But I'm ok with your patch, it fixes a real bug and as long as we don't have
a better solution, we should keep that.
BTW, does faulting in NMIs re-enable NMIs?
next prev parent reply other threads:[~2013-10-16 13:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-15 20:39 [PATCH] x86: Remove WARN_ON(in_nmi()) from vmalloc_fault Steven Rostedt
2013-10-16 6:11 ` Ingo Molnar
2013-10-16 12:42 ` Steven Rostedt
2013-10-16 12:51 ` Ingo Molnar
2013-10-16 13:01 ` Borislav Petkov
2013-10-16 13:03 ` Steven Rostedt
2013-10-17 0:29 ` Liu, Chuansheng
2013-10-16 11:40 ` Frederic Weisbecker
2013-10-16 12:45 ` Steven Rostedt
2013-10-16 13:08 ` Frederic Weisbecker [this message]
2013-10-16 13:14 ` Steven Rostedt
2013-10-16 13:28 ` Frederic Weisbecker
2013-10-16 13:37 ` Steven Rostedt
2013-10-16 19:39 ` Paul E. McKenney
2013-10-16 19:36 ` Paul E. McKenney
2013-10-16 19:57 ` Steven Rostedt
2013-10-18 11:54 ` Paul E. McKenney
2013-10-17 13:59 ` Frederic Weisbecker
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=20131016130856.GE12773@localhost.localdomain \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chuansheng.liu@intel.com \
--cc=hpa@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xiaoming.wang@intel.com \
--cc=zhuangzhi.li@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox