From 68c77d45acdb7a830c2bfa5194d2093e8fc477d2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 20 Aug 2007 23:19:06 -0700 Subject: [PATCH] more 2.6.22 patches added to the queue --- ...t-try-to-mark-invalid-pfns-as-nosave.patch | 38 +++++++++ ...s-the-vsyscall-page-with-compat-vdso.patch | 32 +++++++ .../i386-fix-double-fault-handler.patch | 85 +++++++++++++++++++ ...performance-counters-in-nmi-watchdog.patch | 37 ++++++++ queue-2.6.22/series | 6 ++ ...ange-pmds-invocation-to-single-macro.patch | 35 ++++++++ ...eck-for-.cfi_rel_offset-in-cfi-probe.patch | 49 +++++++++++ 7 files changed, 282 insertions(+) create mode 100644 queue-2.6.22/hibernation-do-not-try-to-mark-invalid-pfns-as-nosave.patch create mode 100644 queue-2.6.22/i386-allow-debuggers-to-access-the-vsyscall-page-with-compat-vdso.patch create mode 100644 queue-2.6.22/i386-fix-double-fault-handler.patch create mode 100644 queue-2.6.22/i386-handle-p6s-without-performance-counters-in-nmi-watchdog.patch create mode 100644 queue-2.6.22/x86_64-change-pmds-invocation-to-single-macro.patch create mode 100644 queue-2.6.22/x86_64-check-for-.cfi_rel_offset-in-cfi-probe.patch diff --git a/queue-2.6.22/hibernation-do-not-try-to-mark-invalid-pfns-as-nosave.patch b/queue-2.6.22/hibernation-do-not-try-to-mark-invalid-pfns-as-nosave.patch new file mode 100644 index 00000000000..dac062b3b69 --- /dev/null +++ b/queue-2.6.22/hibernation-do-not-try-to-mark-invalid-pfns-as-nosave.patch @@ -0,0 +1,38 @@ +From stable-bounces@linux.kernel.org Wed Aug 15 06:28:09 2007 +From: "Rafael J. Wysocki" +Date: Wed, 15 Aug 2007 15:37:37 +0200 +Subject: Hibernation: do not try to mark invalid PFNs as nosave +To: stable@kernel.org +Message-ID: <200708151537.37193.rjw@sisk.pl> +Content-Disposition: inline + +From: Rafael J. Wysocki + +On some systems some PFNs reported by the early initialization code as 'nosave' +may be invalid. =A0If we try to set the corresponding bits in the hibernation +bitmap, BUG_ON() in memory_bm_find_bit() will be triggered and the system +won't be able to boot (cf. https://bugzilla.novell.com/show_bug.cgi?id=296242). + +Prevent this from happening by verifying if the 'nosave' PFNs are valid in +mark_nosave_pages(). + +Signed-off-by: Rafael J. Wysocki +Acked-by: Pavel Machek +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/power/snapshot.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/power/snapshot.c ++++ b/kernel/power/snapshot.c +@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct mem + region->end_pfn << PAGE_SHIFT); + + for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++) +- memory_bm_set_bit(bm, pfn); ++ if (pfn_valid(pfn)) ++ memory_bm_set_bit(bm, pfn); + } + } + diff --git a/queue-2.6.22/i386-allow-debuggers-to-access-the-vsyscall-page-with-compat-vdso.patch b/queue-2.6.22/i386-allow-debuggers-to-access-the-vsyscall-page-with-compat-vdso.patch new file mode 100644 index 00000000000..791d1ff55df --- /dev/null +++ b/queue-2.6.22/i386-allow-debuggers-to-access-the-vsyscall-page-with-compat-vdso.patch @@ -0,0 +1,32 @@ +From stable-bounces@linux.kernel.org Wed Aug 15 03:39:09 2007 +From: Jan Beulich +Date: Wed, 15 Aug 2007 12:38:54 +0200 (CEST) +Subject: i386: allow debuggers to access the vsyscall page with compat vDSO +To: jbeulich@novell.com, patches@x86-64.org, linux-kernel@vger.kernel.org, stable@kernel.org +Message-ID: <20070815103854.450BB14F28@wotan.suse.de> + +From: Jan Beulich + + +From: Jan Beulich +Signed-off-by: Jan Beulich +Signed-off-by: Andi Kleen +Signed-off-by: Greg Kroah-Hartman + +--- + arch/i386/kernel/sysenter.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/i386/kernel/sysenter.c ++++ b/arch/i386/kernel/sysenter.c +@@ -336,7 +336,9 @@ struct vm_area_struct *get_gate_vma(stru + + int in_gate_area(struct task_struct *task, unsigned long addr) + { +- return 0; ++ const struct vm_area_struct *vma = get_gate_vma(task); ++ ++ return vma && addr >= vma->vm_start && addr < vma->vm_end; + } + + int in_gate_area_no_task(unsigned long addr) diff --git a/queue-2.6.22/i386-fix-double-fault-handler.patch b/queue-2.6.22/i386-fix-double-fault-handler.patch new file mode 100644 index 00000000000..14ac35b2508 --- /dev/null +++ b/queue-2.6.22/i386-fix-double-fault-handler.patch @@ -0,0 +1,85 @@ +From stable-bounces@linux.kernel.org Wed Aug 15 03:39:09 2007 +From: Chuck Ebbert +Date: Wed, 15 Aug 2007 12:38:57 +0200 (CEST) +Subject: i386: Fix double fault handler +To: cebbert@redhat.com, patches@x86-64.org, linux-kernel@vger.kernel.org, stable@kernel.org +Message-ID: <20070815103857.6F54E14F28@wotan.suse.de> + + +From: Chuck Ebbert + +The new percpu code has apparently broken the doublefault handler +when CONFIG_DEBUG_SPINLOCK is set. Doublefault is handled by +a hardware task, making the check + + SPIN_BUG_ON(lock->owner == current, lock, "recursion"); + +fault because it uses the FS register to access the percpu data +for current, and that register is zero in the new TSS. (The trace +I saw was on 2.6.20 where it was GS, but it looks like this will +still happen with FS on 2.6.22.) + +Initializing FS in the doublefault_tss should fix it. + +AK: Also fix broken ptr_ok() and turn printks into KERN_EMERG +AK: And add a PANIC prefix to make clear the system will hang +AK: (e.g. x86-64 will recover) + +Signed-off-by: Chuck Ebbert +Signed-off-by: Andi Kleen +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + + +--- + arch/i386/kernel/doublefault.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/arch/i386/kernel/doublefault.c ++++ b/arch/i386/kernel/doublefault.c +@@ -13,7 +13,7 @@ + static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE]; + #define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE) + +-#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + 0x1000000) ++#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + MAXMEM) + + static void doublefault_fn(void) + { +@@ -23,23 +23,23 @@ static void doublefault_fn(void) + store_gdt(&gdt_desc); + gdt = gdt_desc.address; + +- printk("double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size); ++ printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size); + + if (ptr_ok(gdt)) { + gdt += GDT_ENTRY_TSS << 3; + tss = *(u16 *)(gdt+2); + tss += *(u8 *)(gdt+4) << 16; + tss += *(u8 *)(gdt+7) << 24; +- printk("double fault, tss at %08lx\n", tss); ++ printk(KERN_EMERG "double fault, tss at %08lx\n", tss); + + if (ptr_ok(tss)) { + struct i386_hw_tss *t = (struct i386_hw_tss *)tss; + +- printk("eip = %08lx, esp = %08lx\n", t->eip, t->esp); ++ printk(KERN_EMERG "eip = %08lx, esp = %08lx\n", t->eip, t->esp); + +- printk("eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n", ++ printk(KERN_EMERG "eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n", + t->eax, t->ebx, t->ecx, t->edx); +- printk("esi = %08lx, edi = %08lx\n", ++ printk(KERN_EMERG "esi = %08lx, edi = %08lx\n", + t->esi, t->edi); + } + } +@@ -63,6 +63,7 @@ struct tss_struct doublefault_tss __cach + .cs = __KERNEL_CS, + .ss = __KERNEL_DS, + .ds = __USER_DS, ++ .fs = __KERNEL_PERCPU, + + .__cr3 = __pa(swapper_pg_dir) + } diff --git a/queue-2.6.22/i386-handle-p6s-without-performance-counters-in-nmi-watchdog.patch b/queue-2.6.22/i386-handle-p6s-without-performance-counters-in-nmi-watchdog.patch new file mode 100644 index 00000000000..6bd8220f0c3 --- /dev/null +++ b/queue-2.6.22/i386-handle-p6s-without-performance-counters-in-nmi-watchdog.patch @@ -0,0 +1,37 @@ +From stable-bounces@linux.kernel.org Wed Aug 15 03:39:17 2007 +From: Andi Kleen +Date: Wed, 15 Aug 2007 12:38:58 +0200 (CEST) +Subject: i386: Handle P6s without performance counters in nmi watchdog +To: avi@qumranet.com, patches@x86-64.org, linux-kernel@vger.kernel.org, stable@kernel.org +Message-ID: <20070815103858.7FE3914F8E@wotan.suse.de> + + +From: Andi Kleen + +I got an oops while booting a 32bit kernel on KVM because it doesn't +implement performance counters used by the NMI watchdog. Handle this +case. + + +Cc: Avi Kivity +Signed-off-by: Andi Kleen +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/i386/kernel/cpu/perfctr-watchdog.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/i386/kernel/cpu/perfctr-watchdog.c ++++ b/arch/i386/kernel/cpu/perfctr-watchdog.c +@@ -346,7 +346,9 @@ static int setup_p6_watchdog(unsigned nm + perfctr_msr = MSR_P6_PERFCTR0; + evntsel_msr = MSR_P6_EVNTSEL0; + +- wrmsrl(perfctr_msr, 0UL); ++ /* KVM doesn't implement this MSR */ ++ if (wrmsr_safe(perfctr_msr, 0, 0) < 0) ++ return 0; + + evntsel = P6_EVNTSEL_INT + | P6_EVNTSEL_OS diff --git a/queue-2.6.22/series b/queue-2.6.22/series index b8fd0bde0c4..cd9a5d2b090 100644 --- a/queue-2.6.22/series +++ b/queue-2.6.22/series @@ -11,3 +11,9 @@ avr32-fix-atomic_add_unless-and-atomic_sub_unless.patch r8169-avoid-needless-napi-poll-scheduling.patch forcedeth-fix-random-hang-in-forcedeth-driver-when-using-netconsole.patch libata-add-ati-sb700-device-ids-to-ahci-driver.patch +hibernation-do-not-try-to-mark-invalid-pfns-as-nosave.patch +i386-allow-debuggers-to-access-the-vsyscall-page-with-compat-vdso.patch +x86_64-check-for-.cfi_rel_offset-in-cfi-probe.patch +x86_64-change-pmds-invocation-to-single-macro.patch +i386-handle-p6s-without-performance-counters-in-nmi-watchdog.patch +i386-fix-double-fault-handler.patch diff --git a/queue-2.6.22/x86_64-change-pmds-invocation-to-single-macro.patch b/queue-2.6.22/x86_64-change-pmds-invocation-to-single-macro.patch new file mode 100644 index 00000000000..6f54d5d2e0b --- /dev/null +++ b/queue-2.6.22/x86_64-change-pmds-invocation-to-single-macro.patch @@ -0,0 +1,35 @@ +From stable-bounces@linux.kernel.org Wed Aug 15 03:39:17 2007 +From: Andi Kleen +Date: Wed, 15 Aug 2007 12:38:56 +0200 (CEST) +Subject: x86_64: Change PMDS invocation to single macro +To: patches@x86-64.org, linux-kernel@vger.kernel.org, stable@kernel.org +Message-ID: <20070815103856.606DA14F28@wotan.suse.de> + +From: Andi Kleen + +Very old binutils (2.12.90...) seem to have trouble with newlines +in assembler macro invocation. They put them into the resulting +argument expansion. In this case this lead to a parse error because +a .rept expression ended up spread over multiple lines. Change the PMDS() +invocation to a single line. + +Signed-off-by: Andi Kleen +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86_64/kernel/head.S | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/arch/x86_64/kernel/head.S ++++ b/arch/x86_64/kernel/head.S +@@ -326,8 +326,7 @@ NEXT_PAGE(level2_kernel_pgt) + /* 40MB kernel mapping. The kernel code cannot be bigger than that. + When you change this change KERNEL_TEXT_SIZE in page.h too. */ + /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ +- PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, +- KERNEL_TEXT_SIZE/PMD_SIZE) ++ PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, KERNEL_TEXT_SIZE/PMD_SIZE) + /* Module mapping starts here */ + .fill (PTRS_PER_PMD - (KERNEL_TEXT_SIZE/PMD_SIZE)),8,0 + diff --git a/queue-2.6.22/x86_64-check-for-.cfi_rel_offset-in-cfi-probe.patch b/queue-2.6.22/x86_64-check-for-.cfi_rel_offset-in-cfi-probe.patch new file mode 100644 index 00000000000..51155940092 --- /dev/null +++ b/queue-2.6.22/x86_64-check-for-.cfi_rel_offset-in-cfi-probe.patch @@ -0,0 +1,49 @@ +From stable-bounces@linux.kernel.org Wed Aug 15 03:39:09 2007 +From: Andi Kleen +Date: Wed, 15 Aug 2007 12:38:55 +0200 (CEST) +Subject: x86_64: Check for .cfi_rel_offset in CFI probe +To: jbeulich@novell.com, patches@x86-64.org, linux-kernel@vger.kernel.org, stable@kernel.org +Message-ID: <20070815103855.5338A14F28@wotan.suse.de> + +From: Andi Kleen + + +Very old binutils have .cfi_startproc/endproc, but +no .cfi_rel_offset. Check for .cfi_rel_offset too. + +Cc: Jan Beulich +Cc: Sam Ravnborg +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/i386/Makefile | 4 ++-- + arch/x86_64/Makefile | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/i386/Makefile ++++ b/arch/i386/Makefile +@@ -51,8 +51,8 @@ cflags-y += -maccumulate-outgoing-args + CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) + + # do binutils support CFI? +-cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) +-AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) ++cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) ++AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) + + # is .cfi_signal_frame supported too? + cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) +--- a/arch/x86_64/Makefile ++++ b/arch/x86_64/Makefile +@@ -57,8 +57,8 @@ cflags-y += $(call cc-option,-mno-sse -m + cflags-y += -maccumulate-outgoing-args + + # do binutils support CFI? +-cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) +-AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) ++cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) ++AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) + + # is .cfi_signal_frame supported too? + cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) -- 2.47.3