All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Willy Tarreau <w@1wt.eu>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>, X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Brian Gerst <brgerst@gmail.com>
Subject: Re: Dealing with the NMI mess
Date: Fri, 24 Jul 2015 15:30:13 +0200	[thread overview]
Message-ID: <20150724133013.GI19282@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20150724132128.GA3612@1wt.eu>

On Fri, Jul 24, 2015 at 03:21:28PM +0200, Willy Tarreau wrote:
> On Fri, Jul 24, 2015 at 09:03:42AM -0400, Steven Rostedt wrote:
> > On Fri, 24 Jul 2015 14:43:04 +0200
> > Peter Zijlstra <peterz@infradead.org> wrote:
> > 
> >  
> > > > I'm not too familiar with how to use hw breakpoints, but I'm guessing
> > > > (correct me if I'm wrong) that breakpoints on code that trigger when
> > > > executed, but watchpoints on data trigger when accessed. Then
> > > > copy_from_user_inatomic() would only trigger on watchpoints (it's not
> > > > executing that code, at least I hope it isn't!), and those wont bother
> > > > us.
> > > 
> > > These things can be: RW, W, X.
> > > 
> > > Sure, hitting a user X watchpoint is going to be 'interesting', but its
> > > fairly easy to hit a RW one.
> > 
> > But do we care if we do hit one? The return from the #DB handler can
> > use a RET. Right?

Look at do_debug(), it has lovely bits like:

	preempt_conditional_sti();

in it, we do _NOT_ want to be re-enabling interrupts if we're called
from an !IF context, that'd be _bad_.

> My understanding is that by using RET we can't set the RF flag and #DB
> will immediately strike again when the operation is attempted again. Thus
> we have to completely disable the breakpoints on leaving after the first
> one strikes, resulting in some userland breakpoints being missed. Maybe
> it can be accepted as a limitation when perf is running. I don't know if
> the output of perf is that relevant when a debugger is present BTW.

The patch I posted will re-enable the breakpoints before returning to
userspace. So userspace will only 'miss' events generated by the kernel.

Missing reads from the kernel is not a problem -- and maybe even
expected, but certainly unavoidable.

Missing updates from the kernel might be a problem, you'd get a variable
change content even though you have a W watchpoint on it, that'd be
surprising.

Then again, I suppose we can argue the variable changed through another
mapping and watchpoints work on the virtual address, so tough cookies or
somesuch -- the kernel could in fact do this on highmem kernel anyway.

  reply	other threads:[~2015-07-24 13:30 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 20:21 Dealing with the NMI mess Andy Lutomirski
2015-07-23 20:38 ` Linus Torvalds
2015-07-23 20:49   ` Andy Lutomirski
2015-07-23 21:08     ` Linus Torvalds
2015-07-23 21:31       ` Steven Rostedt
2015-07-23 21:46         ` Willy Tarreau
2015-07-23 21:46           ` Andy Lutomirski
2015-07-23 21:50             ` Willy Tarreau
2015-07-23 21:48         ` Linus Torvalds
2015-07-23 21:50           ` Andy Lutomirski
2015-07-23 21:59             ` Linus Torvalds
2015-07-24  8:13               ` Peter Zijlstra
2015-07-24  9:02                 ` Willy Tarreau
2015-07-24 11:58                 ` Steven Rostedt
2015-07-24 12:43                   ` Peter Zijlstra
2015-07-24 13:03                     ` Steven Rostedt
2015-07-24 13:21                       ` Willy Tarreau
2015-07-24 13:30                         ` Peter Zijlstra [this message]
2015-07-24 13:33                           ` Peter Zijlstra
2015-07-24 14:31                         ` Steven Rostedt
2015-07-24 14:59                           ` Willy Tarreau
2015-07-24 15:16                             ` Steven Rostedt
2015-07-24 15:26                               ` Willy Tarreau
2015-07-24 15:30                                 ` Peter Zijlstra
2015-07-24 15:33                                   ` Willy Tarreau
2015-07-24 18:29                                   ` Linus Torvalds
2015-07-24 18:41                                     ` Linus Torvalds
2015-07-24 19:05                                       ` Steven Rostedt
2015-07-24 19:55                                     ` Peter Zijlstra
2015-07-24 20:22                                       ` Linus Torvalds
2015-07-24 20:51                                         ` Peter Zijlstra
2015-07-24 21:07                                           ` Steven Rostedt
2015-07-24 21:08                                           ` Andy Lutomirski
2015-07-30 15:41                                             ` Paolo Bonzini
2015-07-30 21:22                                               ` Andy Lutomirski
2015-07-30 21:58                                                 ` Brian Gerst
2015-07-30 22:59                                                 ` Thomas Gleixner
2015-07-31  4:22                                                 ` Borislav Petkov
2015-07-31  5:11                                                   ` Andy Lutomirski
2015-07-31  7:51                                                     ` Paolo Bonzini
2015-07-31  8:03                                                     ` Borislav Petkov
2015-07-31  9:27                                                       ` Paolo Bonzini
2015-07-31 10:25                                                         ` Borislav Petkov
2015-07-31 10:26                                                           ` Paolo Bonzini
2015-07-31 10:32                                                             ` Borislav Petkov
2015-09-07  5:39                                                       ` Maciej W. Rozycki
2015-09-07  7:42                                                         ` Ingo Molnar
2015-09-07  8:19                                                           ` Maciej W. Rozycki
2015-09-07 10:19                                                             ` Paolo Bonzini
2015-09-07 17:01                                                               ` Maciej W. Rozycki
2015-09-07 17:22                                                                 ` Andy Lutomirski
2015-09-07 19:30                                                                   ` Maciej W. Rozycki
2015-09-07 21:56                                                                     ` Andy Lutomirski
2015-09-08 16:21                                                                       ` Maciej W. Rozycki
2015-07-24 23:53                                           ` Linus Torvalds
2015-07-24 15:34                                 ` Steven Rostedt
2015-07-24 15:49                                   ` Willy Tarreau
2015-07-24 15:48                 ` Andy Lutomirski
2015-07-24 16:02                   ` Steven Rostedt
2015-07-24 16:08                     ` Willy Tarreau
2015-07-24 16:31                       ` Steven Rostedt
2015-07-24 16:06                   ` Steven Rostedt
2015-07-24 16:25                   ` Willy Tarreau
2015-07-24 17:21                     ` Andy Lutomirski
2015-07-24 17:10                   ` Willy Tarreau
2015-07-24 17:20                     ` Andy Lutomirski
2015-07-30 15:54                       ` Paolo Bonzini
2015-07-24 17:21                     ` Willy Tarreau
2015-07-23 20:52   ` Willy Tarreau
2015-07-23 20:53     ` Andy Lutomirski
2015-07-23 21:07       ` Willy Tarreau
2015-07-23 21:13     ` Linus Torvalds
2015-07-23 21:18       ` Willy Tarreau
2015-07-23 21:20   ` Peter Zijlstra
2015-07-23 21:35     ` Linus Torvalds
2015-07-23 21:45       ` Andy Lutomirski
2015-07-23 21:54         ` Linus Torvalds
2015-07-23 21:59           ` Andy Lutomirski
2015-07-23 22:03             ` Linus Torvalds
2015-07-24 10:28             ` Peter Zijlstra
2015-07-24 11:06           ` Peter Zijlstra
2015-07-23 21:17 ` Peter Zijlstra
2015-07-23 21:20 ` Steven Rostedt
2015-07-23 21:46   ` Andy Lutomirski
2015-07-24 16:33 ` Raymond Jennings

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=20150724133013.GI19282@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=w@1wt.eu \
    --cc=x86@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.