Patches contributed by Eötvös Lorand University
commit 14ae22ba2b8bb3d53fb795f9b8074aa39ef7b6cd
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Nov 21 15:20:47 2008 +0100
x86: entry_64.S: rename
Impact: cleanup
Rename:
CFI_PUSHQ => pushq_cfi
CFI_POPQ => popq_cfi
CFI_MOVQ => movq_cfi
To make it blend better into regular assembly code.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 4e3d83678f85..92c5e18340db 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -63,17 +63,17 @@
/*
* Some macro's to hide the most frequently occuring CFI annotations.
*/
- .macro CFI_PUSHQ reg
+ .macro pushq_cfi reg
pushq \reg
CFI_ADJUST_CFA_OFFSET 8
.endm
- .macro CFI_POPQ reg
+ .macro popq_cfi reg
popq \reg
CFI_ADJUST_CFA_OFFSET -8
.endm
- .macro CFI_MOVQ reg offset=0
+ .macro movq_cfi reg offset=0
movq %\reg, \offset(%rsp)
CFI_REL_OFFSET \reg, \offset
.endm
@@ -297,17 +297,18 @@ ENTRY(native_usergs_sysret64)
ENTRY(save_args)
XCPT_FRAME
cld
- CFI_MOVQ rdi, RDI+16-ARGOFFSET
- CFI_MOVQ rsi, RSI+16-ARGOFFSET
- CFI_MOVQ rdx, RDX+16-ARGOFFSET
- CFI_MOVQ rcx, RCX+16-ARGOFFSET
- CFI_MOVQ rax, RAX+16-ARGOFFSET
- CFI_MOVQ r8, R8+16-ARGOFFSET
- CFI_MOVQ r9, R9+16-ARGOFFSET
- CFI_MOVQ r10, R10+16-ARGOFFSET
- CFI_MOVQ r11, R11+16-ARGOFFSET
+ movq_cfi rdi, RDI+16-ARGOFFSET
+ movq_cfi rsi, RSI+16-ARGOFFSET
+ movq_cfi rdx, RDX+16-ARGOFFSET
+ movq_cfi rcx, RCX+16-ARGOFFSET
+ movq_cfi rax, RAX+16-ARGOFFSET
+ movq_cfi r8, R8+16-ARGOFFSET
+ movq_cfi r9, R9+16-ARGOFFSET
+ movq_cfi r10, R10+16-ARGOFFSET
+ movq_cfi r11, R11+16-ARGOFFSET
+
leaq -ARGOFFSET+16(%rsp),%rdi /* arg1 for handler */
- CFI_MOVQ rbp, 8 /* push %rbp */
+ movq_cfi rbp, 8 /* push %rbp */
leaq 8(%rsp), %rbp /* mov %rsp, %ebp */
testl $3, CS(%rdi)
je 1f
@@ -320,10 +321,10 @@ ENTRY(save_args)
*/
1: incl %gs:pda_irqcount
jne 2f
- CFI_POPQ %rax /* move return address... */
+ popq_cfi %rax /* move return address... */
mov %gs:pda_irqstackptr,%rsp
EMPTY_FRAME 0
- CFI_PUSHQ %rax /* ... to the new stack */
+ pushq_cfi %rax /* ... to the new stack */
/*
* We entered an interrupt context - irqs are off:
*/
@@ -968,7 +969,7 @@ END(spurious_interrupt)
.macro zeroentry sym
INTR_FRAME
PARAVIRT_ADJUST_EXCEPTION_FRAME
- CFI_PUSHQ $-1 /* ORIG_RAX: no syscall to restart */
+ pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
subq $15*8,%rsp
CFI_ADJUST_CFA_OFFSET 15*8
call error_entry
@@ -1103,21 +1104,21 @@ KPROBE_ENTRY(error_entry)
CFI_ADJUST_CFA_OFFSET 15*8
/* oldrax contains error code */
cld
- CFI_MOVQ rdi, RDI+8
- CFI_MOVQ rsi, RSI+8
- CFI_MOVQ rdx, RDX+8
- CFI_MOVQ rcx, RCX+8
- CFI_MOVQ rax, RAX+8
- CFI_MOVQ r8, R8+8
- CFI_MOVQ r9, R9+8
- CFI_MOVQ r10, R10+8
- CFI_MOVQ r11, R11+8
- CFI_MOVQ rbx, RBX+8
- CFI_MOVQ rbp, RBP+8
- CFI_MOVQ r12, R12+8
- CFI_MOVQ r13, R13+8
- CFI_MOVQ r14, R14+8
- CFI_MOVQ r15, R15+8
+ movq_cfi rdi, RDI+8
+ movq_cfi rsi, RSI+8
+ movq_cfi rdx, RDX+8
+ movq_cfi rcx, RCX+8
+ movq_cfi rax, RAX+8
+ movq_cfi r8, R8+8
+ movq_cfi r9, R9+8
+ movq_cfi r10, R10+8
+ movq_cfi r11, R11+8
+ movq_cfi rbx, RBX+8
+ movq_cfi rbp, RBP+8
+ movq_cfi r12, R12+8
+ movq_cfi r13, R13+8
+ movq_cfi r14, R14+8
+ movq_cfi r15, R15+8
xorl %ebx,%ebx
testl $3,CS+8(%rsp)
je error_kernelspace
@@ -1515,9 +1516,9 @@ ENTRY(xen_failsafe_callback)
CFI_RESTORE r11
addq $0x30,%rsp
CFI_ADJUST_CFA_OFFSET -0x30
- CFI_PUSHQ $0 /* RIP */
- CFI_PUSHQ %r11
- CFI_PUSHQ %rcx
+ pushq_cfi $0 /* RIP */
+ pushq_cfi %r11
+ pushq_cfi %rcx
jmp general_protection
CFI_RESTORE_STATE
1: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */
@@ -1527,7 +1528,7 @@ ENTRY(xen_failsafe_callback)
CFI_RESTORE r11
addq $0x30,%rsp
CFI_ADJUST_CFA_OFFSET -0x30
- CFI_PUSHQ $0
+ pushq_cfi $0
SAVE_ALL
jmp error_exit
CFI_ENDPROC
commit e8a0e27662186f8856a0a6242e7a8386c9a64a53
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Nov 21 15:11:32 2008 +0100
x86: clean up after: move entry_64.S register saving out of the macros, fix
Impact: build fix
The break builds with older binutils (2.16.1):
arch/x86/kernel/entry_64.S: Assembler messages:
arch/x86/kernel/entry_64.S:282: Error: too many positional arguments
arch/x86/kernel/entry_64.S:283: Error: too many positional arguments
arch/x86/kernel/entry_64.S:284: Error: too many positional arguments
arch/x86/kernel/entry_64.S:285: Error: too many positional arguments
arch/x86/kernel/entry_64.S:286: Error: too many positional arguments
arch/x86/kernel/entry_64.S:287: Error: too many positional arguments
arch/x86/kernel/entry_64.S:288: Error: too many positional arguments
arch/x86/kernel/entry_64.S:289: Error: too many positional arguments
arch/x86/kernel/entry_64.S:290: Error: too many positional arguments
Took some time to figure out the detail that GAS chokes on: it's
negative offsets. Rearrange the calculations to make sure we never
go negative.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 7a04f696121d..4e3d83678f85 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -247,12 +247,12 @@ ENTRY(native_usergs_sysret64)
* initial frame state for interrupts (and exceptions without error code)
*/
.macro INTR_FRAME start=1 offset=0
- EMPTY_FRAME \start, (SS+8-RIP)+\offset
- /*CFI_REL_OFFSET ss, SS-RIP+\offset*/
- CFI_REL_OFFSET rsp, RSP-RIP+\offset
- /*CFI_REL_OFFSET rflags, EFLAGS-RIP+\offset*/
- /*CFI_REL_OFFSET cs, CS-RIP+\offset*/
- CFI_REL_OFFSET rip, RIP-RIP+\offset
+ EMPTY_FRAME \start, SS+8+\offset-RIP
+ /*CFI_REL_OFFSET ss, SS+\offset-RIP*/
+ CFI_REL_OFFSET rsp, RSP+\offset-RIP
+ /*CFI_REL_OFFSET rflags, EFLAGS+\offset-RIP*/
+ /*CFI_REL_OFFSET cs, CS+\offset-RIP*/
+ CFI_REL_OFFSET rip, RIP+\offset-RIP
.endm
/*
@@ -260,7 +260,7 @@ ENTRY(native_usergs_sysret64)
* with vector already pushed)
*/
.macro XCPT_FRAME start=1 offset=0
- INTR_FRAME \start, (RIP-ORIG_RAX)+\offset
+ INTR_FRAME \start, RIP+\offset-ORIG_RAX
/*CFI_REL_OFFSET orig_rax, ORIG_RAX-ORIG_RAX*/
.endm
@@ -268,23 +268,23 @@ ENTRY(native_usergs_sysret64)
* frame that enables calling into C.
*/
.macro PARTIAL_FRAME start=1 offset=0
- XCPT_FRAME \start, (ORIG_RAX-ARGOFFSET)+\offset
- CFI_REL_OFFSET rdi, (RDI-ARGOFFSET)+\offset
- CFI_REL_OFFSET rsi, (RSI-ARGOFFSET)+\offset
- CFI_REL_OFFSET rdx, (RDX-ARGOFFSET)+\offset
- CFI_REL_OFFSET rcx, (RCX-ARGOFFSET)+\offset
- CFI_REL_OFFSET rax, (RAX-ARGOFFSET)+\offset
- CFI_REL_OFFSET r8, (R8-ARGOFFSET)+\offset
- CFI_REL_OFFSET r9, (R9-ARGOFFSET)+\offset
- CFI_REL_OFFSET r10, (R10-ARGOFFSET)+\offset
- CFI_REL_OFFSET r11, (R11-ARGOFFSET)+\offset
+ XCPT_FRAME \start, ORIG_RAX+\offset-ARGOFFSET
+ CFI_REL_OFFSET rdi, RDI+\offset-ARGOFFSET
+ CFI_REL_OFFSET rsi, RSI+\offset-ARGOFFSET
+ CFI_REL_OFFSET rdx, RDX+\offset-ARGOFFSET
+ CFI_REL_OFFSET rcx, RCX+\offset-ARGOFFSET
+ CFI_REL_OFFSET rax, RAX+\offset-ARGOFFSET
+ CFI_REL_OFFSET r8, R8+\offset-ARGOFFSET
+ CFI_REL_OFFSET r9, R9+\offset-ARGOFFSET
+ CFI_REL_OFFSET r10, R10+\offset-ARGOFFSET
+ CFI_REL_OFFSET r11, R11+\offset-ARGOFFSET
.endm
/*
* frame that enables passing a complete pt_regs to a C function.
*/
.macro DEFAULT_FRAME start=1 offset=0
- PARTIAL_FRAME \start, (R11-R15)+\offset
+ PARTIAL_FRAME \start, R11+\offset-R15
CFI_REL_OFFSET rbx, RBX+\offset
CFI_REL_OFFSET rbp, RBP+\offset
CFI_REL_OFFSET r12, R12+\offset
@@ -297,15 +297,15 @@ ENTRY(native_usergs_sysret64)
ENTRY(save_args)
XCPT_FRAME
cld
- CFI_MOVQ rdi, (RDI-ARGOFFSET)+16
- CFI_MOVQ rsi, (RSI-ARGOFFSET)+16
- CFI_MOVQ rdx, (RDX-ARGOFFSET)+16
- CFI_MOVQ rcx, (RCX-ARGOFFSET)+16
- CFI_MOVQ rax, (RAX-ARGOFFSET)+16
- CFI_MOVQ r8, (R8-ARGOFFSET)+16
- CFI_MOVQ r9, (R9-ARGOFFSET)+16
- CFI_MOVQ r10, (R10-ARGOFFSET)+16
- CFI_MOVQ r11, (R11-ARGOFFSET)+16
+ CFI_MOVQ rdi, RDI+16-ARGOFFSET
+ CFI_MOVQ rsi, RSI+16-ARGOFFSET
+ CFI_MOVQ rdx, RDX+16-ARGOFFSET
+ CFI_MOVQ rcx, RCX+16-ARGOFFSET
+ CFI_MOVQ rax, RAX+16-ARGOFFSET
+ CFI_MOVQ r8, R8+16-ARGOFFSET
+ CFI_MOVQ r9, R9+16-ARGOFFSET
+ CFI_MOVQ r10, R10+16-ARGOFFSET
+ CFI_MOVQ r11, R11+16-ARGOFFSET
leaq -ARGOFFSET+16(%rsp),%rdi /* arg1 for handler */
CFI_MOVQ rbp, 8 /* push %rbp */
leaq 8(%rsp), %rbp /* mov %rsp, %ebp */
commit fc02e90c34bacd5d7bc77b832c65a8f06e1bd60e
Merge: ec4e0e2fe018 13d428afc007
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Nov 21 08:57:04 2008 +0100
Merge commit 'v2.6.28-rc6' into sched/core
commit c032a2de4c1a82187e9a754511043be47c8a92b5
Merge: 722024dbb74f cbe9ee00cea5
Author: Ingo Molnar <mingo@elte.hu>
Date: Thu Nov 20 10:48:28 2008 +0100
Merge branch 'x86/cleanups' into x86/irq
[ merged x86/cleanups into x86/irq to enable a wider IRQ entry code
patch to be applied, which depends on a cleanup patch in x86/cleanups. ]
commit 90accd6fabf9b2fa2705945a4c601877a75d43bf
Merge: b43d196c4d3f ee2f6cc7f9ea
Author: Ingo Molnar <mingo@elte.hu>
Date: Thu Nov 20 09:03:38 2008 +0100
Merge branch 'linus' into x86/memory-corruption-check
diff --cc arch/x86/mm/init_64.c
index d6ef1589b95a,9db01db6e3cd..9f7a0d24d42a
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@@ -878,7 -900,10 +900,8 @@@ static struct kcore_list kcore_mem, kco
void __init mem_init(void)
{
long codesize, reservedpages, datasize, initsize;
+ unsigned long absent_pages;
- start_periodic_check_for_corruption();
-
pci_iommu_alloc();
/* clear_bss() already clear the empty_zero_page */
commit fbc2a06056c9aa3cb8c44bf1cfeb1d260e229e5c
Merge: a3d732f93785 ee2f6cc7f9ea
Author: Ingo Molnar <mingo@elte.hu>
Date: Thu Nov 20 09:02:39 2008 +0100
Merge branch 'linus' into x86/uv
diff --cc arch/x86/kernel/genx2apic_uv_x.c
index d7213a1cb784,2c7dbdb98278..f02bbe5d0178
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@@ -16,12 -15,8 +16,11 @@@
#include <linux/ctype.h>
#include <linux/init.h>
#include <linux/sched.h>
- #include <linux/bootmem.h>
#include <linux/module.h>
#include <linux/hardirq.h>
+#include <linux/timer.h>
+#include <linux/proc_fs.h>
+#include <asm/current.h>
#include <asm/smp.h>
#include <asm/ipi.h>
#include <asm/genapic.h>
commit 9676e73a9e0cbdc521e1ebf4e13e6e5aada34247
Merge: 5a209c2d58e7 86fa2f606745 6d5b43a67acc
Author: Ingo Molnar <mingo@elte.hu>
Date: Wed Nov 19 10:04:25 2008 +0100
Merge branches 'tracing/ftrace' and 'tracing/urgent' into tracing/core
Conflicts:
kernel/trace/ftrace.c
[ We conflicted here because we backported a few fixes to
tracing/urgent - which has different internal APIs. ]
diff --cc kernel/Makefile
index af3be57acbbb,af3be57acbbb,19fad003b19d..03a45e7e87b7
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@@@ -21,12 -21,12 -19,8 +19,12 @@@@ CFLAGS_REMOVE_mutex-debug.o = -p
CFLAGS_REMOVE_rtmutex-debug.o = -pg
CFLAGS_REMOVE_cgroup-debug.o = -pg
CFLAGS_REMOVE_sched_clock.o = -pg
-- CFLAGS_REMOVE_sched.o = -mno-spe -pg
++ CFLAGS_REMOVE_sched.o = -pg
endif
+ifdef CONFIG_FUNCTION_RET_TRACER
+CFLAGS_REMOVE_extable.o = -pg # For __kernel_text_address()
+CFLAGS_REMOVE_module.o = -pg # For __module_text_address()
+endif
obj-$(CONFIG_FREEZER) += freezer.o
obj-$(CONFIG_PROFILING) += profile.o
diff --cc kernel/trace/trace.c
index 2596b5a968c4,24b6238884f0,d86e3252f300..5653c6b07ba1
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@@@ -258,9 -258,11 -213,6 +258,9 @@@@ static const char *trace_options[] =
"stacktrace",
"sched-tree",
"ftrace_printk",
+ "ftrace_preempt",
- #ifdef CONFIG_BRANCH_TRACER
+ "branch",
- #endif
+ "annotate",
NULL
};
@@@@ -541,10 -551,10 -494,11 +549,10 @@@@ int register_tracer(struct tracer *type
* internal tracing to verify that everything is in order.
* If we fail, we do not register this tracer.
*/
- - for_each_tracing_cpu(i) {
+ + for_each_tracing_cpu(i)
tracing_reset(tr, i);
- - }
+ +
current_trace = type;
- tr->ctrl = 0;
/* the test is responsible for initializing and enabling */
pr_info("Testing tracer %s: ", type->name);
ret = type->selftest(type, tr);
commit 86fa2f60674540df0b34f5c547ed0c1cf3a8f212
Author: Ingo Molnar <mingo@elte.hu>
Date: Wed Nov 19 10:00:15 2008 +0100
ftrace: fix selftest locking
Impact: fix self-test boot crash
Self-test failure forgot to re-lock the BKL - crashing the next
initcall:
Testing tracer irqsoff: .. no entries found ..FAILED!
initcall init_irqsoff_tracer+0x0/0x11 returned 0 after 3906 usecs
calling init_mmio_trace+0x0/0xf @ 1
------------[ cut here ]------------
Kernel BUG at c0c0a915 [verbose debug info unavailable]
invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC
last sysfs file:
Pid: 1, comm: swapper Not tainted (2.6.28-rc5-tip #53704)
EIP: 0060:[<c0c0a915>] EFLAGS: 00010286 CPU: 1
EIP is at unlock_kernel+0x10/0x2b
EAX: ffffffff EBX: 00000000 ECX: 00000000 EDX: f7030000
ESI: c12da19c EDI: 00000000 EBP: f7039f54 ESP: f7039f54
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
Process swapper (pid: 1, ti=f7038000 task=f7030000 task.ti=f7038000)
Stack:
f7039f6c c0164d30 c013fed8 a7d8d7b4 00000000 00000000 f7039f74 c12fb78a
f7039fd0 c0101132 c12fb77d 00000000 6f727200 6f632072 2d206564 c1002031
0000000f f7039fa2 f7039fb0 3531b171 00000000 00000000 0000002f c12ca480
Call Trace:
[<c0164d30>] ? register_tracer+0x66/0x13f
[<c013fed8>] ? ktime_get+0x19/0x1b
[<c12fb78a>] ? init_mmio_trace+0xd/0xf
[<c0101132>] ? do_one_initcall+0x4a/0x111
[<c12fb77d>] ? init_mmio_trace+0x0/0xf
[<c015c7e6>] ? init_irq_proc+0x46/0x59
[<c12e851d>] ? kernel_init+0x104/0x152
[<c12e8419>] ? kernel_init+0x0/0x152
[<c01038b7>] ? kernel_thread_helper+0x7/0x10
Code: 58 14 43 75 0a b8 00 9b 2d c1 e8 51 43 7a ff 64 a1 00 a0 37 c1 89 58 14 5b 5d c3 55 64 8b 15 00 a0 37 c1 83 7a 14 00 89 e5 79 04 <0f> 0b eb fe 8b 42 14 48 85 c0 89 42 14 79 0a b8 00 9b 2d c1 e8
EIP: [<c0c0a915>] unlock_kernel+0x10/0x2b SS:ESP 0068:f7039f54
---[ end trace a7919e7f17c0a725 ]---
Kernel panic - not syncing: Attempted to kill init!
So clean up the flow a bit.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 16892121cb7c..24b6238884f0 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -520,7 +520,15 @@ int register_tracer(struct tracer *type)
return -1;
}
+ /*
+ * When this gets called we hold the BKL which means that
+ * preemption is disabled. Various trace selftests however
+ * need to disable and enable preemption for successful tests.
+ * So we drop the BKL here and grab it after the tests again.
+ */
+ unlock_kernel();
mutex_lock(&trace_types_lock);
+
for (t = trace_types; t; t = t->next) {
if (strcmp(type->name, t->name) == 0) {
/* already found */
@@ -532,13 +540,6 @@ int register_tracer(struct tracer *type)
}
#ifdef CONFIG_FTRACE_STARTUP_TEST
- /*
- * When this gets called we hold the BKL which means that preemption
- * is disabled. Various trace selftests however need to disable
- * and enable preemption for successful tests. So we drop the BKL here
- * and grab it after the tests again.
- */
- unlock_kernel();
if (type->selftest) {
struct tracer *saved_tracer = current_trace;
struct trace_array *tr = &global_trace;
@@ -550,9 +551,9 @@ int register_tracer(struct tracer *type)
* internal tracing to verify that everything is in order.
* If we fail, we do not register this tracer.
*/
- for_each_tracing_cpu(i) {
+ for_each_tracing_cpu(i)
tracing_reset(tr, i);
- }
+
current_trace = type;
/* the test is responsible for initializing and enabling */
pr_info("Testing tracer %s: ", type->name);
@@ -564,12 +565,11 @@ int register_tracer(struct tracer *type)
goto out;
}
/* Only reset on passing, to avoid touching corrupted buffers */
- for_each_tracing_cpu(i) {
+ for_each_tracing_cpu(i)
tracing_reset(tr, i);
- }
+
printk(KERN_CONT "PASSED\n");
}
- lock_kernel();
#endif
type->next = trace_types;
@@ -580,6 +580,7 @@ int register_tracer(struct tracer *type)
out:
mutex_unlock(&trace_types_lock);
+ lock_kernel();
return ret;
}
commit 3ac3ba0b396fd99550e08034b0e4c27fdf39c252
Merge: 934352f214b3 7f0f598a0069
Author: Ingo Molnar <mingo@elte.hu>
Date: Wed Nov 19 09:44:37 2008 +0100
Merge branch 'linus' into sched/core
Conflicts:
kernel/Makefile
commit 6d5b43a67accf6793ed259f6534b4bd53b1e5696
Merge: 641d2f63cfe2 32464779a1b8
Author: Ingo Molnar <mingo@elte.hu>
Date: Wed Nov 19 09:00:50 2008 +0100
Merge branch 'tip/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/urgent