Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1395591

[PATCH] x86, tsc: Fix tsc ratio calibration to avoid broken mdelay

From yu.c.chen@intel.com
Newsgroups linux.kernel
Subject [PATCH] x86, tsc: Fix tsc ratio calibration to avoid broken mdelay
Date 2016-05-06 05:30 +0200
Message-ID <rvECK-5qY-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Chen Yu <yu.c.chen@intel.com>

Currently we fetch the tsc radio by:
ratio = (lo >> 8) & 0x1f;
thus get bit8~bit12 of the MSR_PLATFORM_INFO, however according
to Intel 64 and IA-32 Architectures Software Developer Manual 35.5,
the ratio bit should be bit8~bit15, otherwise we might get incorrect
tsc ratio and cause system hang later(mdelay corrupted).

Fix this problem by masking 0xff instead.

Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 arch/x86/kernel/tsc_msr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c
index 92ae6ac..6aa0f4d 100644
--- a/arch/x86/kernel/tsc_msr.c
+++ b/arch/x86/kernel/tsc_msr.c
@@ -92,7 +92,7 @@ unsigned long try_msr_calibrate_tsc(void)
 
 	if (freq_desc_tables[cpu_index].msr_plat) {
 		rdmsr(MSR_PLATFORM_INFO, lo, hi);
-		ratio = (lo >> 8) & 0x1f;
+		ratio = (lo >> 8) & 0xff;
 	} else {
 		rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
 		ratio = (hi >> 8) & 0x1f;
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] x86, tsc: Fix tsc ratio calibration to avoid broken mdelay yu.c.chen@intel.com - 2016-05-06 05:30 +0200
  Re: [PATCH] x86, tsc: Fix tsc ratio calibration to avoid broken  mdelay Thomas Gleixner <tglx@linutronix.de> - 2016-05-06 11:50 +0200
    Re: [PATCH] x86, tsc: Fix tsc ratio calibration to avoid broken  mdelay Thomas Gleixner <tglx@linutronix.de> - 2016-05-06 12:00 +0200
      RE: [PATCH] x86, tsc: Fix tsc ratio calibration to avoid broken  mdelay "Chen, Yu C" <yu.c.chen@intel.com> - 2016-05-06 14:50 +0200
  [tip:x86/urgent] x86/tsc: Read all ratio bits from  MSR_PLATFORM_INFO tip-bot for Chen Yu <tipbot@zytor.com> - 2016-05-06 12:00 +0200

csiph-web