public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/8] jump label v4
@ 2010-01-12 16:26 Jason Baron
  2010-01-12 16:26 ` [RFC PATCH 1/8] jump label v4 - kprobes/x86: Cleanup RELATIVEJUMP_INSTRUCTION to RELATIVEJUMP_OPCODE Jason Baron
                   ` (7 more replies)
  0 siblings, 8 replies; 36+ messages in thread
From: Jason Baron @ 2010-01-12 16:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, mathieu.desnoyers, hpa, tglx, rostedt, andi, roland, rth,
	mhiramat

hi,

For background, see previous posting: http://marc.info/?l=linux-kernel&m=125858436505941&w=2

Refresh of the jump labeling patches. The largest update revolves around how
the jump labels are organized. I've added a hash table, using the name
of the tracepoints as the 'key'. (I might want to change this to a pointer,
for other users, but the string key works well for tracepoints). I've also
pre-sorted the jump tables by name. Thus, when a jump label is enabled/disabled
we look up its hash table entry and then walk the list of associated jump
labels. The implementation also associates module jump sections with the
appropriate keys as they are inserted and removed.

The first 2 patches of the series are a repost of Masami's text_poke_fixup()
function, which allows for efficient instruction patching. I believe this is
still an ongoing discussion, on the best safest approach here. Masami's
text_poke_fixup() has been working well for me. But I could certainly
substitute a 'stop_machine()' version or something similar if there is enough
interest, until we have a more efficient solution.

patches are against the latest -tip tree.

thanks,

-Jason

Masami Hiramatsu (2):
        x86: Introduce generic jump patching without stop_machine
        kprobes/x86: Cleanup RELATIVEJUMP_INSTRUCTION to RELATIVEJUMP_OPCODE

Mathieu Desnoyers (1):
	notifier atomic call chain notrace

Jason Baron(5):
        move opcode defs from asm/kprobes.h to asm/alternative.h
        jump label base
	x86: jump label support
        jump label tracepoint support
        jump label module support


 arch/x86/include/asm/alternative.h |   17 ++
 arch/x86/include/asm/jump_label.h  |   32 ++++
 arch/x86/include/asm/kprobes.h     |    3 -
 arch/x86/kernel/Makefile           |    2 +-
 arch/x86/kernel/alternative.c      |  120 ++++++++++++++
 arch/x86/kernel/jump_label.c       |   52 ++++++
 arch/x86/kernel/kprobes.c          |    2 +-
 arch/x86/kernel/ptrace.c           |    1 +
 include/asm-generic/vmlinux.lds.h  |   10 +-
 include/linux/jump_label.h         |   58 +++++++
 include/linux/module.h             |    5 +-
 include/linux/tracepoint.h         |   34 +++--
 kernel/Makefile                    |    2 +-
 kernel/jump_label.c                |  301 ++++++++++++++++++++++++++++++++++++
 kernel/kprobes.c                   |    2 +-
 kernel/module.c                    |    7 +
 kernel/notifier.c                  |    6 +-
 kernel/tracepoint.c                |    8 +
 18 files changed, 635 insertions(+), 27 deletions(-)
 create mode 100644 arch/x86/include/asm/jump_label.h
 create mode 100644 arch/x86/kernel/jump_label.c
 create mode 100644 include/linux/jump_label.h
 create mode 100644 kernel/jump_label.c


^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: [RFC PATCH 2/8] jump label v4 - x86: Introduce generic jump patching without stop_machine
@ 2010-01-17 22:56 H. Peter Anvin
  0 siblings, 0 replies; 36+ messages in thread
From: H. Peter Anvin @ 2010-01-17 22:56 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: rostedt, Jason Baron, linux-kernel, mingo, tglx, andi, roland,
	rth, mhiramat, Arjan van de Ven

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

If single-byte updates weren't atomic, then the int3 scheme would not be possible in the first place.  Of course, if you want there to be a synchronization point beyond which the modification is guaranteed to have affected all CPUs, you need an IPI-IRET on all CPUs.

The other thing to watch out for is that the CPU itself is subject to text modification through a different alias, which means some of the hardware SMC protections are ineffective.

"Mathieu Desnoyers" <mathieu.desnoyers@polymtl.ca> wrote:

