Patches contributed by Eötvös Lorand University


commit 526211bc58c4b3265352801c5a7f469af5c34711
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Mar 5 10:28:45 2009 +0100

    tracing: move utility functions from ftrace.h to kernel.h
    
    Make common utility functions such as trace_printk() and
    tracing_start()/tracing_stop() generally available to kernel
    code.
    
    Cc: Steven Rostedt <srostedt@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index fbb9c364e166..5b64303ec9f2 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -318,62 +318,6 @@ static inline void __ftrace_enabled_restore(int enabled)
 # define trace_preempt_off(a0, a1)		do { } while (0)
 #endif
 
-#ifdef CONFIG_TRACING
-extern int ftrace_dump_on_oops;
-
-extern void tracing_start(void);
-extern void tracing_stop(void);
-extern void ftrace_off_permanent(void);
-
-extern void
-ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
-
-/**
- * trace_printk - printf formatting in the ftrace buffer
- * @fmt: the printf format for printing
- *
- * Note: __trace_printk is an internal function for trace_printk and
- *       the @ip is passed in via the trace_printk macro.
- *
- * This function allows a kernel developer to debug fast path sections
- * that printk is not appropriate for. By scattering in various
- * printk like tracing in the code, a developer can quickly see
- * where problems are occurring.
- *
- * This is intended as a debugging tool for the developer only.
- * Please refrain from leaving trace_printks scattered around in
- * your code.
- */
-# define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt)
-extern int
-__trace_printk(unsigned long ip, const char *fmt, ...)
-	__attribute__ ((format (printf, 2, 3)));
-# define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap)
-extern int
-__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
-extern void ftrace_dump(void);
-#else
-static inline void
-ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
-static inline int
-trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
-
-static inline void tracing_start(void) { }
-static inline void tracing_stop(void) { }
-static inline void ftrace_off_permanent(void) { }
-static inline int
-trace_printk(const char *fmt, ...)
-{
-	return 0;
-}
-static inline int
-ftrace_vprintk(const char *fmt, va_list ap)
-{
-	return 0;
-}
-static inline void ftrace_dump(void) { }
-#endif
-
 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
 extern void ftrace_init(void);
 extern void ftrace_init_module(struct module *mod,
@@ -542,6 +486,8 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
 	return tsk->trace & TSK_TRACE_FL_GRAPH;
 }
 
