public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Mikulas Patocka <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:x86/urgent] x86/cpu: Use indirect call to measure performance in init_amd_k6()
Date: Sun, 16 Jul 2017 02:14:17 -0700	[thread overview]
Message-ID: <tip-5f8a16156aa1b2d0223eaee9dacdfb9bc096f610@git.kernel.org> (raw)
In-Reply-To: <alpine.LRH.2.02.1707110737530.8746@file01.intranet.prod.int.rdu2.redhat.com>

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();

      parent reply	other threads:[~2017-07-16  9:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 11:44 [PATCH] x86/kernel/cpu/amd.c: use indirect call Mikulas Patocka
2017-07-12 13:09 ` [tip:x86/urgent] x86/cpu: Use indirect call to measure performance in init_amd_k6() tip-bot for Mikulas Patocka
2017-07-12 13:48   ` Borislav Petkov
2017-07-13  2:20     ` Mikulas Patocka
2017-07-16  9:14 ` tip-bot for Mikulas Patocka [this message]

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=tip-5f8a16156aa1b2d0223eaee9dacdfb9bc096f610@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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