public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: You-Sheng Yang <vicamo@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, Pavel Tatashin <pasha.tatashin@oracle.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Dou Liyang <douly.fnst@cn.fujitsu.com>,
	Daniel Vacek <neelx@redhat.com>,
	Mike Travis <mike.travis@hpe.com>,
	Xiaoming Gao <gxm.linux.kernel@gmail.com>
Cc: You-Sheng Yang <vicamo.yang@canonical.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Chuanhua Lei <chuanhua.lei@linux.intel.com>,
	Juergen Gross <jgross@suse.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] x86/tsc: mark tsc reliable on CoffeeLake
Date: Mon,  8 Apr 2019 18:40:10 +0800	[thread overview]
Message-ID: <20190408104012.26791-1-vicamo@gmail.com> (raw)

From: You-Sheng Yang <vicamo.yang@canonical.com>

On Intel CoffeeLake it's observed tsc is always marked unstable
unexpectedly after entering idle state Package C10(PC10), and then clock
source is switched to hpet. This patch marks tsc as reliable when CPUID
matches CoffeeLake.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203183
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
 arch/x86/kernel/tsc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index aab0c82e0a0d..2abbadc9cff0 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1161,6 +1161,16 @@ static void __init check_system_tsc_reliable(void)
 #endif
 	if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
 		tsc_clocksource_reliable = 1;
+
+	/*
+	 * On Intel CoffeeLake, tsc may be marked unstable unexpectedly after
+	 * entering PC10.
+	 */
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+	    (boot_cpu_data.x86_model == INTEL_FAM6_KABYLAKE_MOBILE ||
+	     boot_cpu_data.x86_model == INTEL_FAM6_KABYLAKE_DESKTOP) &&
+	    boot_cpu_data.x86_stepping >= 0x0a)
+		tsc_clocksource_reliable = 1;
 }
 
 /*
-- 
2.20.1


             reply	other threads:[~2019-04-08 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 10:40 You-Sheng Yang [this message]
2019-04-08 12:03 ` [PATCH] x86/tsc: mark tsc reliable on CoffeeLake Thomas Gleixner
2019-04-10  8:11   ` You-Sheng Yang
2019-04-12  3:28   ` You-Sheng Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190408104012.26791-1-vicamo@gmail.com \
    --to=vicamo@gmail.com \
    --cc=bp@alien8.de \
    --cc=chuanhua.lei@linux.intel.com \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=gxm.linux.kernel@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.travis@hpe.com \
    --cc=mingo@redhat.com \
    --cc=neelx@redhat.com \
    --cc=pasha.tatashin@oracle.com \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vicamo.yang@canonical.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox