Patches contributed by Eötvös Lorand University


commit 2464a609ded094204a3aed24823745ec58e3c879
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jul 17 17:40:48 2008 +0200

    ftrace: do not trace library functions
    
    make function tracing more robust: do not trace library functions.
    
    We've already got a sizable list of exceptions:
    
     ifdef CONFIG_FTRACE
     # Do not profile string.o, since it may be used in early boot or vdso
     CFLAGS_REMOVE_string.o = -pg
     # Also do not profile any debug utilities
     CFLAGS_REMOVE_spinlock_debug.o = -pg
     CFLAGS_REMOVE_list_debug.o = -pg
     CFLAGS_REMOVE_debugobjects.o = -pg
     CFLAGS_REMOVE_find_next_bit.o = -pg
     CFLAGS_REMOVE_cpumask.o = -pg
     CFLAGS_REMOVE_bitmap.o = -pg
     endif
    
    ... and the pattern has been that random library functionality showed
    up in ftrace's critical path (outside of its recursion check), causing
    hard to debug lockups.
    
    So be a bit defensive about it and exclude all lib/*.o functions by
    default. It's not that they are overly interesting for tracing purposes
    anyway. Specific ones can still be traced, in an opt-in manner.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/lib/Makefile b/lib/Makefile
index d90d31102e05..818c4d455518 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,24 +2,17 @@
 # Makefile for some libs needed in the kernel.
 #
 
+ifdef CONFIG_FTRACE
+ORIG_CFLAGS := $(KBUILD_CFLAGS)
+KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
+endif
+
 lib-y := ctype.o string.o vsprintf.o cmdline.o \
 	 rbtree.o radix-tree.o dump_stack.o \
 	 idr.o int_sqrt.o extable.o prio_tree.o \
 	 sha1.o irq_regs.o reciprocal_div.o argv_split.o \
 	 proportions.o prio_heap.o ratelimit.o
 
-ifdef CONFIG_FTRACE
-# Do not profile string.o, since it may be used in early boot or vdso
-CFLAGS_REMOVE_string.o = -pg
-# Also do not profile any debug utilities
-CFLAGS_REMOVE_spinlock_debug.o = -pg
-CFLAGS_REMOVE_list_debug.o = -pg
-CFLAGS_REMOVE_debugobjects.o = -pg
-CFLAGS_REMOVE_find_next_bit.o = -pg
-CFLAGS_REMOVE_cpumask.o = -pg
-CFLAGS_REMOVE_bitmap.o = -pg
-endif
-
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 

commit c349e0a01c3e0f70913db6a5bb61ab204e0602de
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Apr 15 22:39:31 2008 +0200

    ftrace: do not trace scheduler functions
    
    do not trace scheduler functions - it's still a bit fragile
    and can lock up with:
    
      http://redhat.com/~mingo/misc/config-Thu_Jul_17_13_34_52_CEST_2008
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/Makefile b/kernel/Makefile
index 0a7ed838984b..985ddb7da4d0 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -11,8 +11,6 @@ obj-y     = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
 	    hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
 	    notifier.o ksysfs.o pm_qos_params.o sched_clock.o
 
-CFLAGS_REMOVE_sched.o = -mno-spe
-
 ifdef CONFIG_FTRACE
 # Do not trace debug files and internal ftrace files
 CFLAGS_REMOVE_lockdep.o = -pg
@@ -21,6 +19,7 @@ CFLAGS_REMOVE_mutex-debug.o = -pg
 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
 endif
 
 obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o

commit 9fa111372a54f695f65e0de2f2a2108fe6cf3584
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jul 17 17:38:17 2008 +0200

    ftrace: fix lockup with MAXSMP
    
    MAXSMP brings in lots of use of various bitops in smp_processor_id()
    and friends - causing ftrace to lock up during bootup:
    
      calling  anon_inode_init+0x0/0x130
      initcall anon_inode_init+0x0/0x130 returned 0 after 0 msecs
      calling  acpi_event_init+0x0/0x57
      [ hard hang ]
    
    So exclude the bitops facilities from tracing.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/lib/Makefile b/lib/Makefile
index 2c62a9c06fbe..d90d31102e05 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -15,6 +15,9 @@ CFLAGS_REMOVE_string.o = -pg
 CFLAGS_REMOVE_spinlock_debug.o = -pg
 CFLAGS_REMOVE_list_debug.o = -pg
 CFLAGS_REMOVE_debugobjects.o = -pg
+CFLAGS_REMOVE_find_next_bit.o = -pg
+CFLAGS_REMOVE_cpumask.o = -pg
+CFLAGS_REMOVE_bitmap.o = -pg
 endif
 
 lib-$(CONFIG_MMU) += ioremap.o

commit fab3b58d3b242b5903f78d60d86803a8aecdf6de
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jul 17 13:50:15 2008 +0200

    x86 reboot quirks: add Dell Precision WorkStation T5400
    
    as reported in:
    
      "reboot=bios is mandatory on Dell T5400 server."
      http://bugzilla.kernel.org/show_bug.cgi?id=11108
    
    add a DMI reboot quirk.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Cc: <stable@kernel.org>

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index f8a62160e151..9dcf39c02972 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -177,6 +177,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"),
 		},
 	},
+	{	/* Handle problems with rebooting on Dell T5400's */
+		.callback = set_bios_reboot,
+		.ident = "Dell Precision T5400",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T5400"),
+		},
+	},
 	{	/* Handle problems with rebooting on HP laptops */
 		.callback = set_bios_reboot,
 		.ident = "HP Compaq Laptop",

commit 8e9509c827a28e2f365c203c04224f9e9dd1b63a
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jul 17 13:26:50 2008 +0200

    ftrace: fix merge buglet
    
    -tip testing found a bootup hang here:
    
      initcall anon_inode_init+0x0/0x130 returned 0 after 0 msecs
      calling  acpi_event_init+0x0/0x57
    
    the bootup should have continued with:
    
      initcall acpi_event_init+0x0/0x57 returned 0 after 45 msecs
    
    but it hung hard there instead.
    
    bisection led to this commit:
    
    | commit 5806b81ac1c0c52665b91723fd4146a4f86e386b
    | Merge: d14c8a6... 6712e29...
    | Author: Ingo Molnar <mingo@elte.hu>
    | Date:   Mon Jul 14 16:11:52 2008 +0200
    |     Merge branch 'auto-ftrace-next' into tracing/for-linus
    
    turns out that i made this mistake in the merge:
    
      ifdef CONFIG_FTRACE
      # Do not profile debug utilities
      CFLAGS_REMOVE_tsc_64.o = -pg
      CFLAGS_REMOVE_tsc_32.o = -pg
    
    those two files got unified meanwhile - so the dont-profile annotation
    got lost. The proper rule is:
    
      CFLAGS_REMOVE_tsc.o = -pg
    
    i guess this could have been caught sooner if the CFLAGS_REMOVE* kbuild
    rule aborted the build if it met a target that does not exist anymore?
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 5112c84f5421..da140611bb57 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -8,8 +8,7 @@ CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
 
 ifdef CONFIG_FTRACE
 # Do not profile debug utilities
-CFLAGS_REMOVE_tsc_64.o = -pg
-CFLAGS_REMOVE_tsc_32.o = -pg
+CFLAGS_REMOVE_tsc.o = -pg
 CFLAGS_REMOVE_rtc.o = -pg
 endif
 

commit 1b82c9666a6f637ccb3a86d0fbe23d0427076815
Merge: a3cf85932148 380fdd7585a4
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 16 22:15:53 2008 +0200

    Merge branch 'x86/step' of git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-roland into x86/step

commit 77e442461c74068217b59b356cf18992c78ed896
Merge: d54191b85e29 45158894d4d6
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 16 13:11:29 2008 +0200

    Merge branch 'linus' into x86/kprobes

commit 34646bca474142e1424e5f6c4a33cb2ba0930ea1
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 9 15:42:09 2008 +0200

    x86, paravirt-spinlocks: fix boot hang
    
    the paravirt-spinlock patches caused a boot hang with this config:
    
     http://redhat.com/~mingo/misc/config-Wed_Jul__9_14_47_04_CEST_2008.bad
    
    i have bisected it down to:
    
    |  commit e17b58c2e85bc2ad2afc07fb8d898017c2b75ed1
    |  Author: Jeremy Fitzhardinge <jeremy@goop.org>
    |  Date:   Mon Jul 7 12:07:53 2008 -0700
    |
    |      xen: implement Xen-specific spinlocks
    
    i.e. applying that patch alone causes the hang. The hang happens in the
    ftrace self-test:
    
      initcall utsname_sysctl_init+0x0/0x19 returned 0 after 0 msecs
      calling  init_sched_switch_trace+0x0/0x4c
      Testing tracer sched_switch: PASSED
      initcall init_sched_switch_trace+0x0/0x4c returned 0 after 167 msecs
      calling  init_function_trace+0x0/0x12
      Testing tracer ftrace:
      [hard hang]
    
    it should have continued like this:
    
      Testing tracer ftrace: PASSED
      initcall init_function_trace+0x0/0x12 returned 0 after 198 msecs
      calling  init_irqsoff_tracer+0x0/0x14
      Testing tracer irqsoff: PASSED
      initcall init_irqsoff_tracer+0x0/0x14 returned 0 after 3 msecs
      calling  init_mmio_trace+0x0/0x12
      initcall init_mmio_trace+0x0/0x12 returned 0 after 0 msecs
    
    the problem is that such lowlevel primitives as spinlocks should never
    be built with -pg (which ftrace does). Marking paravirt.o as non-pg and
    marking all spinlock ops as always-inline solve the hang.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 5112c84f5421..78d52171400b 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -7,10 +7,11 @@ extra-y                := head_$(BITS).o head$(BITS).o head.o init_task.o vmlinu
 CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
 
 ifdef CONFIG_FTRACE
-# Do not profile debug utilities
+# Do not profile debug and lowlevel utilities
 CFLAGS_REMOVE_tsc_64.o = -pg
 CFLAGS_REMOVE_tsc_32.o = -pg
 CFLAGS_REMOVE_rtc.o = -pg
+CFLAGS_REMOVE_paravirt.o = -pg
 endif
 
 #

commit 9af98578d6af588f52d0dacd64fe42caa405a327
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 9 14:39:15 2008 +0200

    x86: paravirt spinlocks, modular build fix
    
    fix:
    
      MODPOST 408 modules
    ERROR: "pv_lock_ops" [net/dccp/dccp.ko] undefined!
    ERROR: "pv_lock_ops" [fs/jbd2/jbd2.ko] undefined!
    ERROR: "pv_lock_ops" [drivers/media/common/saa7146_vv.ko] undefined!
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 6aa8aed06d54..3edfd7af22ae 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -472,6 +472,7 @@ struct pv_lock_ops pv_lock_ops = {
 	.spin_unlock = __ticket_spin_unlock,
 #endif
 };
+EXPORT_SYMBOL_GPL(pv_lock_ops);
 
 EXPORT_SYMBOL_GPL(pv_time_ops);
 EXPORT_SYMBOL    (pv_cpu_ops);

commit 4bb689eee12ceb6d669a0c9a519037c049a8af38
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 9 14:33:33 2008 +0200

    x86: paravirt spinlocks, !CONFIG_SMP build fixes
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index bba4041bb7ff..6aa8aed06d54 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -270,11 +270,13 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
 
 void __init paravirt_use_bytelocks(void)
 {
+#ifdef CONFIG_SMP
 	pv_lock_ops.spin_is_locked = __byte_spin_is_locked;
 	pv_lock_ops.spin_is_contended = __byte_spin_is_contended;
 	pv_lock_ops.spin_lock = __byte_spin_lock;
 	pv_lock_ops.spin_trylock = __byte_spin_trylock;
 	pv_lock_ops.spin_unlock = __byte_spin_unlock;
+#endif
 }
 
 struct pv_info pv_info = {
@@ -461,12 +463,14 @@ struct pv_mmu_ops pv_mmu_ops = {
 };
 
 struct pv_lock_ops pv_lock_ops = {
+#ifdef CONFIG_SMP
 	.spin_is_locked = __ticket_spin_is_locked,
 	.spin_is_contended = __ticket_spin_is_contended,
 
 	.spin_lock = __ticket_spin_lock,
 	.spin_trylock = __ticket_spin_trylock,
 	.spin_unlock = __ticket_spin_unlock,
+#endif
 };
 
 EXPORT_SYMBOL_GPL(pv_time_ops);
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 65ed02cdbbd7..b2aba8fdaae7 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -1387,6 +1387,8 @@ void _paravirt_nop(void);
 
 void paravirt_use_bytelocks(void);
 
+#ifdef CONFIG_SMP
+
 static inline int __raw_spin_is_locked(struct raw_spinlock *lock)
 {
 	return PVOP_CALL1(int, pv_lock_ops.spin_is_locked, lock);
@@ -1412,6 +1414,8 @@ static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
 	return PVOP_VCALL1(pv_lock_ops.spin_unlock, lock);
 }
 
+#endif
+
 /* These all sit in the .parainstructions section to tell us what to patch. */
 struct paravirt_patch_site {
 	u8 *instr; 		/* original instructions */