Patches contributed by Eötvös Lorand University


commit bd5435e76a226b7151ae5aaee2cd366ab003dd2e
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 19:33:06 2007 -0700

    [DCCP]: fix link error with !CONFIG_SYSCTL
    
    Do not define the sysctl_dccp_sync_ratelimit sysctl variable in the
    CONFIG_SYSCTL dependent sysctl.c module - move it to input.c instead.
    
    This fixes the following build bug:
    
     net/built-in.o: In function `dccp_check_seqno':
     input.c:(.text+0xbd859): undefined reference to `sysctl_dccp_sync_ratelimit'
     distcc[29953] ERROR: compile (null) on localhost failed
     make: *** [vmlinux] Error 1
    
    Found via 'make randconfig' build testing.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/net/dccp/input.c b/net/dccp/input.c
index 19d7e1dbd87e..3560a2a875a0 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -19,6 +19,9 @@
 #include "ccid.h"
 #include "dccp.h"
 
+/* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
+int sysctl_dccp_sync_ratelimit	__read_mostly = HZ / 8;
+
 static void dccp_fin(struct sock *sk, struct sk_buff *skb)
 {
 	sk->sk_shutdown |= RCV_SHUTDOWN;
diff --git a/net/dccp/sysctl.c b/net/dccp/sysctl.c
index 9364b2fb4dbd..c62c05039f69 100644
--- a/net/dccp/sysctl.c
+++ b/net/dccp/sysctl.c
@@ -18,9 +18,6 @@
 #error This file should not be compiled without CONFIG_SYSCTL defined
 #endif
 
-/* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
-int sysctl_dccp_sync_ratelimit	__read_mostly = HZ / 8;
-
 static struct ctl_table dccp_default_table[] = {
 	{
 		.procname	= "seq_window",

commit c1b7151a5ef4f35fb116d1a2689c5280938b0e8d
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 12:18:23 2007 +0200

    forcedeth: fix rx-work condition in nv_rx_process_optimized() too
    
    The merge of my previous fix to forcedeth.c,
    bcb5febb248f7cc1e4a39ff61507f6343ba1c594, lost an important hunk.
    
    We need to fix nv_rx_process_optimized() too, as it contains duplicate logic.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Jeff Garzik <jeff@garzik.org>

diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index cfbb7aacfe94..d0bff8a87666 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2408,13 +2408,13 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
 	struct fe_priv *np = netdev_priv(dev);
 	u32 flags;
 	u32 vlanflags = 0;
-	u32 rx_processed_cnt = 0;
+	int rx_work = 0;
 	struct sk_buff *skb;
 	int len;
 
 	while((np->get_rx.ex != np->put_rx.ex) &&
 	      !((flags = le32_to_cpu(np->get_rx.ex->flaglen)) & NV_RX2_AVAIL) &&
-	      (rx_processed_cnt++ < limit)) {
+	      (rx_work < limit)) {
 
 		dprintk(KERN_DEBUG "%s: nv_rx_process_optimized: flags 0x%x.\n",
 					dev->name, flags);
@@ -2517,9 +2517,11 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
 			np->get_rx.ex = np->first_rx.ex;
 		if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx))
 			np->get_rx_ctx = np->first_rx_ctx;
+
+		rx_work++;
 	}
 
-	return rx_processed_cnt;
+	return rx_work;
 }
 
 static void set_bufsize(struct net_device *dev)

commit b93b6ca3bf822a24e1535ee7c773740628bca1e6
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 18:04:41 2007 +0200

    i386: remove unnecessary code
    
    Oleg Nesterov pointed out that the set_fs() calls in setup_frame()
    and setup_rt_frame() were superfluous.
    
    [ tglx: arch/x86 adaptation ]
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Andi Kleen <ak@suse.de>
    Cc: Oleg Nesterov <oleg@tv-sign.ru>
    Cc: Chuck Ebbert <76306.1226@compuserve.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index d01d51fcce2a..0d79df3c5631 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -385,7 +385,6 @@ static int setup_frame(int sig, struct k_sigaction *ka,
 	regs->edx = (unsigned long) 0;
 	regs->ecx = (unsigned long) 0;
 
-	set_fs(USER_DS);
 	regs->xds = __USER_DS;
 	regs->xes = __USER_DS;
 	regs->xss = __USER_DS;
@@ -479,7 +478,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	regs->edx = (unsigned long) &frame->info;
 	regs->ecx = (unsigned long) &frame->uc;
 
-	set_fs(USER_DS);
 	regs->xds = __USER_DS;
 	regs->xes = __USER_DS;
 	regs->xss = __USER_DS;

commit 382f64ab8f178fe6ca5e7beafa7f03132724bbfb
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 18:04:41 2007 +0200

    i386: print better early fault info
    
    improve early fault output.
    
    old format:
    
     Int 14: CR2 010001e3  err 00000002  EIP c011f2f9  CS 00000060  flags 00010046
     Stack: c073695e c0791c10 00000000 ffffffff 00000000 01000000 00001000 c0791c10
    
    new format:
    
     BUG: Int 14: CR2 010001e3
          EDI c1000000  ESI c0693c10  EBP c0637f9c  ESP c0637f08
          EBX 00000000  EDX 0000000e  ECX 00000000  EAX 010001e3
          err 00000002  EIP c0123119   CS 00000060  flg 00010046
     Stack: c064d589 c0693000 00000000 c0637f60 00c001e3 01000000 00038000 00000163
            00000000 00000163 00000000 ffffffff 00038000 00000000 00000000 00001000
            00001000 00000000 c0637f88 c06509be c0a2ae60 00001000 00001000 00000000
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 0fa8a972a679..39677965e161 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -452,6 +452,7 @@ early_page_fault:
 early_fault:
 	cld
 #ifdef CONFIG_PRINTK
+	pusha
 	movl $(__KERNEL_DS),%eax
 	movl %eax,%ds
 	movl %eax,%es
@@ -543,8 +544,15 @@ int_msg:
 	.asciz "Unknown interrupt or fault at EIP %p %p %p\n"
 
 fault_msg:
-	.ascii "Int %d: CR2 %p  err %p  EIP %p  CS %p  flags %p\n"
-	.asciz "Stack: %p %p %p %p %p %p %p %p\n"
+	.ascii								\
+/* fault info: */	"BUG: Int %d: CR2 %p\n"				\
+/* pusha regs: */	"     EDI %p  ESI %p  EBP %p  ESP %p\n"		\
+			"     EBX %p  EDX %p  ECX %p  EAX %p\n"		\
+/* fault frame: */	"     err %p  EIP %p   CS %p  flg %p\n"		\
+									\
+			"Stack: %p %p %p %p %p %p %p %p\n"		\
+			"       %p %p %p %p %p %p %p %p\n"		\
+			"       %p %p %p %p %p %p %p %p\n"
 
 #include "../../x86/xen/xen-head.S"
 

commit 509a80c49c512ac88bd67b981145f925a306111b
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 18:04:34 2007 +0200

    x86: fix CONFIG_PAGEALLOC related boot hangs/OOMs
    
    if CONFIG_PAGEALLOC is enabled then X86_FEATURE_PSE is disabled and all
    the kernel physical RAM pagetables are set up as 4K pages. This is
    needed so that CONFIG_PAGEALLOC can do finegrained mapping and unmapping
    of pages.
    
    as a side-effect though, the total size of memory allocated as kernel
    pagetables increases significantly. All these pagetables are allocated
    via alloc_bootmem_low_pages(), straight out of the lowmem DMA pool. If
    the system has enough RAM and a large kernel image then almost all of
    the 16 MB lowmem DMA pool is allocated to the image and to pagetables -
    leaving no space for __GFP_DMA allocations.
    
    this results in drivers failing and the bootup hanging:
    
     swapper invoked oom-killer: gfp_mask=0x80d1, order=0, oomkilladj=0
      [<4015059f>] out_of_memory+0x17f/0x1c0
      [<40151f3c>] __alloc_pages+0x37c/0x3a0
      [<40168cd7>] slob_new_page+0x37/0x50
      [<40168dff>] slob_alloc+0x10f/0x190
      [<40169010>] __kmalloc_node+0x80/0x90
      [<405a17e3>] scsi_host_alloc+0x33/0x2c0
      [<405a1a82>] scsi_register+0x12/0x60
      [<40d5889e>] aha1542_detect+0x9e/0x940
      [<405c5ba5>] ultrastor_detect+0x265/0x5f0
      [<401352f5>] getnstimeofday+0x35/0xf0
      [<40d58751>] init_this_scsi_driver+0x41/0xf0
      [<40d0b856>] kernel_init+0x136/0x310
      [<40d58710>] init_this_scsi_driver+0x0/0xf0
      [<40d0b720>] kernel_init+0x0/0x310
      [<40105547>] kernel_thread_helper+0x7/0x10
      =======================
    
    the fix is to first allocate from above the DMA pool, and if that fails
    (for example due to it being a machine with less than 16 MB of RAM),
    allocate from the DMA pool as a fallback.
    
    With this fix applied i was able to boot a PAGEALLOC=y kernel that would
    hang before.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index dda4e83649a0..e4e37d4f4c52 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -85,13 +85,20 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
 static pte_t * __init one_page_table_init(pmd_t *pmd)
 {
 	if (!(pmd_val(*pmd) & _PAGE_PRESENT)) {
-		pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
+		pte_t *page_table = NULL;
+
+#ifdef CONFIG_DEBUG_PAGEALLOC
+		page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE);
+#endif
+		if (!page_table)
+			page_table =
+				(pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
 
 		paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT);
 		set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
 		BUG_ON(page_table != pte_offset_kernel(pmd, 0));
 	}
