From: Borislav Petkov <bp@alien8.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 07/19] x86/cpu/amd: Use the full 64-bit TSC to detect the 2.6.2 bug
Date: Thu, 25 Jun 2015 18:44:01 +0200 [thread overview]
Message-ID: <1435250653-30182-8-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1435250653-30182-1-git-send-email-bp@alien8.de>
From: Andy Lutomirski <luto@kernel.org>
This code is timing 100k indirect calls, so the added overhead of
counting the number of cycles elapsed as a 64-bit number should be
insignificant. Drop the optimization of using a 32-bit count.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: kvm ML <kvm@vger.kernel.org>
Cc: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/d58f339a9c0dd8352b50d2f7a216f67ec2844f20.1434501121.git.luto@kernel.org
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/cpu/amd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index dd3a4baffe50..a69710db6112 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -114,7 +114,7 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
const int K6_BUG_LOOP = 1000000;
int n;
void (*f_vide)(void);
- unsigned long d, d2;
+ u64 d, d2;
printk(KERN_INFO "AMD K6 stepping B detected - ");
@@ -125,10 +125,10 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
n = K6_BUG_LOOP;
f_vide = vide;
- rdtscl(d);
+ d = native_read_tsc();
while (n--)
f_vide();
- rdtscl(d2);
+ d2 = native_read_tsc();
d = d2-d;
if (d > 20*K6_BUG_LOOP)
--
2.3.5
next prev parent reply other threads:[~2015-06-25 16:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 16:43 [PATCH 00/19] tip queue 2015-06-25 (rdtsc cleanup) Borislav Petkov
2015-06-25 16:43 ` [PATCH 01/19] x86/tsc: Inline native_read_tsc() and remove __native_read_tsc() Borislav Petkov
2015-06-25 16:43 ` [PATCH 02/19] x86/msr, kvm: Remove vget_cycles() Borislav Petkov
2015-06-25 16:43 ` [PATCH 03/19] x86/kernel/paravirt: Remove read_tsc() and read_tscp() paravirt hooks Borislav Petkov
2015-06-25 16:43 ` [PATCH 04/19] x86/tsc: Replace rdtscll() with native_read_tsc() Borislav Petkov
2015-06-25 16:43 ` [PATCH 05/19] x86/tsc: Remove the rdtscp() and rdtscpll() macros Borislav Petkov
2015-06-25 16:44 ` [PATCH 06/19] x86/tsc: Use the full 64-bit TSC in delay_tsc() Borislav Petkov
2015-06-25 16:44 ` Borislav Petkov [this message]
2015-06-25 16:44 ` [PATCH 08/19] drivers/net/hamradio/baycom_epp: Replace rdtscl() with native_read_tsc() Borislav Petkov
2015-06-25 16:44 ` [PATCH 09/19] staging/lirc_serial: Remove TSC-based timing Borislav Petkov
2015-06-25 16:44 ` [PATCH 10/19] input/joystick/analog: Switch from rdtscl() to native_read_tsc() Borislav Petkov
2015-06-25 16:44 ` [PATCH 11/19] drivers/input/gameport: Replace rdtscl() with native_read_tsc() Borislav Petkov
2015-06-25 16:44 ` [PATCH 12/19] x86/asm: Remove rdtscl() Borislav Petkov
2015-06-25 16:44 ` [PATCH 13/19] x86: Rename native_read_tsc() to rdtsc() Borislav Petkov
2015-06-25 16:44 ` [PATCH 14/19] x86: Add rdtsc_ordered() and use it in trivial call sites Borislav Petkov
2015-06-25 16:44 ` [PATCH 15/19] x86/tsc_sync: Use rdtsc_ordered() in check_tsc_warp() and drop extra barriers Borislav Petkov
2015-06-25 16:44 ` [PATCH 16/19] x86/tsc: Use rdtsc_ordered() in read_tsc() instead of get_cycles() Borislav Petkov
2015-06-25 16:44 ` [PATCH 17/19] x86/kvm/tsc: Drop extra barrier and use rdtsc_ordered() in kvmclock Borislav Petkov
2015-06-25 16:44 ` [PATCH 18/19] x86/asm: Remove rdtsc_barrier() Borislav Petkov
2015-06-25 16:44 ` [PATCH 19/19] x86/asm: Save an instruction in DECLARE_ARGS users Borislav Petkov
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=1435250653-30182-8-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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
Powered by JetHome