* [PATCH 0/2] x86/tsc: Update tsc crystal_khz whitelist
@ 2016-09-15 15:04 Prarit Bhargava
2016-09-15 15:04 ` [PATCH 1/2] x86,tsc: Use cpu id defines from intel-family.h Prarit Bhargava
2016-09-15 15:04 ` [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist Prarit Bhargava
0 siblings, 2 replies; 7+ messages in thread
From: Prarit Bhargava @ 2016-09-15 15:04 UTC (permalink / raw)
To: linux-kernel
Cc: Prarit Bhargava, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86, Rafael Aquini, Peter Zijlstra (Intel), Andy Lutomirski,
Len Brown, lenb
native_calibrate_tsc() contains a whitelist of models that have a known
TSC frequency that differs from the CPU frequency. This patchset
switches the code from using magic numbers to using the defines in
asm/intel-family.h and adds new processors to the whitelist.
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Rafael Aquini <aquini@redhat.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: lenb@kernel.org
Prarit Bhargava (2):
x86,tsc: Use cpu id defines from intel-family.h
x86/tsc: Add additional Intel CPU models to crystal_khz whitelist
arch/x86/kernel/tsc.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
--
1.7.9.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] x86,tsc: Use cpu id defines from intel-family.h
2016-09-15 15:04 [PATCH 0/2] x86/tsc: Update tsc crystal_khz whitelist Prarit Bhargava
@ 2016-09-15 15:04 ` Prarit Bhargava
2016-09-15 15:04 ` [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist Prarit Bhargava
1 sibling, 0 replies; 7+ messages in thread
From: Prarit Bhargava @ 2016-09-15 15:04 UTC (permalink / raw)
To: linux-kernel
Cc: Prarit Bhargava, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86, Rafael Aquini, Peter Zijlstra (Intel), Andy Lutomirski,
Len Brown, lenb
asm/intel-family.h contains defines for cpu ids which should be
used in the native_calibrate_tsc() function.
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Rafael Aquini <aquini@redhat.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: lenb@kernel.org
---
arch/x86/kernel/tsc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 78b9cb5a26af..2344758ba8a3 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -23,6 +23,7 @@
#include <asm/x86_init.h>
#include <asm/geode.h>
#include <asm/apic.h>
+#include <asm/intel-family.h>
unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */
EXPORT_SYMBOL(cpu_khz);
@@ -686,11 +687,11 @@ unsigned long native_calibrate_tsc(void)
if (crystal_khz == 0) {
switch (boot_cpu_data.x86_model) {
- case 0x4E: /* SKL */
- case 0x5E: /* SKL */
+ case INTEL_FAM6_SKYLAKE_MOBILE:
+ case INTEL_FAM6_SKYLAKE_DESKTOP:
crystal_khz = 24000; /* 24.0 MHz */
break;
- case 0x5C: /* BXT */
+ case INTEL_FAM6_ATOM_GOLDMONT:
crystal_khz = 19200; /* 19.2 MHz */
break;
}
--
1.7.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist
2016-09-15 15:04 [PATCH 0/2] x86/tsc: Update tsc crystal_khz whitelist Prarit Bhargava
2016-09-15 15:04 ` [PATCH 1/2] x86,tsc: Use cpu id defines from intel-family.h Prarit Bhargava
@ 2016-09-15 15:04 ` Prarit Bhargava
2016-09-15 15:16 ` Peter Zijlstra
2016-09-15 16:08 ` Brown, Len
1 sibling, 2 replies; 7+ messages in thread
From: Prarit Bhargava @ 2016-09-15 15:04 UTC (permalink / raw)
To: linux-kernel
Cc: Prarit Bhargava, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86, Rafael Aquini, Peter Zijlstra (Intel), Andy Lutomirski,
Len Brown, lenb
In commit aa297292d708 ("x86/tsc: Enumerate SKL cpu_khz and tsc_khz via
CPUID"), the kernel added support for Intel processors which had
a different CPU base-frequency and TSC frequency.
The turbostat utility has been updated with KBL and SKX processors,
and they should also be added to the crystal_khz white list.
For example, on INTEL_FAM6_KABYLAKE_MOBILE native_calibrate_tsc() returns 0 MHz
for tsc_khz and after this patch native_calibrate_tsc() returns 1608 MHz.
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Rafael Aquini <aquini@redhat.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: lenb@kernel.org
---
arch/x86/kernel/tsc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 2344758ba8a3..dfa70a8867dc 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -689,11 +689,18 @@ unsigned long native_calibrate_tsc(void)
switch (boot_cpu_data.x86_model) {
case INTEL_FAM6_SKYLAKE_MOBILE:
case INTEL_FAM6_SKYLAKE_DESKTOP:
+ case INTEL_FAM6_KABYLAKE_MOBILE:
+ case INTEL_FAM6_KABYLAKE_DESKTOP:
crystal_khz = 24000; /* 24.0 MHz */
break;
+ case INTEL_FAM6_SKYLAKE_X:
+ crystal_khz = 24000; /* 25.0 MHz */
+ break;
case INTEL_FAM6_ATOM_GOLDMONT:
crystal_khz = 19200; /* 19.2 MHz */
break;
+ default:
+ crystal_khz = 0;
}
}
--
1.7.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist
2016-09-15 15:04 ` [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist Prarit Bhargava
@ 2016-09-15 15:16 ` Peter Zijlstra
2016-09-15 16:08 ` Brown, Len
1 sibling, 0 replies; 7+ messages in thread
From: Peter Zijlstra @ 2016-09-15 15:16 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Rafael Aquini, Andy Lutomirski, Len Brown, lenb
On Thu, Sep 15, 2016 at 11:04:18AM -0400, Prarit Bhargava wrote:
> +++ b/arch/x86/kernel/tsc.c
> @@ -689,11 +689,18 @@ unsigned long native_calibrate_tsc(void)
> switch (boot_cpu_data.x86_model) {
> case INTEL_FAM6_SKYLAKE_MOBILE:
> case INTEL_FAM6_SKYLAKE_DESKTOP:
> + case INTEL_FAM6_KABYLAKE_MOBILE:
> + case INTEL_FAM6_KABYLAKE_DESKTOP:
> crystal_khz = 24000; /* 24.0 MHz */
> break;
> + case INTEL_FAM6_SKYLAKE_X:
> + crystal_khz = 24000; /* 25.0 MHz */
^^^ != ^^^^
did you mean to type: 25000 ?
> + break;
> case INTEL_FAM6_ATOM_GOLDMONT:
> crystal_khz = 19200; /* 19.2 MHz */
> break;
> + default:
> + crystal_khz = 0;
> }
> }
>
> --
> 1.7.9.3
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist
2016-09-15 15:04 ` [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist Prarit Bhargava
2016-09-15 15:16 ` Peter Zijlstra
@ 2016-09-15 16:08 ` Brown, Len
2016-09-15 17:43 ` Peter Zijlstra
1 sibling, 1 reply; 7+ messages in thread
From: Brown, Len @ 2016-09-15 16:08 UTC (permalink / raw)
To: Prarit Bhargava, linux-kernel@vger.kernel.org
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86@kernel.org,
Rafael Aquini, Peter Zijlstra (Intel), Andy Lutomirski,
lenb@kernel.org
> + crystal_khz = 24000; /* 25.0 MHz */
I guess I prefer no comment over an incorrect comment.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist
2016-09-15 16:08 ` Brown, Len
@ 2016-09-15 17:43 ` Peter Zijlstra
2016-09-15 17:48 ` Prarit Bhargava
0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2016-09-15 17:43 UTC (permalink / raw)
To: Brown, Len
Cc: Prarit Bhargava, linux-kernel@vger.kernel.org, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, x86@kernel.org, Rafael Aquini,
Andy Lutomirski, lenb@kernel.org
On Thu, Sep 15, 2016 at 04:08:36PM +0000, Brown, Len wrote:
> > + crystal_khz = 24000; /* 25.0 MHz */
>
> I guess I prefer no comment over an incorrect comment.
>
>From this I take it it should really have been 24 MHz and it could have
joined the existing case. I assumed (ha!) that since it had a special
separate case the comment was correct.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist
2016-09-15 17:43 ` Peter Zijlstra
@ 2016-09-15 17:48 ` Prarit Bhargava
0 siblings, 0 replies; 7+ messages in thread
From: Prarit Bhargava @ 2016-09-15 17:48 UTC (permalink / raw)
To: Peter Zijlstra, Brown, Len
Cc: linux-kernel@vger.kernel.org, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86@kernel.org, Rafael Aquini, Andy Lutomirski,
lenb@kernel.org
On 09/15/2016 01:43 PM, Peter Zijlstra wrote:
> On Thu, Sep 15, 2016 at 04:08:36PM +0000, Brown, Len wrote:
>>> + crystal_khz = 24000; /* 25.0 MHz */
>>
>> I guess I prefer no comment over an incorrect comment.
>>
>
> From this I take it it should really have been 24 MHz and it could have
> joined the existing case. I assumed (ha!) that since it had a special
> separate case the comment was correct.
AFAICT, it should be 25000. Len -- can you explicitly confirm that? The
turbostat code contains (tools/power/x86/turbostat/turbostat.c:3312)
case 0x55: /* SKX */
crystal_hz = 25000000; /* 25.0 MHz */
P.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-09-15 17:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-15 15:04 [PATCH 0/2] x86/tsc: Update tsc crystal_khz whitelist Prarit Bhargava
2016-09-15 15:04 ` [PATCH 1/2] x86,tsc: Use cpu id defines from intel-family.h Prarit Bhargava
2016-09-15 15:04 ` [PATCH 2/2] x86/tsc: Add additional Intel CPU models to crystal_khz whitelist Prarit Bhargava
2016-09-15 15:16 ` Peter Zijlstra
2016-09-15 16:08 ` Brown, Len
2016-09-15 17:43 ` Peter Zijlstra
2016-09-15 17:48 ` Prarit Bhargava
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).