From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753521AbcHAMg0 (ORCPT ); Mon, 1 Aug 2016 08:36:26 -0400 Received: from terminus.zytor.com ([198.137.202.10]:40490 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753338AbcHAMgT (ORCPT ); Mon, 1 Aug 2016 08:36:19 -0400 Date: Mon, 1 Aug 2016 05:34:48 -0700 From: tip-bot for Juergen Gross Message-ID: Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, peterz@infradead.org, alexander.shishkin@linux.intel.com, jgross@suse.com, acme@redhat.com, mingo@kernel.org, jolsa@redhat.com, tglx@linutronix.de, hpa@zytor.com Reply-To: mingo@kernel.org, jgross@suse.com, acme@redhat.com, jolsa@redhat.com, torvalds@linux-foundation.org, peterz@infradead.org, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, hpa@zytor.com, tglx@linutronix.de In-Reply-To: <1470051427-16795-1-git-send-email-jgross@suse.com> References: <1470051427-16795-1-git-send-email-jgross@suse.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/x86: Modify error message in virtualized environment Git-Commit-ID: 005bd0077a79c4bcfe64e7331b275e12f742093f 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: 005bd0077a79c4bcfe64e7331b275e12f742093f Gitweb: http://git.kernel.org/tip/005bd0077a79c4bcfe64e7331b275e12f742093f Author: Juergen Gross AuthorDate: Mon, 1 Aug 2016 13:37:07 +0200 Committer: Ingo Molnar CommitDate: Mon, 1 Aug 2016 14:30:34 +0200 perf/x86: Modify error message in virtualized environment It is known that PMU isn't working in some virtualized environments. Modify the message issued in that case to mention why hardware PMU isn't usable instead of reporting it to be broken. As a side effect this will correct a little bug in the error message: The error message was meant to be either of level err or info depending on the environment (native or virtualized). As the level is taken from the format string and not the printed string, specifying it via %s and a conditional argument didn't work the way intended. Signed-off-by: Juergen Gross Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: acme@kernel.org Link: http://lkml.kernel.org/r/1470051427-16795-1-git-send-email-jgross@suse.com Signed-off-by: Ingo Molnar --- arch/x86/events/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index c17f0de..ba1335d 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -262,10 +262,13 @@ static bool check_hw_exists(void) return true; msr_fail: - pr_cont("Broken PMU hardware detected, using software events only.\n"); - printk("%sFailed to access perfctr msr (MSR %x is %Lx)\n", - boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR, - reg, val_new); + if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) { + pr_cont("PMU not available due to virtualization, using software events only.\n"); + } else { + pr_cont("Broken PMU hardware detected, using software events only.\n"); + pr_err("Failed to access perfctr msr (MSR %x is %Lx)\n", + reg, val_new); + } return false; }