Patches contributed by Eötvös Lorand University


commit 237749428552e2f81ec6c801482dfd8a777e470b
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Jun 9 10:57:16 2008 +0200

    Revert "x86, 32-bit: SRAT fix"
    
    This reverts commit ea57a5a6db8961de35cd1a4a80d8e01ee4307973, a better
    fix will be merged.

diff --git a/arch/x86/kernel/srat_32.c b/arch/x86/kernel/srat_32.c
index 5eedd3fd4d49..32d8b1142938 100644
--- a/arch/x86/kernel/srat_32.c
+++ b/arch/x86/kernel/srat_32.c
@@ -240,7 +240,6 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 	for (i = 0; i < MAX_APICID; i++)
 		apicid_2_node[i] = pxm_to_node(apicid_to_pxm[i]);
 
-	remove_all_active_ranges();
 	for (j = 0; j < num_memory_chunks; j++){
 		struct node_memory_chunk_s * chunk = &node_memory_chunk[j];
 		printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n",
@@ -248,8 +247,14 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 		node_read_chunk(chunk->nid, chunk);
 		e820_register_active_regions(chunk->nid, chunk->start_pfn,
 					     min(chunk->end_pfn, max_pfn));
-		memory_present(chunk->nid, chunk->start_pfn,
-			       min(chunk->end_pfn, max_pfn));
+	}
+ 
+	for_each_online_node(nid) {
+		unsigned long start = node_start_pfn[nid];
+		unsigned long end = node_end_pfn[nid];
+
+		memory_present(nid, start, end);
+		node_remap_size[nid] = node_memmap_size_bytes(nid, start, end);
 	}
 	return 1;
 out_fail:

commit b6d8adf477439e7086224bc9674c6b6638780783
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jun 5 22:46:14 2008 -0700

    uml: PATH_MAX needs limits.h
    
    Include limits.h to get a definition of PATH_MAX.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Jeff Dike <jdike@linux.intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 74ca7aabf4e1..30860b89ec58 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -7,6 +7,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sched.h>
+#include <linux/limits.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
 #include "kern_constants.h"

commit ea57a5a6db8961de35cd1a4a80d8e01ee4307973
Author: Ingo Molnar <mingo@elte.hu>
Date:   Fri Jun 6 16:28:23 2008 +0200

    x86, 32-bit: SRAT fix
    
    we were adding reserved BIOS ranges as general memory as well => not good.
    
    solves this crash:
    
    [   20.068075] hostname used greatest stack depth: 6464 bytes left
    [   20.121404] BUG: unable to handle kernel <1>BUG: unable to handle kernel NULL pointer dereference at 00000b8c
    [   20.121404] IP: [<c01160ae>] kmap_atomic_prot+0x2d/0x1c3
    [   20.121404] *pdpt = 00000000367eb001 *pde = 0000000000000000
    [   20.121404] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
    [   20.121404]
    [   20.121404] Pid: 2061, comm: rc.sysinit Not tainted (2.6.26-rc3 #2440)
    [   20.121404] EIP: 0060:[<c01160ae>] EFLAGS: 00010206 CPU: 0
    [   20.121404] EIP is at kmap_atomic_prot+0x2d/0x1c3
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/srat_32.c b/arch/x86/kernel/srat_32.c
index 32d8b1142938..5eedd3fd4d49 100644
--- a/arch/x86/kernel/srat_32.c
+++ b/arch/x86/kernel/srat_32.c
@@ -240,6 +240,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 	for (i = 0; i < MAX_APICID; i++)
 		apicid_2_node[i] = pxm_to_node(apicid_to_pxm[i]);
 
+	remove_all_active_ranges();
 	for (j = 0; j < num_memory_chunks; j++){
 		struct node_memory_chunk_s * chunk = &node_memory_chunk[j];
 		printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n",
@@ -247,14 +248,8 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 		node_read_chunk(chunk->nid, chunk);
 		e820_register_active_regions(chunk->nid, chunk->start_pfn,
 					     min(chunk->end_pfn, max_pfn));
-	}
- 
-	for_each_online_node(nid) {
-		unsigned long start = node_start_pfn[nid];
-		unsigned long end = node_end_pfn[nid];
-
-		memory_present(nid, start, end);
-		node_remap_size[nid] = node_memmap_size_bytes(nid, start, end);
+		memory_present(chunk->nid, chunk->start_pfn,
+			       min(chunk->end_pfn, max_pfn));
 	}
 	return 1;
 out_fail:

commit 1100ac91b6af02d8639d518fad5b434b1bf44ed6
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jun 5 12:25:37 2008 +0200

    sched: fix cpuprio build bug
    
    this patch was not built on !SMP:
    
     kernel/sched_rt.c: In function 'inc_rt_tasks':
     kernel/sched_rt.c:404: error: 'struct rq' has no member named 'online'
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index e4821593d4de..eaa606071d51 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -399,16 +399,19 @@ void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
 #if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
 	if (rt_se_prio(rt_se) < rt_rq->highest_prio) {
 		struct rq *rq = rq_of_rt_rq(rt_rq);
-		rt_rq->highest_prio = rt_se_prio(rt_se);
 
+		rt_rq->highest_prio = rt_se_prio(rt_se);
+#ifdef CONFIG_SMP
 		if (rq->online)
 			cpupri_set(&rq->rd->cpupri, rq->cpu,
 				   rt_se_prio(rt_se));
+#endif
 	}
 #endif
 #ifdef CONFIG_SMP
 	if (rt_se->nr_cpus_allowed > 1) {
 		struct rq *rq = rq_of_rt_rq(rt_rq);
+
 		rq->rt.rt_nr_migratory++;
 	}
 

commit 554ec22f075d46e4363520a407d2b7eeb5dfdd43
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon May 12 21:21:03 2008 +0200

    namespacecheck: more sched.c fixes
    
    [ Stephen Rothwell <sfr@canb.auug.org.au>: build fix ]
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/include/linux/sched.h b/include/linux/sched.h
index ae0be3c62375..dc36c3aea018 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -134,7 +134,6 @@ extern unsigned long nr_running(void);
 extern unsigned long nr_uninterruptible(void);
 extern unsigned long nr_active(void);
 extern unsigned long nr_iowait(void);
-extern unsigned long weighted_cpuload(const int cpu);
 
 struct seq_file;
 struct cfs_rq;
@@ -823,23 +822,6 @@ extern int arch_reinit_sched_domains(void);
 
 #endif	/* CONFIG_SMP */
 
-/*
- * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
- * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
- * task of nice 0 or enough lower priority tasks to bring up the
- * weighted_cpuload
- */
-static inline int above_background_load(void)
-{
-	unsigned long cpu;
-
-	for_each_online_cpu(cpu) {
-		if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
-			return 1;
-	}
-	return 0;
-}
-
 struct io_context;			/* See blkdev.h */
 #define NGROUPS_SMALL		32
 #define NGROUPS_PER_BLOCK	((unsigned int)(PAGE_SIZE / sizeof(gid_t)))

commit 75b9f5d2a0318da9d5e694a9a1be33f46b4c021e
Author: mingo@elte.hu <mingo@elte.hu>
Date:   Thu Jun 5 11:18:12 2008 +0200

    x86, nmi: fix build
    
    fix:
    
    arch/x86/kernel/built-in.o: In function `proc_nmi_enabled':
    : undefined reference to `nmi_watchdog_default'
    arch/x86/kernel/built-in.o: In function `native_smp_prepare_cpus':
    : undefined reference to `nmi_watchdog_default'
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 27ca8f69b466..19f1b95265cf 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -88,7 +88,6 @@ static inline unsigned int get_timer_irqs(int cpu)
 #endif
 }
 
-#ifdef CONFIG_X86_64
 /* Run after command line and cpu_init init, but before all other checks */
 void nmi_watchdog_default(void)
 {
@@ -96,7 +95,6 @@ void nmi_watchdog_default(void)
 		return;
 	nmi_watchdog = NMI_NONE;
 }
-#endif
 
 #ifdef CONFIG_SMP
 /*

commit 6637dea60ec93916ea0623a0e9bcc2b1769cbc11
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue May 20 19:34:09 2008 -0300

    V4L/DVB (7974): fix MEDIA_TUNER && FW_LOADER build error
    
    -tip testing found the following build failure:
    
      LD      .tmp_vmlinux1
      drivers/built-in.o: In function `generic_set_freq':
      tuner-xc2028.c:(.text+0xbd896): undefined reference to `request_firmware'
      tuner-xc2028.c:(.text+0xbdd7a): undefined reference to `release_firmware'
      drivers/built-in.o: In function `xc_load_fw_and_init_tuner':
      xc5000.c:(.text+0xc68e6): undefined reference to `request_firmware'
      xc5000.c:(.text+0xc6abe): undefined reference to `release_firmware'
    
    with this config:
    
      http://redhat.com/~mingo/misc/config-Tue_May_20_18_11_34_CEST_2008.bad
    
    the reason is another kconfig tool bug that has to be worked around in
    the driver's Kconfig file: if FW_LOADER is selected in a second
    dependency, that is not properly propagated up the dependencies.
    
    in this case, FW_LOADER is selected from MEDIA_TUNER_XC2028:
    
      config MEDIA_TUNER_XC2028
            tristate "XCeive xc2028/xc3028 tuners"
            depends on VIDEO_MEDIA && I2C
            depends on HOTPLUG
            select FW_LOADER
    
    which got selected by MEDIA_TUNER:
    
      config MEDIA_TUNER
            tristate
            default VIDEO_MEDIA && I2C
            depends on VIDEO_MEDIA && I2C
            select FW_LOADER if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
    
    but the kconfig tool did not pick up this second-order dependency and
    allowed CONFIG_FW_LOADER=m to be selected - in which case the build
    fails.
    
    the workaround i found was to move the select of FW_LOADER one level up,
    so that the buggy kconfig tool can notice it and can act appropriately.
    This problem can probably be worked around in other ways as well, i went
    for the minimal fix.
    
    Obviously, the kconfig tool should be fixed, it is not reasonable to
    expect driver authors to do manual dependency resolution (that kconfig
    itself already does) and uglify the Kconfig files. The kconfig tool did
    nothing to warn about this situation and did not prevent this faulty
    .config from being constructed.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig
index d6206540476b..85482960d012 100644
--- a/drivers/media/common/tuners/Kconfig
+++ b/drivers/media/common/tuners/Kconfig
@@ -21,6 +21,7 @@ config MEDIA_TUNER
 	tristate
 	default VIDEO_MEDIA && I2C
 	depends on VIDEO_MEDIA && I2C
+	select FW_LOADER if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
 	select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
 	select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
 	select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMIZE

commit b4aba24186d66190b21ab64bf28f22ffc51a9c43
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue May 20 08:02:33 2008 -0300

    V4L/DVB (7910): usb: input layer dependency fixes
    
    testing of the -tip tree found the following build failures on
    2.6.26-rc3:
    
      drivers/built-in.o: In function `ttusb_dec_disconnect':
      ttusb_dec.c:(.text+0xa2c95): undefined reference to `input_unregister_device'
    
      drivers/built-in.o: In function `dvb_usb_read_remote_control':
      dvb-usb-remote.c:(.text+0xa6a94): undefined reference to `input_event'
    
    with this config:
    
      http://redhat.com/~mingo/misc/config-Tue_May_20_03_48_57_CEST_2008.bad
    
    these are due to the media/dvb/usb layer having dependencies on INPUT
    functionality, without having that spelled out in the Kconfig file.
    
    this patch makes that dependency explicit (for the drivers affected),
    which solves the build error.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index cf4584e48b6d..f00a0eb40420 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -1,6 +1,6 @@
 config DVB_USB
 	tristate "Support for various USB DVB devices"
-	depends on DVB_CORE && USB && I2C
+	depends on DVB_CORE && USB && I2C && INPUT
 	depends on HOTPLUG	# due to FW_LOADER
 	select FW_LOADER
 	help
diff --git a/drivers/media/dvb/ttusb-dec/Kconfig b/drivers/media/dvb/ttusb-dec/Kconfig
index 0712899e39a4..a23cc0aa17d3 100644
--- a/drivers/media/dvb/ttusb-dec/Kconfig
+++ b/drivers/media/dvb/ttusb-dec/Kconfig
@@ -1,6 +1,6 @@
 config DVB_TTUSB_DEC
 	tristate "Technotrend/Hauppauge USB DEC devices"
-	depends on DVB_CORE && USB
+	depends on DVB_CORE && USB && INPUT
 	depends on HOTPLUG	# due to FW_LOADER
 	select FW_LOADER
 	select CRC32

commit 226e9a93a253b7d8811b5ed9ac671c6c5a728022
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue May 27 09:56:49 2008 +0200

    x86: ioremap fix failing nesting check
    
    Mika Kukkonen noticed that the nesting check in early_iounmap() is not
    actually done.
    
    Reported-by: Mika Kukkonen <mikukkon@srv1-m700-lanp.koti>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Cc: torvalds@linux-foundation.org
    Cc: arjan@linux.intel.com
    Cc: mikukkon@iki.fi
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 71bb3159031a..2b2bb3f9b683 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -593,10 +593,11 @@ void __init early_iounmap(void *addr, unsigned long size)
 	unsigned long offset;
 	unsigned int nrpages;
 	enum fixed_addresses idx;
-	unsigned int nesting;
+	int nesting;
 
 	nesting = --early_ioremap_nested;
-	WARN_ON(nesting < 0);
+	if (WARN_ON(nesting < 0))
+		return;
 
 	if (early_ioremap_debug) {
 		printk(KERN_INFO "early_iounmap(%p, %08lx) [%d]\n", addr,

commit deef325086c3897393b8f7d6bccd03405244fe18
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon May 12 15:44:38 2008 +0200

    x86: disable preemption in native_smp_prepare_cpus
    
    Priit Laes reported the following warning:
    
    Call Trace:
     [<ffffffff8022f1e1>] warn_on_slowpath+0x51/0x63
     [<ffffffff80282e48>] sys_ioctl+0x2d/0x5d
     [<ffffffff805185ff>] _spin_lock+0xe/0x24
     [<ffffffff80227459>] task_rq_lock+0x3d/0x73
     [<ffffffff805133c3>] set_cpu_sibling_map+0x336/0x350
     [<ffffffff8021c1b8>] read_apic_id+0x30/0x62
     [<ffffffff806d921d>] verify_local_APIC+0x90/0x138
     [<ffffffff806d84b5>] native_smp_prepare_cpus+0x1f9/0x305
     [<ffffffff806ce7b1>] kernel_init+0x59/0x2d9
     [<ffffffff80518a26>] _spin_unlock_irq+0x11/0x2b
     [<ffffffff8020bf48>] child_rip+0xa/0x12
     [<ffffffff806ce758>] kernel_init+0x0/0x2d9
     [<ffffffff8020bf3e>] child_rip+0x0/0x12
    
    fix this by generally disabling preemption in native_smp_prepare_cpus().
    
    Reported-and-bisected-by: Priit Laes <plaes@plaes.org>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 38988491c622..56078d61c793 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1190,6 +1190,7 @@ static void __init smp_cpu_index_default(void)
  */
 void __init native_smp_prepare_cpus(unsigned int max_cpus)
 {
+	preempt_disable();
 	nmi_watchdog_default();
 	smp_cpu_index_default();
 	current_cpu_data = boot_cpu_data;
@@ -1206,7 +1207,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 	if (smp_sanity_check(max_cpus) < 0) {
 		printk(KERN_INFO "SMP disabled\n");
 		disable_smp();
-		return;
+		goto out;
 	}
 
 	preempt_disable();
@@ -1246,6 +1247,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 	printk(KERN_INFO "CPU%d: ", 0);
 	print_cpu_info(&cpu_data(0));
 	setup_boot_clock();
+out:
+	preempt_enable();
 }
 /*
  * Early setup to make printk work.