Patches contributed by Eötvös Lorand University


commit 6b2ada82101a08e2830fb29d7dc9b858be637dd4
Merge: 278429cff880 3b7ecb5d2ffd 77af7e3403e7 15160716eea5 1fa63a817d27 85462323555d
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 15 12:48:44 2008 +0200

    Merge branches 'core/softlockup', 'core/softirq', 'core/resources', 'core/printk' and 'core/misc' into core-v28-for-linus

diff --cc arch/x86/kernel/e820.c
index 78e642feac30,66e48aa2dd1b,9af89078f7bb,477f4bb7e552,9af89078f7bb,78e642feac30..ce97bf3bed12
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@@@@@@ -1279,11 -1274,10 -1274,10 -1274,9 -1274,10 -1279,11 +1279,10 @@@@@@@ void __init e820_reserve_resources(void
      	u64 end;
      
      	res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
 ++++ 	e820_res = res;
      	for (i = 0; i < e820.nr_map; i++) {
      		end = e820.map[i].addr + e820.map[i].size - 1;
--- --#ifndef CONFIG_RESOURCES_64BIT
--- --		if (end > 0x100000000ULL) {
+++ ++		if (end != (resource_size_t)end) {
      			res++;
      			continue;
      		}
diff --cc arch/x86/mm/ioremap.c
index e4c43ec71b29,d4b6e6a29ae3,d4b6e6a29ae3,c818b45bd07d,016f335bbeea,e4c43ec71b29..ae71e11eb3e5
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@@@@@@ -616,24 -546,18 -546,18 -552,18 -546,20 -616,24 +622,24 @@@@@@@ static inline void __init early_clear_f
      		__early_set_fixmap(idx, 0, __pgprot(0));
      }
      
 ---- 
 ---- int __initdata early_ioremap_nested;
 ---- 
 ++++ static void *prev_map[FIX_BTMAPS_SLOTS] __initdata;
 ++++ static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata;
      static int __init check_early_ioremap_leak(void)
      {
 ---- 	if (!early_ioremap_nested)
    - 		return 0;
 ++++ 	int count = 0;
 ++++ 	int i;
 +++  
    - 	printk(KERN_WARNING
 ++++ 	for (i = 0; i < FIX_BTMAPS_SLOTS; i++)
 ++++ 		if (prev_map[i])
 ++++ 			count++;
 ++++ 
 ++++ 	if (!count)
    + 		return 0;
    + 	WARN(1, KERN_WARNING
      	       "Debug warning: early ioremap leak of %d areas detected.\n",
 ---  		early_ioremap_nested);
    - 	       early_ioremap_nested);
 ++++ 		count);
      	printk(KERN_WARNING
    - 	       "please boot with early_ioremap_debug and report the dmesg.\n");
    - 	WARN_ON(1);
    + 		"please boot with early_ioremap_debug and report the dmesg.\n");
      
      	return 1;
      }