-	
+
 	return pte_offset_kernel(pmd, 0);
 }
 

commit 1e3e19723ecd58149388f3eecbd3285825f64f3b
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 18:04:34 2007 +0200

    x86: prepare page allocator for high allocations on PAGEALLOC=y
    
    To preserve the DMA pool in CONFIG_DEBUG_PAGEALLOC=y kernels, we'll
    allocate pagetables from above the 16MB DMA limit, so we'll have to set
    up boot pagetables to cover 16MB more RAM (worst-case).
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 9150ca9b5f80..0fa8a972a679 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -51,6 +51,15 @@
  */
 LOW_PAGES = 1<<(32-PAGE_SHIFT_asm)
 
+/*
+ * To preserve the DMA pool in PAGEALLOC kernels, we'll allocate
+ * pagetables from above the 16MB DMA limit, so we'll have to set
+ * up pagetables 16MB more (worst-case):
+ */
+#ifdef CONFIG_DEBUG_PAGEALLOC
+LOW_PAGES = LOW_PAGES + 0x1000000
+#endif
+
 #if PTRS_PER_PMD > 1
 PAGE_TABLE_SIZE = (LOW_PAGES / PTRS_PER_PMD) + PTRS_PER_PGD
 #else

commit f97586b610dc87a6494236118321e56ffc13319c
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 18:04:34 2007 +0200

    x86: do not crash on non-Geode PCs in TSC probe
    
    with this fix Geode kernels can be booted (and QA-ed) on generic PCs.
    
    otherwise it crashes and burns during early bootup:
    
    Detected 2160.212 MHz processor.
    general protection fault: 0000 [#1]
    PREEMPT SMP
    Modules linked in:
    CPU:    0
    EIP:    0060:[<c09071f6>]    Not tainted VLI
    EFLAGS: 00010002   (2.6.23-rc9 #90)
    EIP is at tsc_init+0xa6/0x150
    eax: 00000001   ebx: c1dce000   ecx: 00001900   edx: 00000001
    esi: 00051000   edi: 00051000   ebp: c08fdfc4   esp: c08fdfa4
    ds: 007b   es: 007b   fs: 00d8  gs: 0000  ss: 0068
    Process swapper (pid: 0, ti=c08fc000 task=c082a180 task.ti=c08fc000)
    Stack: c076b870 00000870 000000d4 0000001d c0831e80 c1dce000 00051000 00051000
           c08fdfcc c09053f8 c08fdff8 c09045ff 000001e2 c09040a0 00051000 00000020
           0004e500 c0932140 00020800 00099800 c08ed000 01409007 00000000
    Call Trace:
     [<c010517a>] show_trace_log_lvl+0x1a/0x30
     [<c0105246>] show_stack_log_lvl+0xb6/0x100
     [<c0105732>] show_registers+0x212/0x3a0
     [<c0105aa4>] die+0x104/0x220
     [<c0105f5f>] do_general_protection+0x1ef/0x2b0
     [<c06699f2>] error_code+0x72/0x78
     [<c09053f8>] time_init+0x8/0x20
     [<c09045ff>] start_kernel+0x1af/0x320
     [<00000000>] 0x0
     =======================
    Code: 31 d2 b8 00 00 09 3d f7 35 2c 70 9b c0 a3 04 95 8f c0 e8 ce 4e 99 ff b8 e0 45 93 c0 e8 94 b1 c5 ff e8 7f 3d 80 ff b9 00 19 00 00 <0f> 32 f6 c4 01 74 07 83 25 24 ce 82 c0 fd 8b 0d 20 ce 82 c0 b8
    EIP: [<c09071f6>] tsc_init+0xa6/0x150 SS:ESP 0068:c08fdfa4
    Kernel panic - not syncing: Attempted to kill the idle task!
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index b85ad754f70e..e87a3939ed40 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -349,10 +349,10 @@ __cpuinit int unsynchronized_tsc(void)
 
 static void __init check_geode_tsc_reliable(void)
 {
-	unsigned long val;
+	unsigned long res_low, res_high;
 
-	rdmsrl(MSR_GEODE_BUSCONT_CONF0, val);
-	if ((val & RTSC_SUSP))
+	rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
+	if (res_low & RTSC_SUSP)
 		clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
 }
 #else

commit 3fb450a327fc098efe6c9f000d470abac354cfcc
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 17 18:04:34 2007 +0200

    x86: enable NMI watchdog on nosmp
    
    if nosmp has been passed as a boot option, but nmi_watchdog=2 has also
    been enabled then keep minimal local APIC functionality around to make
    the watchdog work.
    
    this allowed me to debug a hard hang that would only occur with a nosmp
    bootup.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index edc9db69a118..83e4f40f8dc9 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -1021,6 +1021,12 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
 	if (!max_cpus) {
 		smp_found_config = 0;
 		printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n");
+
+		if (nmi_watchdog == NMI_LOCAL_APIC) {
+			printk(KERN_INFO "activating minimal APIC for NMI watchdog use.\n");
+			connect_bsp_APIC();
+			setup_local_APIC();
+		}
 		smpboot_clear_io_apic_irqs();
 		phys_cpu_present_map = physid_mask_of_physid(0);
 		cpu_set(0, per_cpu(cpu_sibling_map, 0));

commit 4749252776712e587c7c7619cbf0342b080c7f44
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Oct 16 23:30:29 2007 -0700

    printk: add KERN_CONT annotation
    
    printk: add the KERN_CONT annotation (which is empty string but via
    which checkpatch.pl can notice that the lacking KERN_ level is fine).
    This useful for multiple calls of hand-crafted printk output done by
    early debug code or similar.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Cc: Andy Whitcroft <apw@shadowen.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b2ea36e5b6b9..94bc99656963 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -76,6 +76,13 @@ extern const char linux_proc_banner[];
 #define	KERN_INFO	"<6>"	/* informational			*/
 #define	KERN_DEBUG	"<7>"	/* debug-level messages			*/
 
+/*
+ * Annotation for a "continued" line of log printout (only done after a
+ * line that had no enclosing \n). Only to be used by core/arch code
+ * during early bootup (a continued line is not SMP-safe otherwise).
+ */
+#define	KERN_CONT	""
+
 extern int console_printk[];
 
 #define console_loglevel (console_printk[0])

commit a5f2ce3c6024a5bb895647b6bd88ecae5001020a
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Oct 16 23:26:08 2007 -0700

    softlockup watchdog: style cleanups
    
    kernel/softirq.c grew a few style uncleanlinesses in the past few
    months, clean that up. No functional changes:
    
       text    data     bss     dec     hex filename
       1126      76       4    1206     4b6 softlockup.o.before
       1129      76       4    1209     4b9 softlockup.o.after
    
    ( the 3 bytes .text increase is due to the "<1>" appended to one of
      the printk messages. )
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index 65839c54abf5..72c2561ff5f8 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -23,7 +23,7 @@ static DEFINE_PER_CPU(unsigned long, touch_timestamp);
 static DEFINE_PER_CPU(unsigned long, print_timestamp);
 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
 
-static int did_panic = 0;
+static int did_panic;
 
 static int
 softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)
@@ -121,7 +121,7 @@ void softlockup_tick(void)
 /*
  * The watchdog thread - runs every second and touches the timestamp.
  */
-static int watchdog(void * __bind_cpu)
+static int watchdog(void *__bind_cpu)
 {
 	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
 
@@ -159,13 +159,13 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
 		BUG_ON(per_cpu(watchdog_task, hotcpu));
 		p = kthread_create(watchdog, hcpu, "watchdog/%d", hotcpu);
 		if (IS_ERR(p)) {
-			printk("watchdog for %i failed\n", hotcpu);
+			printk(KERN_ERR "watchdog for %i failed\n", hotcpu);
 			return NOTIFY_BAD;
 		}
-  		per_cpu(touch_timestamp, hotcpu) = 0;
-  		per_cpu(watchdog_task, hotcpu) = p;
+		per_cpu(touch_timestamp, hotcpu) = 0;
+		per_cpu(watchdog_task, hotcpu) = p;
 		kthread_bind(p, hotcpu);
- 		break;
+		break;
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
 		wake_up_process(per_cpu(watchdog_task, hotcpu));
@@ -185,7 +185,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
 		kthread_stop(p);
 		break;
 #endif /* CONFIG_HOTPLUG_CPU */
- 	}
+	}
 	return NOTIFY_OK;
 }