[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48A4C491.4050301@goop.org>
Date: Thu, 14 Aug 2008 16:49:37 -0700
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Steven Rostedt <rostedt@...dmis.org>
CC: LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
David Miller <davem@...emloft.net>,
Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>,
Roland McGrath <roland@...hat.com>,
Ulrich Drepper <drepper@...hat.com>,
Rusty Russell <rusty@...tcorp.com.au>,
Gregory Haskins <ghaskins@...ell.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
"Luis Claudio R. Goncalves" <lclaudio@...g.org>,
Clark Williams <williams@...hat.com>, srostedt@...hat.com
Subject: Re: [PATCH] ftrace: use only 5 byte nops for x86
Steven Rostedt wrote:
> Mathieu Desnoyers revealed a bug in the original code. The nop that is
> used to relpace the mcount caller can be a two part nop. This runs the
> risk where a process can be preempted after executing the first nop, but
> before the second part of the nop.
>
> The ftrace code calls kstop_machine to keep multiple CPUs from executing
> code that is being modified, but it does not protect against a task preempting
> in the middle of a two part nop.
>
> If the above preemption happens and the tracer is enabled, after the
> kstop_machine runs, all those nops will be calls to the trace function.
> If the preempted process that was preempted between the two nops is executed
> again, it will execute half of the call to the trace function, and this
> might crash the system.
>
> This patch instead uses what both the latest Intel and AMD spec suggests.
> That is the P6_NOP5 sequence of "0x0f 0x1f 0x44 0x00 0x00".
> Note, some older CPUs and QEMU might fault on this nop, so this nop
> is executed with fault handling first. If it detects a fault, it will then
> use the code "0x66 0x66 0x66 0x66 0x90". If that faults,
Seems very unlikely, but go mad ;)
> it will then
> default to a simple "jmp 1f; .byte 0x00 0x00 0x00; 1:". The jmp is
> not optimal but will do if the first two can not be executed.
>
> TODO: Examine the cpuid to determine the nop to use.
>
Don't think that will help in general. qemu claims its a Pentium II.
J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists