linux_old1/arch
Steven Rostedt 732f3ca7d4 ftrace: use only 5 byte nops for x86
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, 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.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-10-14 10:35:01 +02:00
..
alpha kernel/cpu.c: create a CPU_STARTING cpu_chain notifier 2008-09-08 19:25:24 +02:00
arm Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog 2008-10-12 11:51:32 -07:00
avr32 avr32: Fix build failures in board code 2008-10-12 16:13:28 +02:00
blackfin Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode 2008-10-13 09:51:38 -07:00
cris kernel/cpu.c: create a CPU_STARTING cpu_chain notifier 2008-09-08 19:25:24 +02:00
frv FRV: Wire up new system calls 2008-08-01 13:03:49 -07:00
h8300 [h8300] move include/asm-h8300 to arch/h8300/include/asm 2008-08-13 14:26:32 -07:00
ia64 Merge branch 'x86/urgent' into core/signal 2008-10-12 11:32:17 +02:00
m32r Merge branches 'sched/devel', 'sched/cpu-hotplug', 'sched/cpusets' and 'sched/urgent' into sched/core 2008-10-08 11:31:02 +02:00
m68k m68k: Update defconfigs for 2.6.27-rc6 2008-09-10 14:15:29 -07:00
m68knommu m68k{,nommu}: Wire up new system calls 2008-08-11 10:37:34 -07:00
mips MIPS: RB532: provide GPIO_BUILTIN_NR and irq_to_gpio/gpio_to_irq 2008-10-11 16:18:57 +01:00
mn10300 MN10300: Fix IRQ handling 2008-10-01 09:40:43 -07:00
parisc lib: Correct printk %pF to work on all architectures 2008-09-09 11:51:15 -07:00
powerpc Merge branch 'x86/urgent' into core/signal 2008-10-12 11:32:17 +02:00
s390 Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6 2008-10-11 08:50:01 -07:00
sh kernel/cpu.c: create a CPU_STARTING cpu_chain notifier 2008-09-08 19:25:24 +02:00
sparc serial: allow 8250 to be used on sparc 2008-10-13 09:51:40 -07:00
sparc64 Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-10-11 12:39:35 -07:00
um uml: small cleanups and note bugs to be dealt with by uml authors... 2008-10-13 09:51:40 -07:00
x86 ftrace: use only 5 byte nops for x86 2008-10-14 10:35:01 +02:00
xtensa remove unneeded #include <linux/ide.h>'s 2008-08-05 18:17:00 +02:00
.gitignore
Kconfig Merge branch 'linus' into oprofile-v2 2008-10-13 11:05:51 +02:00