From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751278AbdGPJUI (ORCPT ); Sun, 16 Jul 2017 05:20:08 -0400 Received: from terminus.zytor.com ([65.50.211.136]:55791 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751048AbdGPJUG (ORCPT ); Sun, 16 Jul 2017 05:20:06 -0400 Date: Sun, 16 Jul 2017 02:14:17 -0700 From: tip-bot for Mikulas Patocka Message-ID: 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 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 In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/cpu: Use indirect call to measure performance in init_amd_k6() 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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();