mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Jason Baron <jbaron@redhat.com>,
	linux-kernel@vger.kernel.org, roland@redhat.com, rth@redhat.com,
	mingo@elte.hu
Subject: Re: [PATCH 0/4] RFC: jump label - (tracepoint optimizations)
Date: Thu, 10 Sep 2009 17:15:59 -0400	[thread overview]
Message-ID: <1252617359.18996.36.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20090907170619.GB6968@Krystal>

On Mon, 2009-09-07 at 13:06 -0400, Mathieu Desnoyers wrote:
> * Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) wrote:
> > * Jason Baron (jbaron@redhat.com) wrote:
> [...]
> > > Solution:
> > > 
> > > In discussing this problem with Roland McGrath and Richard Henderson, we came 
> > > up with a new 'asm goto' statement that allows branching to a label. Thus, this
> > > patch set introdues a 'STATIC_JUMP_IF()' macro as follows:
> > > 
> > > #ifdef HAVE_STATIC_JUMP
> > > 
> > > #define STATIC_JUMP_IF(tag, label, cond)                               \
> > >        asm goto ("1:"   /* 5-byte insn */                              \
> > >           P6_NOP5                                                      \
> > 
> > Hrm, be careful there. P6_NOP5 is not always a single instruction. If
> > you are preempted in the middle of it, bad things could happen, even
> > with stop_machine, if you iret in the middle the of the new jump
> > instruction. It could cause an illegal instruction fault. You should use
> > an atomic nop5. I think the function tracer already does, since I
> > told Steven about this exact issue.
> > 
> 
> Just to clarify this statement:
> 
> P6_NOP5 happens to be an atomic nop, but nothing states this requirement
> in arch/x86/include/asm/nops.h. Other 5-bytes nops are defined as
> multiple instructions (e.g. 2 bytes + 3 bytes nops). So I recommend to
> create a family of ATOMIC_P6_NOP5 (and other ATOMIC_*_NOP5 defines) to
> document this atomicity requirement.

Although I agree that we probably should place a comment in that file, I
highly doubt anyone will change that. But who knows?

> 
> Ftrace could probably handle this more gracefully than it does at the
> moment. It basically assumes that P6_NOP5 is atomic, and falls back on a
> 5-bytes jmp if it detects that P6_NOP5 faults.
> 
> That's coherent with the
> "TODO: check the cpuid to determine the best nop."
> 
> present in x86 ftrace.c.
> 
> So, at the very least, if we rely on nops.h having a single-instruction
> P6_NOP5 5 bytes nop, a comment to that effect should be added to nops.h.

I might as well go add one.

-- Steve



  reply	other threads:[~2009-09-10 21:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 20:25 Jason Baron
2009-09-03 20:25 ` [PATCH 1/4] RFC: basic jump label implementation Jason Baron
2009-09-03 20:25 ` [PATCH 2/4] RFC: jump label example usage Jason Baron
2009-09-03 20:26 ` [PATCH 3/4] RFC: implement tracepoints on top of jump patching Jason Baron
2009-09-03 20:26 ` [PATCH 4/4] RFC: performance testing harness Jason Baron
2009-09-03 20:45 ` [PATCH 0/4] RFC: jump label - (tracepoint optimizations) Daniel Walker
2009-09-03 21:01 ` Ingo Molnar
2009-09-03 21:11   ` Roland McGrath
2009-09-07 15:48 ` Mathieu Desnoyers
2009-09-07 17:06   ` Mathieu Desnoyers
2009-09-10 21:15     ` Steven Rostedt [this message]
2009-09-08 20:48   ` Jason Baron

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=1252617359.18996.36.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=rth@redhat.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

all inboxes | Powered by JetHome®