>* H. Peter Anvin (hpa@zytor.com) wrote:
>> On 01/14/2010 07:32 AM, Steven Rostedt wrote:
>> >> +
>> >> +	/* Replacing 1 byte can be done atomically. */
>> >> +	if (unlikely(len <= 1))
>> >> +		return text_poke(addr, opcode, len);
>> > 
>> > This part bothers me. The text_poke just writes over the text directly
>> > (using a separate mapping). But if that memory is in the pipeline of
>> > another CPU, I think this could cause a GPF.
>> > 
>> 
>> Could you clarify why you think that?
>
>Basically, what Steven and I were concerned about in this particular
>patch version is the fact that this code took a "shortcut" for
>single-byte text modification, thus bypassing the int3-bypass scheme
>altogether.
>
>As mere atomicity of the modification is not the only concern here
>(because we also have to deal with instruction trace cache coherency and
>so forth), then the int3 breakpoint scheme is, I think, also needed for
>single-byte updates.
>
>Thanks,
>
>Mathieu
>
>> 
>> 	-hpa
>> 
>> -- 
>> H. Peter Anvin, Intel Open Source Technology Center
>> I work for Intel.  I don't speak on their behalf.
>> 
>
>-- 
>Mathieu Desnoyers
>OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

--
Sent from my mobile phone, pardon any lack of formatting.

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2010-04-13 17:16 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12 16:26 [RFC PATCH 0/8] jump label v4 Jason Baron
2010-01-12 16:26 ` [RFC PATCH 1/8] jump label v4 - kprobes/x86: Cleanup RELATIVEJUMP_INSTRUCTION to RELATIVEJUMP_OPCODE Jason Baron
2010-01-12 16:26 ` [RFC PATCH 2/8] jump label v4 - x86: Introduce generic jump patching without stop_machine Jason Baron
2010-01-12 23:16   ` H. Peter Anvin
2010-01-13  2:06     ` Mathieu Desnoyers
2010-01-13  4:55       ` H. Peter Anvin
2010-01-13 14:30         ` Mathieu Desnoyers
2010-01-14  6:57           ` Masami Hiramatsu
2010-01-14 18:45           ` Masami Hiramatsu
2010-04-13 17:16             ` Mathieu Desnoyers
2010-01-13  5:38     ` Masami Hiramatsu
2010-01-14 15:32   ` Steven Rostedt
2010-01-14 15:36     ` H. Peter Anvin
2010-01-17 18:55       ` Mathieu Desnoyers
2010-01-17 19:16         ` Arjan van de Ven
2010-01-18 15:59           ` Masami Hiramatsu
2010-01-18 16:23             ` H. Peter Anvin
2010-01-18 16:52               ` Mathieu Desnoyers
2010-01-18 18:50                 ` H. Peter Anvin
2010-01-18 20:53                   ` Masami Hiramatsu
2010-01-18 21:18                     ` H. Peter Anvin
2010-01-18 21:32                   ` Mathieu Desnoyers
2010-01-18 16:31             ` Arjan van de Ven
2010-01-18 16:54               ` Mathieu Desnoyers
2010-01-18 18:21                 ` Masami Hiramatsu
2010-01-18 18:33                   ` Mathieu Desnoyers
2010-01-14 15:39     ` Mathieu Desnoyers
2010-01-14 16:23       ` Masami Hiramatsu
2010-01-14 16:42         ` Jason Baron
2010-01-12 16:26 ` [RFC PATCH 3/8] jump label v4 - move opcode definitions Jason Baron
2010-01-12 16:26 ` [RFC PATCH 4/8] jump label v4 - notifier atomic call chain notrace Jason Baron
2010-01-12 16:26 ` [RFC PATCH 5/8] jump label v4 - base patch Jason Baron
2010-01-12 16:26 ` [RFC PATCH 6/8] jump label v4 - x86 support Jason Baron
2010-01-12 16:26 ` [RFC PATCH 7/8] jump label v4 - tracepoint support Jason Baron
2010-01-12 16:26 ` [RFC PATCH 8/8] jump label v4 - add module support Jason Baron
  -- strict thread matches above, loose matches on Subject: below --
2010-01-17 22:56 [RFC PATCH 2/8] jump label v4 - x86: Introduce generic jump patching without stop_machine H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox