From: Ingo Molnar <mingo@elte.hu>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Vegard Nossum <vegard.nossum@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Paul Mackerras <paulus@samba.org>,
linux-kernel@vger.kernel.org, benh@kernel.crashing.org
Subject: Re: Accessing user memory from NMI
Date: Sat, 20 Jun 2009 19:40:22 +0200 [thread overview]
Message-ID: <20090620174022.GA29685@elte.hu> (raw)
In-Reply-To: <20090620165820.GA23582@Krystal>
* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> * Ingo Molnar (mingo@elte.hu) wrote:
> >
> > * Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> >
> > > On Thu, 2009-06-18 at 18:20 +1000, Paul Mackerras wrote:
> > >
> > > > What was the conclusion you guys came to about doing a user
> > > > stack backtrace in an NMI handler? Are you going to access user
> > > > memory directly or are you going to use the
> > > > __fast_get_user_pages approach?
> > > >
> > > > Ben H and I were talking today about what we'd need in order to
> > > > be able to read user memory in a PMU interrupt handler. It
> > > > looks like we could read user memory directly with a bit of
> > > > care, on 64-bit at least. Because of the MMU hash table that
> > > > would almost always work provided the page has already been
> > > > touched (which stack pages would have been), but there is a
> > > > small chance that the access might fail even if the address has
> > > > a valid PTE. At that point we could fall back to the
> > > > __fast_get_user_pages method, but I'm not sure it's worth it.
> > >
> > > Currently we have the GUP based approach, but Ingo is thikning
> > > about making the pagefault handler NMI safe on x86 for .32.
> >
> > Vegard raised the point that making NMIs pagefault-safe is also a
> > plus for making kmemcheck NMI-safe.
> >
> > So besides it being faster (direct memory access versus 150 cycles
> > GUP walk ... per frame entry!), it's also more robust in general.
> >
> > But too ambitious for v2.6.31 i think, unless patches become ready
> > really soon. What we have right now is the 64-bit only and
> > paravirt-unaware half-ported solution below.
>
> Side note: saving/restoring the cr2 register would additionally be
> required around page faults in nmi handler in addition to the
> patch below, both for 32 and 64-bits x86.
Correct, i just mentioned that in another mail - it is required to
make sure we dont corrupt the main pagefault handler's cr2.
Ingo
prev parent reply other threads:[~2009-06-20 17:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-18 8:20 Accessing user memory from NMI Paul Mackerras
2009-06-18 8:36 ` Peter Zijlstra
2009-06-20 16:34 ` Ingo Molnar
2009-06-20 16:58 ` Mathieu Desnoyers
2009-06-20 17:40 ` Ingo Molnar [this message]
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=20090620174022.GA29685@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
--cc=vegard.nossum@gmail.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