public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Fix AMD K6 indirect call check v2
@ 2013-04-21 16:49 Andi Kleen
  2013-04-21 17:06 ` H. Peter Anvin
  0 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2013-04-21 16:49 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

The AMD K6 errata check relies on timing a indirect call.
But the way it was written it could be optimized to a direct call.
Force gcc to actually do a indirect call and not just
constant resolve the target address.

Found during code review, no runtime testing due to lack
of hardware.

v2: More description
Signed-off-by: Andi Kleen <ak@linux.intel.com>

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 4a549db..11ea6f6 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -115,7 +115,7 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
 		 */
 
 		n = K6_BUG_LOOP;
-		f_vide = vide;
+		asm("" : "=g" (f_vide) : "0" (vide));
 		rdtscl(d);
 		while (n--)
 			f_vide();

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-04-22 13:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-21 16:49 [PATCH] x86: Fix AMD K6 indirect call check v2 Andi Kleen
2013-04-21 17:06 ` H. Peter Anvin
2013-04-21 17:13   ` Andi Kleen
2013-04-21 17:44   ` Borislav Petkov
2013-04-21 22:35     ` H. Peter Anvin
2013-04-21 22:48       ` Borislav Petkov
2013-04-22 11:25         ` Wolfram Gloger
2013-04-22 12:58           ` Ondrej Zary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox