public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Jason Baron <jbaron@redhat.com>,
	mingo@elte.hu, mathieu.desnoyers@polymtl.ca, hpa@zytor.com,
	tglx@linutronix.de, andi@firstfloor.org, roland@redhat.com,
	rth@redhat.com, masami.hiramatsu.pt@hitachi.com,
	fweisbec@gmail.com, avi@redhat.com, davem@davemloft.net,
	sam@ravnborg.org, ddaney@caviumnetworks.com,
	linux-kernel@vger.kernel.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 1/3] jump label: add enabled/disabled state to jump label key entries
Date: Fri, 26 Nov 2010 00:42:44 +1100	[thread overview]
Message-ID: <1290692564.689.28.camel@concordia> (raw)
In-Reply-To: <1290667950.2072.545.camel@laptop>

[-- Attachment #1: Type: text/plain, Size: 2281 bytes --]

On Thu, 2010-11-25 at 07:52 +0100, Peter Zijlstra wrote:
> On Thu, 2010-11-25 at 13:39 +1100, Michael Ellerman wrote:
> > > > arch/powerpc/lib/code-patching.c:
> > > > 
> > > > void patch_instruction(unsigned int *addr, unsigned int instr)
> > > > {
> > > >         *addr = instr;
> > > >         asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r"
> > > > (addr));
> > > > }
> > > 
> > > Is this ever called outside of boot up? After SMP is enabled? (besides
> > > for creating trampolines, before they are used).
> > 
> > It is now :)
> > 
> > AFAIK it works fine, the icbi invalidates across all processors. The
> > only issue is that it's not precise, ie. another CPU might not see the
> > update immediately, but as soon as it takes an interrupt or something it
> > will.
> 
> Ooh, nice, so the CPUs won't get all confused because you change code
> from under their ifetch cache?

Apparently not, at least according to the architecture.

> How expensive is this icbi ins?

Well apparently it's free :)  But it has the effect of causing the
subsequent isync to do the real work, so that is probably expensive.
Benh can tell you all the gory details.

> > What would suit us would be to have an arch callback that is called
> > after all the transforms for a particular jump label key have been made.
> > That way we could optimise the individual patches, and do a sync step at
> > the end, ie. when we want the effect of the patching to be globally
> > visible. 
> 
> I think such a sync-barrier is desired (possibly only on the enable
> path) so we can actually say the tracepoints are on.

It might be nice on disable too, presumably the tracepoint code is happy
with them firing more or less any time, but other users of jump labels
might want a firmer guarantee that they are disabled.

> Which would mean sending IPIs to all CPUs and waiting for them to
> acknowledge them. Which, while not quite as expensive as stop_machine,
> its not really cheap either.

True, and presumably the sync point is once per jump label, ie. once per
tracepoint. For tracepoints you'd actually be happy with eg. perf
enabling a whole bunch, and then syncing just at the end, but that's
probably premature optimisation.

cheers



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2010-11-25 13:42 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 21:27 [PATCH 0/3] jump label: updates for 2.6.37 Jason Baron
2010-11-23 21:27 ` [PATCH 1/3] jump label: add enabled/disabled state to jump label key entries Jason Baron
2010-11-23 23:43   ` Mathieu Desnoyers
2010-11-24  0:00     ` Steven Rostedt
2010-11-24  0:24       ` Mathieu Desnoyers
2010-11-24 18:24         ` Jason Baron
2010-11-24 18:39           ` Peter Zijlstra
2010-11-24 19:07             ` Jason Baron
2010-11-24  8:20   ` Peter Zijlstra
2010-11-24 14:54     ` Jason Baron
2010-11-24 15:11       ` Peter Zijlstra
2010-11-24 15:19         ` Jason Baron
2010-11-24 15:24           ` Peter Zijlstra
2010-11-24 15:42             ` Jason Baron
2010-11-24 15:53               ` Steven Rostedt
2010-11-25  2:39                 ` Michael Ellerman
2010-11-25  6:52                   ` Peter Zijlstra
2010-11-25 13:14                     ` Mathieu Desnoyers
2010-11-25 13:42                     ` Michael Ellerman [this message]
2010-11-25 21:26                       ` Benjamin Herrenschmidt
2010-11-24 16:56               ` David Daney
2010-11-24 15:15       ` Steven Rostedt
2010-11-24 15:21         ` Jason Baron
2010-11-24 15:25           ` Peter Zijlstra
2010-11-24 15:57           ` Steven Rostedt
2010-11-24 19:18             ` Jason Baron
2010-11-24 15:21         ` Peter Zijlstra
2010-11-23 21:27 ` [PATCH 2/3] jump label: move jump table to r/w section Jason Baron
2010-11-23 23:55   ` Mathieu Desnoyers
2010-11-24  0:04     ` Steven Rostedt
2010-11-24  0:27       ` Mathieu Desnoyers
2010-11-24  0:35         ` Steven Rostedt
2010-11-24  2:18     ` Steven Rostedt
2010-11-24  2:59       ` Steven Rostedt
2010-11-23 21:27 ` [PATCH 3/3] jump label: add docs Jason Baron
2010-11-23 21:36 ` [PATCH 0/3] jump label: updates for 2.6.37 H. Peter Anvin
2010-11-23 23:11   ` Steven Rostedt
2010-11-23 23:32     ` H. Peter Anvin
2010-11-24  0:10       ` Steven Rostedt
2010-11-24  0:36         ` Steven Rostedt
2010-11-24  0:37           ` H. Peter Anvin
2010-11-23 21:42 ` Steven Rostedt
2010-11-23 21:56   ` Jason Baron
2010-11-23 23:10     ` Steven Rostedt
2010-11-24  8:29       ` Peter Zijlstra
2010-11-24  9:21         ` Andi Kleen
2010-11-24 12:47         ` Steven Rostedt
2010-11-24 13:49           ` 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=1290692564.689.28.camel@concordia \
    --to=michael@ellerman.id.au \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=ddaney@caviumnetworks.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rth@redhat.com \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    /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