+extern int ftrace_dump_on_oops;
+
 #endif /* CONFIG_TRACING */
 
 
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7fa371898e3e..08bf5da86676 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -367,6 +367,64 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 	({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
 #endif
 
+/*
+ * General tracing related utility functions - trace_printk(),
+ * tracing_start()/tracing_stop:
+ */
+#ifdef CONFIG_TRACING
+extern void tracing_start(void);
+extern void tracing_stop(void);
+extern void ftrace_off_permanent(void);
+
+extern void
+ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
+
+/**
+ * trace_printk - printf formatting in the ftrace buffer
+ * @fmt: the printf format for printing
+ *
+ * Note: __trace_printk is an internal function for trace_printk and
+ *       the @ip is passed in via the trace_printk macro.
+ *
+ * This function allows a kernel developer to debug fast path sections
+ * that printk is not appropriate for. By scattering in various
+ * printk like tracing in the code, a developer can quickly see
+ * where problems are occurring.
+ *
+ * This is intended as a debugging tool for the developer only.
+ * Please refrain from leaving trace_printks scattered around in
+ * your code.
+ */
+# define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt)
+extern int
+__trace_printk(unsigned long ip, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+# define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap)
+extern int
+__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
+extern void ftrace_dump(void);
+#else
+static inline void
+ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
+static inline int
+trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+
+static inline void tracing_start(void) { }
+static inline void tracing_stop(void) { }
+static inline void ftrace_off_permanent(void) { }
+static inline int
+trace_printk(const char *fmt, ...)
+{
+	return 0;
+}
+static inline int
+ftrace_vprintk(const char *fmt, va_list ap)
+{
+	return 0;
+}
+static inline void ftrace_dump(void) { }
+#endif
+
 /*
  *      Display an IP address in readable format.
  */

commit 5e1607a00bd082972629d3d68c95c8bcf902b55a
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Mar 5 10:24:48 2009 +0100

    tracing: rename ftrace_printk() => trace_printk()
    
    Impact: cleanup
    
    Use a more generic name - this also allows the prototype to move
    to kernel.h and be generally available to kernel developers who
    want to do some quick tracing.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/Documentation/ftrace.txt b/Documentation/ftrace.txt
index 2041ee951c1a..22614bef6359 100644
--- a/Documentation/ftrace.txt
+++ b/Documentation/ftrace.txt
@@ -1466,11 +1466,11 @@ want, depending on your needs.
 
 
 You can put some comments on specific functions by using
-ftrace_printk() For example, if you want to put a comment inside
+trace_printk() For example, if you want to put a comment inside
 the __might_sleep() function, you just have to include
-<linux/ftrace.h> and call ftrace_printk() inside __might_sleep()
+<linux/ftrace.h> and call trace_printk() inside __might_sleep()
 
-ftrace_printk("I'm a comment!\n")
+trace_printk("I'm a comment!\n")
 
 will produce:
 
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 1f69ac7c1587..fbb9c364e166 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -329,11 +329,11 @@ extern void
 ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
 
 /**
- * ftrace_printk - printf formatting in the ftrace buffer
+ * trace_printk - printf formatting in the ftrace buffer
  * @fmt: the printf format for printing
  *
- * Note: __ftrace_printk is an internal function for ftrace_printk and
- *       the @ip is passed in via the ftrace_printk macro.
+ * Note: __trace_printk is an internal function for trace_printk and
+ *       the @ip is passed in via the trace_printk macro.
  *
  * This function allows a kernel developer to debug fast path sections
  * that printk is not appropriate for. By scattering in various
@@ -341,14 +341,14 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
  * where problems are occurring.
  *
  * This is intended as a debugging tool for the developer only.
- * Please refrain from leaving ftrace_printks scattered around in
+ * Please refrain from leaving trace_printks scattered around in
  * your code.
  */
-# define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt)
+# define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt)
 extern int
-__ftrace_printk(unsigned long ip, const char *fmt, ...)
+__trace_printk(unsigned long ip, const char *fmt, ...)
 	__attribute__ ((format (printf, 2, 3)));
-# define ftrace_vprintk(fmt, ap) __ftrace_printk(_THIS_IP_, fmt, ap)
+# define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap)
 extern int
 __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
 extern void ftrace_dump(void);
@@ -356,13 +356,13 @@ extern void ftrace_dump(void);
 static inline void
 ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
 static inline int
-ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 
 static inline void tracing_start(void) { }
 static inline void tracing_stop(void) { }
 static inline void ftrace_off_permanent(void) { }
 static inline int
-ftrace_printk(const char *fmt, ...)
+trace_printk(const char *fmt, ...)
 {
 	return 0;
 }
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d1ef43999d9e..c0e9c1263393 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -48,7 +48,7 @@ unsigned long __read_mostly	tracing_thresh;
  * We need to change this state when a selftest is running.
  * A selftest will lurk into the ring-buffer to count the
  * entries inserted during the selftest although some concurrent
- * insertions into the ring-buffer such as ftrace_printk could occurred
+ * insertions into the ring-buffer such as trace_printk could occurred
  * at the same time, giving false positive or negative results.
  */
 static bool __read_mostly tracing_selftest_running;
@@ -291,7 +291,7 @@ static const char *trace_options[] = {
 	"block",
 	"stacktrace",
 	"sched-tree",
-	"ftrace_printk",
+	"trace_printk",
 	"ftrace_preempt",
 	"branch",
 	"annotate",
@@ -3768,7 +3768,7 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
 }
 EXPORT_SYMBOL_GPL(trace_vprintk);
 
-int __ftrace_printk(unsigned long ip, const char *fmt, ...)
+int __trace_printk(unsigned long ip, const char *fmt, ...)
 {
 	int ret;
 	va_list ap;
@@ -3781,7 +3781,7 @@ int __ftrace_printk(unsigned long ip, const char *fmt, ...)
 	va_end(ap);
 	return ret;
 }
-EXPORT_SYMBOL_GPL(__ftrace_printk);
+EXPORT_SYMBOL_GPL(__trace_printk);
 
 int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap)
 {
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 12cd119cca32..8beff03fda68 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -115,7 +115,7 @@ struct userstack_entry {
 };
 
 /*
- * ftrace_printk entry:
+ * trace_printk entry:
  */
 struct print_entry {
 	struct trace_entry	ent;

commit 53664738c122bfe8b0e489fddaf2ab265c9133c8
Merge: c4ef144a9d08 e9d25fe6eaa2
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Mar 5 10:21:49 2009 +0100

    Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace

commit c4ef144a9d0803eb0a2d4110ae87e7f34e667ded
Merge: a1be621dfacb efed792d6738
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Mar 5 10:20:47 2009 +0100

    Merge branch 'tracing/ftrace' into tracing/core

commit 6d2e91bf80e4410207f01edb0962aec9213f3533
Merge: 6298e719cf38 dd39ecf522ba
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Mar 4 20:20:10 2009 +0100

    Merge branch 'x86/urgent' into x86/mm
    
    Conflicts:
            arch/x86/include/asm/fixmap_64.h
    Semantic merge:
            arch/x86/include/asm/fixmap.h
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --cc arch/x86/include/asm/fixmap.h
index dca8f03da5b2,23696d44a0af..63a79c77d220
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@@ -14,142 -1,11 +14,132 @@@
  #ifndef _ASM_X86_FIXMAP_H
  #define _ASM_X86_FIXMAP_H
  
 +#ifndef __ASSEMBLY__
 +#include <linux/kernel.h>
 +#include <asm/acpi.h>
 +#include <asm/apicdef.h>
 +#include <asm/page.h>
 +#ifdef CONFIG_X86_32
 +#include <linux/threads.h>
 +#include <asm/kmap_types.h>
 +#else
 +#include <asm/vsyscall.h>
- #ifdef CONFIG_EFI
- #include <asm/efi.h>
- #endif
 +#endif
 +
 +/*
 + * We can't declare FIXADDR_TOP as variable for x86_64 because vsyscall
 + * uses fixmaps that relies on FIXADDR_TOP for proper address calculation.
 + * Because of this, FIXADDR_TOP x86 integration was left as later work.
 + */
 +#ifdef CONFIG_X86_32
 +/* used by vmalloc.c, vsyscall.lds.S.
 + *
 + * Leave one empty page between vmalloc'ed areas and
 + * the start of the fixmap.
 + */
 +extern unsigned long __FIXADDR_TOP;
 +#define FIXADDR_TOP	((unsigned long)__FIXADDR_TOP)
 +
 +#define FIXADDR_USER_START     __fix_to_virt(FIX_VDSO)
 +#define FIXADDR_USER_END       __fix_to_virt(FIX_VDSO - 1)
 +#else
 +#define FIXADDR_TOP	(VSYSCALL_END-PAGE_SIZE)
 +
 +/* Only covers 32bit vsyscalls currently. Need another set for 64bit. */
 +#define FIXADDR_USER_START	((unsigned long)VSYSCALL32_VSYSCALL)
 +#define FIXADDR_USER_END	(FIXADDR_USER_START + PAGE_SIZE)
 +#endif
 +
 +
 +/*
 + * Here we define all the compile-time 'special' virtual
 + * addresses. The point is to have a constant address at
 + * compile time, but to set the physical address only
 + * in the boot process.
 + * for x86_32: We allocate these special addresses
 + * from the end of virtual memory (0xfffff000) backwards.
 + * Also this lets us do fail-safe vmalloc(), we
 + * can guarantee that these special addresses and
 + * vmalloc()-ed addresses never overlap.
 + *
 + * These 'compile-time allocated' memory buffers are
 + * fixed-size 4k pages (or larger if used with an increment
 + * higher than 1). Use set_fixmap(idx,phys) to associate
 + * physical memory with fixmap indices.
 + *
 + * TLB entries of such buffers will not be flushed across
 + * task switches.
 + */
 +enum fixed_addresses {
  #ifdef CONFIG_X86_32
 -# include "fixmap_32.h"
 +	FIX_HOLE,
 +	FIX_VDSO,
  #else
 -# include "fixmap_64.h"
 +	VSYSCALL_LAST_PAGE,
 +	VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE
 +			    + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
 +	VSYSCALL_HPET,
  #endif
 +	FIX_DBGP_BASE,
 +	FIX_EARLYCON_MEM_BASE,
 +#ifdef CONFIG_X86_LOCAL_APIC
 +	FIX_APIC_BASE,	/* local (CPU) APIC) -- required for SMP or not */
 +#endif
 +#ifdef CONFIG_X86_IO_APIC
 +	FIX_IO_APIC_BASE_0,
 +	FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1,
 +#endif
- #ifdef CONFIG_X86_64
- #ifdef CONFIG_EFI
- 	FIX_EFI_IO_MAP_LAST_PAGE,
- 	FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE
- 				  + MAX_EFI_IO_PAGES - 1,
- #endif
- #endif
 +#ifdef CONFIG_X86_VISWS_APIC
 +	FIX_CO_CPU,	/* Cobalt timer */
 +	FIX_CO_APIC,	/* Cobalt APIC Redirection Table */
 +	FIX_LI_PCIA,	/* Lithium PCI Bridge A */
 +	FIX_LI_PCIB,	/* Lithium PCI Bridge B */
 +#endif
 +#ifdef CONFIG_X86_F00F_BUG
 +	FIX_F00F_IDT,	/* Virtual mapping for IDT */
 +#endif
 +#ifdef CONFIG_X86_CYCLONE_TIMER
 +	FIX_CYCLONE_TIMER, /*cyclone timer register*/
 +#endif
 +#ifdef CONFIG_X86_32
 +	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
 +	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
 +#ifdef CONFIG_PCI_MMCONFIG
 +	FIX_PCIE_MCFG,
 +#endif
 +#endif
 +#ifdef CONFIG_PARAVIRT
 +	FIX_PARAVIRT_BOOTMAP,
 +#endif
 +	__end_of_permanent_fixed_addresses,
 +#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
 +	FIX_OHCI1394_BASE,
 +#endif
 +	/*
 +	 * 256 temporary boot-time mappings, used by early_ioremap(),
 +	 * before ioremap() is functional.
 +	 *
 +	 * We round it up to the next 256 pages boundary so that we
 +	 * can have a single pgd entry and a single pte table:
 +	 */
 +#define NR_FIX_BTMAPS		64
 +#define FIX_BTMAPS_SLOTS	4
 +	FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
 +			(__end_of_permanent_fixed_addresses & 255),
 +	FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1,
 +#ifdef CONFIG_X86_32
 +	FIX_WP_TEST,
 +#endif
 +	__end_of_fixed_addresses
 +};
 +
 +
 +extern void reserve_top_address(unsigned long reserve);
 +
 +#define FIXADDR_SIZE	(__end_of_permanent_fixed_addresses << PAGE_SHIFT)
 +#define FIXADDR_BOOT_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
 +#define FIXADDR_START		(FIXADDR_TOP - FIXADDR_SIZE)
 +#define FIXADDR_BOOT_START	(FIXADDR_TOP - FIXADDR_BOOT_SIZE)
  
  extern int fixmaps_set;
  

commit 28b1bd1cbc33cae95a309691d814399a69cf3070
Merge: 2602c3ba4508 1075414b0610
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Mar 4 18:49:19 2009 +0100

    Merge branch 'core/locking' into tracing/ftrace

diff --cc mm/slob.c
index f9cc24688232,1264799df5d1..596152926a8d
--- a/mm/slob.c
+++ b/mm/slob.c
@@@ -464,8 -463,9 +464,10 @@@ void *__kmalloc_node(size_t size, gfp_
  {
  	unsigned int *m;
  	int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
 +	void *ret;
  
+ 	lockdep_trace_alloc(flags);
+ 
  	if (size < PAGE_SIZE - align) {
  		if (!size)
  			return ZERO_SIZE_PTR;

commit 73af76dfd1f998dba71d8e8e785cbe77a990bf17
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Mar 4 11:47:17 2009 +0100

    x86, mce: fix build failure in arch/x86/kernel/cpu/mcheck/threshold.c
    
    Impact: build fix
    
    The APIC code rewrite in the x86 tree broke the x86/mce branch:
    
     arch/x86/kernel/cpu/mcheck/threshold.c: In function ‘mce_threshold_interrupt’:
     arch/x86/kernel/cpu/mcheck/threshold.c:24: error: implicit declaration of function ‘ack_APIC_irq’
    
    Also tidy up the file a bit while at it.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c
index e4b8a3833fc5..23ee9e730f78 100644
--- a/arch/x86/kernel/cpu/mcheck/threshold.c
+++ b/arch/x86/kernel/cpu/mcheck/threshold.c
@@ -1,9 +1,13 @@
-/* Common corrected MCE threshold handler code */
-#include <linux/kernel.h>
+/*
+ * Common corrected MCE threshold handler code:
+ */
 #include <linux/interrupt.h>
-#include <asm/mce.h>
+#include <linux/kernel.h>
+
 #include <asm/irq_vectors.h>
+#include <asm/apic.h>
 #include <asm/idle.h>
+#include <asm/mce.h>
 
 static void default_threshold_interrupt(void)
 {

commit 2b578459c3274941156093eba149745e43f93067
Merge: 8163d88c79dc 2743a5b0fa6f
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Mar 4 11:43:53 2009 +0100

    Merge branch 'rfc' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/perfcounters into perfcounters/core

commit 8163d88c79dca35478a2405c837733ac50ea4c39
Merge: a1ef58f44254 fec6c6fec3e2
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Mar 4 11:42:31 2009 +0100

    Merge commit 'v2.6.29-rc7' into perfcounters/core
    
    Conflicts:
            arch/x86/mm/iomap_32.c

commit 2602c3ba4508f528db024c1d209256513ea05de6
Merge: a1be621dfacb 2cadf9135eb3
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Mar 4 11:15:42 2009 +0100

    Merge branch 'rfc/splice/tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace