Bug#733043: linux-2.6: warm reboot on XeonE5 machine finally hang up (after 208.5 days)
Package: linux-2.6
Version: 2.6.32-48squeeze4
Severity: important
Tags: fixed-upstream, patch
Xeon E5 has a bug, it doesn't reset TSC on warm reboot, just keep it instead.
see "BT81. X X X No Fix TSC is Not Affected by Warm Reset"
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/xeon-e5-family-spec-update.pdf
And also kernel 2.6.32 has a bug.
Xeon bug + kernel bug = hung after warm reboot (or kexec) after 208.5 days
since booting. So, administrators should shutdown it once at all, then
boot it again because "shutdown -r" causes hang up.
Red Hat has released a fix for this as kernel 2.6.32-220, 2.6.32-279
and 2.6.32-358 series (RHEL6.x)
https://access.redhat.com/site/solutions/433883 (for detail subscriber only :-(
Attached patch is based on upstream patch.
see http://kernel.opensuse.org/cgit/kernel/patch/?id=9993bc635d01a6ee7f6b833b4ee65ce7c06350b1
Please look into it and update.
Thanks.
--
Regards,
Hideki Yamane henrich @ debian.or.jp/org
http://wiki.debian.org/HidekiYamane
diff -urN linux-2.6-2.6.32.orig/debian/changelog linux-2.6-2.6.32/debian/changelog
--- linux-2.6-2.6.32.orig/debian/changelog 2013-12-24 22:24:17.000000000 +0900
+++ linux-2.6-2.6.32/debian/changelog 2013-12-24 22:32:19.833691711 +0900
@@ -1,3 +1,12 @@
+linux-2.6 (2.6.32-48squeeze4.1) UNRELEASED; urgency=medium
+
+ [ Hideki Yamane ]
+ * Non-maintainer upload.
+ * "sched/x86: Fix overflow in cyc2ns_offset" from upstream git.
+ It avoids hung up after reboot on Xeon E5 that spends 208.5 days
+
+ -- Hideki Yamane <henrich@debian.org> Tue, 24 Dec 2013 22:09:52 +0900
+
linux-2.6 (2.6.32-48squeeze4) squeeze-security; urgency=high
[ Ian Campbell ]
diff -urN linux-2.6-2.6.32.orig/debian/patches/bugfix/x86/sched_x86_Fix_overflow_in_cyc2ns_offset.patch linux-2.6-2.6.32/debian/patches/bugfix/x86/sched_x86_Fix_overflow_in_cyc2ns_offset.patch
--- linux-2.6-2.6.32.orig/debian/patches/bugfix/x86/sched_x86_Fix_overflow_in_cyc2ns_offset.patch 1970-01-01 09:00:00.000000000 +0900
+++ linux-2.6-2.6.32/debian/patches/bugfix/x86/sched_x86_Fix_overflow_in_cyc2ns_offset.patch 2013-12-24 22:29:56.117656579 +0900
@@ -0,0 +1,51 @@
+commit 9993bc635d01a6ee7f6b833b4ee65ce7c06350b upstream.
+
+diff -urN linux-2.6-2.6.32/arch/x86/include/asm/timer.h linux-2.6-2.6.32.fixed/arch/x86/include/asm/timer.h
+--- linux-2.6-2.6.32/arch/x86/include/asm/timer.h 2009-12-03 12:51:21.000000000 +0900
++++ linux-2.6-2.6.32.fixed/arch/x86/include/asm/timer.h 2013-12-24 22:09:10.930488157 +0900
+@@ -49,7 +49,8 @@
+ {
+ int cpu = smp_processor_id();
+ unsigned long long ns = per_cpu(cyc2ns_offset, cpu);
+- ns += cyc * per_cpu(cyc2ns, cpu) >> CYC2NS_SCALE_FACTOR;
++ ns += mult_frac(cyc, per_cpu(cyc2ns, cpu),
++ (1UL << CYC2NS_SCALE_FACTOR));
+ return ns;
+ }
+
+diff -urN linux-2.6-2.6.32/arch/x86/kernel/tsc.c linux-2.6-2.6.32.fixed/arch/x86/kernel/tsc.c
+--- linux-2.6-2.6.32/arch/x86/kernel/tsc.c 2009-12-03 12:51:21.000000000 +0900
++++ linux-2.6-2.6.32.fixed/arch/x86/kernel/tsc.c 2013-12-24 22:04:41.441744936 +0900
+@@ -619,7 +619,8 @@
+
+ if (cpu_khz) {
+ *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz;
+- *offset = ns_now - (tsc_now * *scale >> CYC2NS_SCALE_FACTOR);
++ *offset = ns_now - mult_frac(tsc_now, *scale,
++ (1UL << CYC2NS_SCALE_FACTOR));
+ }
+
+ sched_clock_idle_wakeup_event(0);
+diff -urN linux-2.6-2.6.32/include/linux/kernel.h linux-2.6-2.6.32.fixed/include/linux/kernel.h
+--- linux-2.6-2.6.32/include/linux/kernel.h 2009-12-03 12:51:21.000000000 +0900
++++ linux-2.6-2.6.32.fixed/include/linux/kernel.h 2013-12-24 22:04:41.441744936 +0900
+@@ -55,6 +55,19 @@
+ } \
+ )
+
++/*
++ * Multiplies an integer by a fraction, while avoiding unnecessary
++ * overflow or loss of precision.
++ */
++#define mult_frac(x, numer, denom)( \
++{ \
++ typeof(x) quot = (x) / (denom); \
++ typeof(x) rem = (x) % (denom); \
++ (quot * (numer)) + ((rem * (numer)) / (denom)); \
++} \
++)
++
++
+ #define _RET_IP_ (unsigned long)__builtin_return_address(0)
+ #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
+
diff -urN linux-2.6-2.6.32.orig/debian/patches/series/48squeeze4.1 linux-2.6-2.6.32/debian/patches/series/48squeeze4.1
--- linux-2.6-2.6.32.orig/debian/patches/series/48squeeze4.1 1970-01-01 09:00:00.000000000 +0900
+++ linux-2.6-2.6.32/debian/patches/series/48squeeze4.1 2013-12-24 22:31:43.449682015 +0900
@@ -0,0 +1 @@
++ bugfix/x86/sched_x86_Fix_overflow_in_cyc2ns_offset.patch
Reply to: