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


Groups > linux.kernel > #1688162

[tip:x86/urgent] x86/cpu: Use indirect call to measure performance in init_amd_k6()

From tip-bot for Mikulas Patocka <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:x86/urgent] x86/cpu: Use indirect call to measure performance in init_amd_k6()
Date 2017-07-16 11:30 +0200
Message-ID <u3O2e-5hz-7@gated-at.bofh.it> (permalink)
References <u21PX-1KO-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  5f8a16156aa1b2d0223eaee9dacdfb9bc096f610
Gitweb:     http://git.kernel.org/tip/5f8a16156aa1b2d0223eaee9dacdfb9bc096f610
Author:     Mikulas Patocka <mpatocka@redhat.com>
AuthorDate: Tue, 11 Jul 2017 07:44:05 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 16 Jul 2017 11:05:04 +0200

x86/cpu: Use indirect call to measure performance in init_amd_k6()

This old piece of code is supposed to measure the performance of indirect
calls to determine if the processor is buggy or not, however the compiler
optimizer turns it into a direct call.

Use the OPTIMIZER_HIDE_VAR() macro to thwart the optimization, so that a real
indirect call is generated.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/alpine.LRH.2.02.1707110737530.8746@file01.intranet.prod.int.rdu2.redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/amd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index bb5abe8..3b9e220 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -134,6 +134,7 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
 
 		n = K6_BUG_LOOP;
 		f_vide = vide;
+		OPTIMIZER_HIDE_VAR(f_vide);
 		d = rdtsc();
 		while (n--)
 			f_vide();

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


Thread

[PATCH] x86/kernel/cpu/amd.c: use indirect call Mikulas Patocka <mpatocka@redhat.com> - 2017-07-11 13:50 +0200
  [tip:x86/urgent] x86/cpu: Use indirect call to measure performance  in init_amd_k6() tip-bot for Mikulas Patocka <tipbot@zytor.com> - 2017-07-12 15:20 +0200
    Re: [tip:x86/urgent] x86/cpu: Use indirect call to measure  performance in init_amd_k6() Borislav Petkov <bp@alien8.de> - 2017-07-12 15:50 +0200
      Re: [tip:x86/urgent] x86/cpu: Use indirect call to measure performance  in init_amd_k6() Mikulas Patocka <mpatocka@redhat.com> - 2017-07-13 04:30 +0200
  [tip:x86/urgent] x86/cpu: Use indirect call to measure performance  in init_amd_k6() tip-bot for Mikulas Patocka <tipbot@zytor.com> - 2017-07-16 11:30 +0200

csiph-web