mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Dave Jones <davej@redhat.com>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 1/5] ftrace: Synchronize variable setting with breakpoints
Date: Thu, 31 May 2012 14:42:34 -0400	[thread overview]
Message-ID: <1338489754.13348.371.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1338485338.28384.85.camel@twins>

On Thu, 2012-05-31 at 19:28 +0200, Peter Zijlstra wrote:

> I don't know, nor did you explain the implicit ordering there. Also in
> such diagrams you need the other side as well.

Right, I forgot to add that.

> 
> > If another breakpoint is hit (one other than one put in by ftrace) then
> > we don't care. It wont crash the system whether or not A is 1 or 0. We
> > just need to make sure that a ftrace breakpoint that is hit knows that
> > it was a ftrace breakpoint (calls the ftrace handler). No other
> > breakpoint should be on a ftrace nop anyway.
> 
> So the ordering is like:
> 
> ---
> 
>  CPU-0				CPU-1
> 
> 
>  lock inc mod-count /* implicit (w)mb */
>  write int3
> 				<trap-int3> /* implicit (r)mb */
> 				load mod-count
> 
>  sync-ipi-broadcast
>  write rest-of-instruction
>  sync-ipi-broadcast
>  write head-of-instruction
>  sync-ipi-broadcast
>  lock dec mod-count /* implicit (w)mb */
> 
> 
> Such that when we observe the int3 on CPU-1 we also must see the
> increment on mod-count.
> 
> ---
> 
> A simple something like the above makes it very clear what we're doing
> and what we're expecting.

You are obviously better at drawing such diagrams than I am. Which also
explains why I needed to do the lockdep annotations to understand them
better. Because I don't have your ability to visualize it in such a nice
simple diagram. My vision is more of a bayesian tree than an oak. I
guess that explains why I like complex code so much :-)


>  I think a (local) trap should imply a barrier
> of sorts but will have to defer to others (hpa?) to confirm.

I would think it does, but lets have hpa or others confirm.


>  But at the
> very least write it down someplace that you are assuming that.

I'll cut and paste this into the comments.

> 
> 
> 
> fwiw run_sync() could do with a much bigger comment on why its sane to
> enable interrupts.. That simply reeks, enabling interrupts too early can
> wreck stuff properly.

Hmm, actually, I think these patches avoid the need for run_sync() at
boot up now anyway. Thus it shouldn't need to enable interrupts.

The ftrace.c code was what disabled interrupts on start up (and
re-enables them) before calling into this, this is because the old way
needed interrupts disabled, and other archs still use the old way. But,
your point stands, it should be commented better.

-- Steve





  reply	other threads:[~2012-05-31 18:42 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31  1:28 [PATCH 0/5] [GIT PULL] ftrace: Fix bug with function tracing and lockdep Steven Rostedt
2012-05-31  1:28 ` [PATCH 1/5] ftrace: Synchronize variable setting with breakpoints Steven Rostedt
2012-05-31 11:06   ` Peter Zijlstra
2012-05-31 14:08     ` Steven Rostedt
2012-05-31 15:16       ` Masami Hiramatsu
2012-05-31 15:29         ` Steven Rostedt
2012-05-31 17:28       ` Peter Zijlstra
2012-05-31 18:42         ` Steven Rostedt [this message]
2012-05-31 17:40       ` Peter Zijlstra
2012-05-31 17:44         ` Peter Zijlstra
2012-05-31 17:53         ` Steven Rostedt
2012-05-31 18:03           ` Peter Zijlstra
2012-05-31 18:50             ` Steven Rostedt
2012-05-31 19:06               ` Peter Zijlstra
2012-05-31 19:55                 ` Mathieu Desnoyers
2012-05-31 20:10                   ` Steven Rostedt
2012-05-31 20:26                     ` Peter Zijlstra
2012-05-31 20:37                       ` Steven Rostedt
2012-05-31 20:40                         ` Steven Rostedt
2012-05-31 20:40                         ` Peter Zijlstra
2012-05-31 20:49                           ` Steven Rostedt
2012-06-01  4:53                             ` Masami Hiramatsu
2012-06-01 11:37                               ` Steven Rostedt
2012-06-01 12:52                                 ` Masami Hiramatsu
2012-06-01  0:45                       ` Arnaldo Carvalho de Melo
2012-05-31  1:28 ` [PATCH 2/5] ftrace: Use breakpoint method to update ftrace caller Steven Rostedt
2012-05-31 11:18   ` Peter Zijlstra
2012-05-31 14:19     ` Steven Rostedt
2012-05-31  1:28 ` [PATCH 3/5] x86: Reset the debug_stack update counter Steven Rostedt
2012-05-31 19:19   ` H. Peter Anvin
2012-05-31 19:26     ` Steven Rostedt
2012-05-31  1:28 ` [PATCH 4/5] x86: Allow nesting of the debug stack IDT setting Steven Rostedt
2012-05-31 18:44   ` H. Peter Anvin
2012-05-31 18:58   ` H. Peter Anvin
2012-05-31 19:25     ` Steven Rostedt
2012-05-31 19:27       ` H. Peter Anvin
2012-05-31 20:00         ` Steven Rostedt
2012-05-31 20:17           ` H. Peter Anvin
2012-05-31 20:35             ` Steven Rostedt
2012-05-31 20:39               ` H. Peter Anvin
2012-05-31 20:56                 ` Steven Rostedt
2012-05-31 21:09                   ` H. Peter Anvin
2012-05-31 21:37                     ` Steven Rostedt
2012-05-31 21:38                       ` Steven Rostedt
2012-06-01  2:30       ` Steven Rostedt
2012-05-31  1:28 ` [PATCH 5/5] ftrace/x86: Do not change stacks in DEBUG when calling lockdep Steven Rostedt
2012-05-31  2:13 ` [PATCH 0/5] (for 3.5)[GIT PULL] ftrace: Fix bug with function tracing and lockdep Steven Rostedt

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=1338489754.13348.371.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®