Path: csiph.com!aioe.org!bofh.it!news.nic.it!robomod From: tip-bot for Mikulas Patocka Newsgroups: linux.kernel Subject: [tip:x86/urgent] x86/cpu: Use indirect call to measure performance in init_amd_k6() Date: Sun, 16 Jul 2017 11:30:02 +0200 Message-ID: References: Reply-To: hpa@zytor.com, brgerst@gmail.com, tglx@linutronix.de, luto@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, dvlasenk@redhat.com, torvalds@linux-foundation.org, mpatocka@redhat.com, bp@alien8.de, peterz@infradead.org Git-Commit-ID: 5f8a16156aa1b2d0223eaee9dacdfb9bc096f610 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 44 Organization: linux.* mail to news gateway X-Original-Cc: jpoimboe@redhat.com, tglx@linutronix.de, brgerst@gmail.com, linux-kernel@vger.kernel.org, luto@kernel.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, bp@alien8.de, mpatocka@redhat.com, torvalds@linux-foundation.org, dvlasenk@redhat.com X-Original-Date: Sun, 16 Jul 2017 02:14:17 -0700 X-Original-Message-ID: X-Original-References: X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1688162 Commit-ID: 5f8a16156aa1b2d0223eaee9dacdfb9bc096f610 Gitweb: http://git.kernel.org/tip/5f8a16156aa1b2d0223eaee9dacdfb9bc096f610 Author: Mikulas Patocka AuthorDate: Tue, 11 Jul 2017 07:44:05 -0400 Committer: Ingo Molnar 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 Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/alpine.LRH.2.02.1707110737530.8746@file01.intranet.prod.int.rdu2.redhat.com Signed-off-by: Ingo Molnar --- 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();