@@@@@@@ -729,29 -629,11 -629,11 -635,11 -631,11 -729,29 +735,29 @@@@@@@ void __init early_iounmap(void *addr, u
      	unsigned long offset;
      	unsigned int nrpages;
      	enum fixed_addresses idx;
 ---- 	int nesting;
 ++++ 	int i, slot;
 ++   
   -- 	nesting = --early_ioremap_nested;
   -- 	if (WARN_ON(nesting < 0))
 ++++ 	slot = -1;
 ++++ 	for (i = 0; i < FIX_BTMAPS_SLOTS; i++) {
 ++++ 		if (prev_map[i] == addr) {
 ++++ 			slot = i;
 ++++ 			break;
 ++++ 		}
 ++++ 	}
 ++++ 
 ++++ 	if (slot < 0) {
 ++++ 		printk(KERN_INFO "early_iounmap(%p, %08lx) not found slot\n",
 ++++ 			 addr, size);
 ++++ 		WARN_ON(1);
 ++ + 		return;
 ++++ 	}
   ++ 
 --   	nesting = --early_ioremap_nested;
 --   	if (WARN_ON(nesting < 0))
 ++++ 	if (prev_size[slot] != size) {
 ++++ 		printk(KERN_INFO "early_iounmap(%p, %08lx) [%d] size not consistent %08lx\n",
 ++++ 			 addr, size, slot, prev_size[slot]);
 ++++ 		WARN_ON(1);
   +  		return;
 ++++ 	}
      
      	if (early_ioremap_debug) {
      		printk(KERN_INFO "early_iounmap(%p, %08lx) [%d]\n", addr,
diff --cc drivers/pci/setup-bus.c
index 3abbfad9ddab,3abbfad9ddab,1aad599816f7,f250a90ee450,827c0a520e2b,3abbfad9ddab..d5e2106760f8
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@@@@@@ -531,40 -531,40 -531,36 -530,36 -530,6 -531,40 +530,40 @@@@@@@ void __ref pci_bus_assign_resources(str
      }
      EXPORT_SYMBOL(pci_bus_assign_resources);
      
    + static void pci_bus_dump_res(struct pci_bus *bus)
    + {
    +         int i;
    + 
    +         for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
    +                 struct resource *res = bus->resource[i];
    +                 if (!res)
    +                         continue;
    + 
  --  		printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
  +++ 		printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n",
  +++ 			bus->number, i,
  +++ 			(res->flags & IORESOURCE_IO) ? "io port" : "mmio",
  +++ 			(unsigned long long) res->start,
  +++ 			(unsigned long long) res->end);
    +         }
    + }
    + 
    + static void pci_bus_dump_resources(struct pci_bus *bus)
    + {
    + 	struct pci_bus *b;
    + 	struct pci_dev *dev;
    + 
    + 
    + 	pci_bus_dump_res(bus);
    + 
    + 	list_for_each_entry(dev, &bus->devices, bus_list) {
    + 		b = dev->subordinate;
    + 		if (!b)
    + 			continue;
    + 
    + 		pci_bus_dump_resources(b);
    + 	}
    + }
    + 
      void __init
      pci_assign_unassigned_resources(void)
      {
diff --cc include/linux/ioport.h
index ee9bcc6f32b6,350033e8f4e1,8d3b7a9afd17,01712cf1a38b,22d2115458c6,ee9bcc6f32b6..e38b6aa2d40c
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@@@@@@ -108,11 -108,8 -108,8 -108,11 -108,7 -108,11 +108,11 @@@@@@@ extern struct resource iomem_resource
      
      extern int request_resource(struct resource *root, struct resource *new);
      extern int release_resource(struct resource *new);
 ++ + extern void reserve_region_with_split(struct resource *root,
 ++ + 			     resource_size_t start, resource_size_t end,
 ++ + 			     const char *name);
      extern int insert_resource(struct resource *parent, struct resource *new);
    + extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
      extern int allocate_resource(struct resource *root, struct resource *new,
      			     resource_size_t size, resource_size_t min,
      			     resource_size_t max, resource_size_t align,

commit 2778d0d51dd5007c4909c1d9874f5e9097785a7a
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Oct 14 16:55:36 2008 +0200

    hrtimers: fix typo
    
    Found by Thomas Gleixner.
    
    This caused the lockups i've bisected back to the range-hrtimers tree.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index eb2cf984959f..2bd230be1cb5 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1396,7 +1396,7 @@ void hrtimer_peek_ahead_timers(void)
 	struct tick_device *td;
 	struct clock_event_device *dev;
 
-	if (hrtimer_hres_active())
+	if (!hrtimer_hres_active())
 		return;
 
 	local_irq_save(flags);

commit 98d9c66ab07471006fd7910cb16453581c41a3e7
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Oct 14 14:27:20 2008 +0200

    tracing/fastboot: improve help text
    
    Improve the help text of the boot tracer.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 11fd03a429f0..1cb3e1f616af 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -127,12 +127,17 @@ config BOOT_TRACER
 	select TRACING
 	help
 	  This tracer helps developers to optimize boot times: it records
-	  the timings of the initcalls. Its aim is to be parsed by the
-	  /scripts/bootgraph.pl tool to produce pretty graphics about
-	  boot inefficiencies, giving a visual representation of the
-	  delays during initcalls. Note that tracers self tests can't
-	  be enabled if this tracer is selected since only one tracer
-	  should touch the tracing buffer at a time.
+	  the timings of the initcalls and traces key events and the identity
+	  of tasks that can cause boot delays, such as context-switches.
+
+	  Its aim is to be parsed by the /scripts/bootgraph.pl tool to
+	  produce pretty graphics about boot inefficiencies, giving a visual
+	  representation of the delays during initcalls - but the raw
+	  /debug/tracing/trace text output is readable too.
+
+	  ( Note that tracing self tests can't be enabled if this tracer is
+	    selected, because the self-tests are an initcall as well and that
+	    would invalidate the boot trace. )
 
 config STACK_TRACER
 	bool "Trace max stack"

commit 4519d9e54dcd273975ad0adebad2a08c20428029
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Oct 14 14:15:43 2008 +0200

    tracing/stacktrace: improve help text
    
    Improve the help text that is displayed for CONFIG_STACK_TRACER.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 396aea11398e..11fd03a429f0 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -141,8 +141,17 @@ config STACK_TRACER
 	select FTRACE
 	select STACKTRACE
 	help
-	  This tracer records the max stack of the kernel, and displays
-	  it in debugfs/tracing/stack_trace
+	  This special tracer records the maximum stack footprint of the
+	  kernel and displays it in debugfs/tracing/stack_trace.
+
+	  This tracer works by hooking into every function call that the
+	  kernel executes, and keeping a maximum stack depth value and
+	  stack-trace saved. Because this logic has to execute in every
+	  kernel function, all the time, this option can slow down the
+	  kernel measurably and is generally intended for kernel
+	  developers only.
+
+	  Say N if unsure.
 
 config DYNAMIC_FTRACE
 	bool "enable/disable ftrace tracepoints dynamically"

commit 3e1932ad59726d794a865cc159c0593d54bf0cb6
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Oct 2 17:45:47 2008 +0200

    tracing/fastboot: build fix
    
    fix:
    
     In file included from kernel/sysctl.c:52:
     include/linux/ftrace.h:217: error: 'KSYM_NAME_LEN' undeclared here (not in a function)
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index e672e51c40a9..deded114dffd 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -1,14 +1,14 @@
 #ifndef _LINUX_FTRACE_H
 #define _LINUX_FTRACE_H
 
-#ifdef CONFIG_FTRACE
-
 #include <linux/linkage.h>
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/kallsyms.h>
 
+#ifdef CONFIG_FTRACE
+
 extern int ftrace_enabled;
 extern int
 ftrace_enable_sysctl(struct ctl_table *table, int write,

commit 77ae11f63befb7fc41ec256f1fcb72ca7e4160d5
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Oct 2 11:04:14 2008 +0200

    ring-buffer: fix build error
    
    fix:
    
     kernel/trace/ring_buffer.c: In function ‘rb_allocate_pages’:
     kernel/trace/ring_buffer.c:235: error: ‘cpu’ undeclared (first use in this function)
     kernel/trace/ring_buffer.c:235: error: (Each undeclared identifier is reported only once
     kernel/trace/ring_buffer.c:235: error: for each function it appears in.)
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 98145718988d..54a30986493a 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -232,7 +232,7 @@ static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
 
 	for (i = 0; i < nr_pages; i++) {
 		page = kzalloc_node(ALIGN(sizeof(*page), cache_line_size()),
-				    GFP_KERNEL, cpu_to_node(cpu));
+				    GFP_KERNEL, cpu_to_node(i));
 		if (!page)
 			goto free_pages;
 		list_add(&page->list, &pages);

commit d3ee6d992821f471193a7ee7a00af9ebb4bf5d01
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Sep 4 14:04:51 2008 +0200

    ftrace: make it depend on DEBUG_KERNEL
    
    make most of the tracers depend on DEBUG_KERNEL - that's their intended
    purpose. (most distributions have DEBUG_KERNEL enabled anyway so this is
    not a practical limitation - but it simplifies the tracing menu in the
    normal case)
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 5a9cffb0fafb..16e5bb5daaa5 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -22,6 +22,7 @@ config TRACING
 config FTRACE
 	bool "Kernel Function Tracer"
 	depends on HAVE_FTRACE
+	depends on DEBUG_KERNEL
 	select FRAME_POINTER
 	select TRACING
 	select CONTEXT_SWITCH_TRACER
@@ -40,6 +41,7 @@ config IRQSOFF_TRACER
 	depends on TRACE_IRQFLAGS_SUPPORT
 	depends on GENERIC_TIME
 	depends on HAVE_FTRACE
+	depends on DEBUG_KERNEL
 	select TRACE_IRQFLAGS
 	select TRACING
 	select TRACER_MAX_TRACE
@@ -63,6 +65,7 @@ config PREEMPT_TRACER
 	depends on GENERIC_TIME
 	depends on PREEMPT
 	depends on HAVE_FTRACE
+	depends on DEBUG_KERNEL
 	select TRACING
 	select TRACER_MAX_TRACE
 	help
@@ -90,6 +93,7 @@ config SYSPROF_TRACER
 config SCHED_TRACER
 	bool "Scheduling Latency Tracer"
 	depends on HAVE_FTRACE
+	depends on DEBUG_KERNEL
 	select TRACING
 	select CONTEXT_SWITCH_TRACER
 	select TRACER_MAX_TRACE
@@ -100,6 +104,7 @@ config SCHED_TRACER
 config CONTEXT_SWITCH_TRACER
 	bool "Trace process context switches"
 	depends on HAVE_FTRACE
+	depends on DEBUG_KERNEL
 	select TRACING
 	select MARKERS
 	help
@@ -120,6 +125,7 @@ config DYNAMIC_FTRACE
 	bool "enable/disable ftrace tracepoints dynamically"
 	depends on FTRACE
 	depends on HAVE_DYNAMIC_FTRACE
+	depends on DEBUG_KERNEL
 	default y
 	help
          This option will modify all the calls to ftrace dynamically
@@ -146,6 +152,7 @@ config FTRACE_SELFTEST
 config FTRACE_STARTUP_TEST
 	bool "Perform a startup test on ftrace"
 	depends on TRACING
+	depends on DEBUG_KERNEL
 	select FTRACE_SELFTEST
 	help
 	  This option performs a series of startup tests on ftrace. On bootup

commit 2ff01c6a17391225a18256d510b6e5b4aba40aa1
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Sep 4 15:04:37 2008 +0200

    stack tracer: depends on DEBUG_KERNEL
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 2a22e46390d3..5a9cffb0fafb 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -109,6 +109,7 @@ config CONTEXT_SWITCH_TRACER
 config STACK_TRACER
 	bool "Trace max stack"
 	depends on HAVE_FTRACE
+	depends on DEBUG_KERNEL
 	select FTRACE
 	select STACKTRACE
 	help

commit ac8825ec6d941b6899331b84c7d6bf027c3bb4f1
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Aug 25 08:12:04 2008 +0200

    ftrace: clean up macro usage
    
    enclose the argument in parenthesis. (especially since we cast it,
    which is a high prio operation)
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7599abdf6d4d..969a83f75a3e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -165,7 +165,7 @@ static DEFINE_SPINLOCK(ftrace_hash_lock);
 #define ftrace_hash_unlock(flags) spin_lock_irqsave(&ftrace_hash_lock, flags)
 #else
 /* This is protected via the ftrace_lock with MCOUNT_RECORD. */
-#define ftrace_hash_lock(flags)   do { (void)flags; } while (0)
+#define ftrace_hash_lock(flags)   do { (void)(flags); } while (0)
 #define ftrace_hash_unlock(flags) do { } while(0)
 #endif
 

commit 3989cce82b272bd6312555fcc47c11715c157102
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Jun 9 20:54:22 2008 +0200

    ftrace: scripts/recordmcount.pl cross-build hack
    
    hack around:
    
     ld: Relocatable linking with relocations from format elf32-i386 (init/.tmp_gl_calibrate.o) to format elf64-x86-64 (init/.tmp_mx_calibrate.o) i  CC      arch/x86/mm/extable.o
     objcopy: 'init/.tmp_mx_calibrate.o': No such file
     rm: cannot remove `init/.tmp_mx_calibrate.o': No such file or directory
     ld: Relocatable linking with relocations from format elf32-i386 (arch/x86/mm/extable.o) to format elf64-x86-64 (arch/x86/mm/.tmp_mx_extable.o) is not supported
     mv: cannot stat `arch/x86/mm/.tmp_mx_extable.o': No such file or directory
     ld: Relocatable linking with relocations from format elf32-i386 (arch/x86/mm/fault.o) to format elf64-x86-64 (arch/x86/mm/.tmp_mx_fault.o) is not supported
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 44b4b23e91b2..e4922a6c963b 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -108,6 +108,20 @@ if ($#ARGV < 6) {
 
 my ($arch, $objdump, $objcopy, $cc, $ld, $nm, $rm, $mv, $inputfile) = @ARGV;
 
+if ($arch eq "i386") {
+  $ld = "ld -m elf_i386";
+  $objdump = "objdump -M i386";
+  $objcopy = "objcopy -O elf32-i386";
+  $cc = "gcc -m32";
+}
+
+if ($arch eq "x86_64") {
+  $ld = "ld -m elf_x86_64";
+  $objdump = "objdump -M x86-64";
+  $objcopy = "objcopy -O elf64-x86-64";
+  $cc = "gcc -m64";
+}
+
 $objdump = "objdump" if ((length $objdump) == 0);
 $objcopy = "objcopy" if ((length $objcopy) == 0);
 $cc = "gcc" if ((length $cc) == 0);