diff options
author | Juergen Gross <jgross@suse.com> | 2016-08-01 13:37:07 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-08-01 14:30:34 +0200 |
commit | 005bd0077a79c4bcfe64e7331b275e12f742093f (patch) | |
tree | 2bfb6b0be05fc5b7df799e6a78412822094bf3c3 /arch/x86 | |
parent | d761f3ed6e71bcca724a6e9e39efcac65b7b4ac1 (diff) | |
download | lwn-005bd0077a79c4bcfe64e7331b275e12f742093f.tar.gz lwn-005bd0077a79c4bcfe64e7331b275e12f742093f.zip |
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 <jgross@suse.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@kernel.org
Link: http://lkml.kernel.org/r/1470051427-16795-1-git-send-email-jgross@suse.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/events/core.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index c17f0de5fd39..ba1335d16529 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; } |