rpms/kernel/F-9 linux-2.6-x86-fix-setup-of-cyc2ns-in-tsc_64.patch, NONE, 1.1 linux-2.6-x86-prevent-pge-flush-from-interruption.patch, NONE, 1.1 kernel.spec, 1.654, 1.655

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Tue May 27 23:00:16 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26193

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-x86-fix-setup-of-cyc2ns-in-tsc_64.patch 
	linux-2.6-x86-prevent-pge-flush-from-interruption.patch 
Log Message:
* Tue May 27 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-36
- Fix two hard-to-reproduce x86 bugs:
  x86: fix sched_clock when calibrated against PIT
  x86: don't allow flush_tlb_all to be interrupted 


linux-2.6-x86-fix-setup-of-cyc2ns-in-tsc_64.patch:

--- NEW FILE linux-2.6-x86-fix-setup-of-cyc2ns-in-tsc_64.patch ---
From: Thomas Gleixner <tglx at linutronix.de>
Date: Sun, 18 May 2008 17:27:48 +0000 (+0200)
Subject: x86: fix setup of cyc2ns in tsc_64.c
X-Git-Tag: v2.6.26-rc4~11^2~7
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=b6db80ee1331e7beaeb91b4b3d946dd16c72e388

x86: fix setup of cyc2ns in tsc_64.c

When the TSC is calibrated against the PIT due to the nonavailability
of PMTIMER/HPET or due to SMI interference then the setup of the per
CPU cyc2ns variables is skipped. This is unlikely to happen but it
would definitely render sched_clock() unusable.

This was introduced with commit 53d517cdbaac704352b3d0c10fecb99e0b54572e

    x86: scale cyc_2_nsec according to CPU frequency

Update the per CPU cyc2ns variables in all exit pathes of tsc_calibrate.

Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Cc: stable at kernel.org
---

diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index fcc16e5..1784b80 100644
--- a/arch/x86/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
@@ -227,14 +227,14 @@ void __init tsc_calibrate(void)
 	/* hpet or pmtimer available ? */
 	if (!hpet && !pm1 && !pm2) {
 		printk(KERN_INFO "TSC calibrated against PIT\n");
-		return;
+		goto out;
 	}
 
 	/* Check, whether the sampling was disturbed by an SMI */
 	if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
 		printk(KERN_WARNING "TSC calibration disturbed by SMI, "
 		       "using PIT calibration result\n");
-		return;
+		goto out;
 	}
 
 	tsc2 = (tsc2 - tsc1) * 1000000L;
@@ -255,6 +255,7 @@ void __init tsc_calibrate(void)
 
 	tsc_khz = tsc2 / tsc1;
 
+out:
 	for_each_possible_cpu(cpu)
 		set_cyc2ns_scale(tsc_khz, cpu);
 }

linux-2.6-x86-prevent-pge-flush-from-interruption.patch:

--- NEW FILE linux-2.6-x86-prevent-pge-flush-from-interruption.patch ---
From: Ingo Molnar <mingo at elte.hu>
Date: Mon, 12 May 2008 19:21:15 +0000 (+0200)
Subject: x86: prevent PGE flush from interruption/preemption
X-Git-Tag: v2.6.26-rc4~11^2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=b1979a5fda7869a790f4fd83fb06c78498d26ba1

x86: prevent PGE flush from interruption/preemption

CR4 manipulation is not protected against interrupts and preemption,
but KVM uses smp_function_call to manipulate the X86_CR4_VMXE bit
either from the CPU hotplug code or from the kvm_init call.

We need to protect the CR4 manipulation from both interrupts and
preemption.

Original bug report: http://lkml.org/lkml/2008/5/7/48
Bugzilla entry: http://bugzilla.kernel.org/show_bug.cgi?id=10642

This is not a regression from 2.6.25, it's a long standing and hard to
trigger bug.

Signed-off-by: Ingo Molnar <mingo at elte.hu>
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---

diff --git a/include/asm-x86/tlbflush.h b/include/asm-x86/tlbflush.h
index 0c0674d..35c76ce 100644
--- a/include/asm-x86/tlbflush.h
+++ b/include/asm-x86/tlbflush.h
@@ -22,12 +22,23 @@ static inline void __native_flush_tlb(void)
 
 static inline void __native_flush_tlb_global(void)
 {
-	unsigned long cr4 = read_cr4();
+	unsigned long flags;
+	unsigned long cr4;
 
+	/*
+	 * Read-modify-write to CR4 - protect it from preemption and
+	 * from interrupts. (Use the raw variant because this code can
+	 * be called from deep inside debugging code.)
+	 */
+	raw_local_irq_save(flags);
+
+	cr4 = read_cr4();
 	/* clear PGE */
 	write_cr4(cr4 & ~X86_CR4_PGE);
 	/* write old PGE again and flush TLBs */
 	write_cr4(cr4);
+
+	raw_local_irq_restore(flags);
 }
 
 static inline void __native_flush_tlb_single(unsigned long addr)


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.654
retrieving revision 1.655
diff -u -r1.654 -r1.655
--- kernel.spec	27 May 2008 20:49:16 -0000	1.654
+++ kernel.spec	27 May 2008 22:58:44 -0000	1.655
@@ -580,6 +580,8 @@
 Patch87: linux-2.6-x86-fix-asm-constraint-in-do_IRQ.patch
 Patch88: linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch
 Patch89: linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch
+Patch90: linux-2.6-x86-fix-setup-of-cyc2ns-in-tsc_64.patch
+Patch91: linux-2.6-x86-prevent-pge-flush-from-interruption.patch
 
 Patch123: linux-2.6-ppc-rtc.patch
 Patch140: linux-2.6-ps3-ehci-iso.patch
@@ -1043,6 +1045,11 @@
 ApplyPatch linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch
 # don't read the apic if it's not mapped (#447183)
 ApplyPatch linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch
+# fix sched_clock when calibrated against PIT
+ApplyPatch linux-2.6-x86-fix-setup-of-cyc2ns-in-tsc_64.patch
+# dont allow flush_tlb_all to be interrupted
+ApplyPatch linux-2.6-x86-prevent-pge-flush-from-interruption.patch
+
 
 #
 # PowerPC
@@ -1834,6 +1841,11 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Tue May 27 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-36
+- Fix two hard-to-reproduce x86 bugs:
+  x86: fix sched_clock when calibrated against PIT
+  x86: don't allow flush_tlb_all to be interrupted 
+
 * Tue May 27 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-35
 - input: fix function keys on macbook pro 4,1 and air (#445761)
 




More information about the fedora-extras-commits mailing list