Skip to content

Commit 005bd00

Browse files
jgross1Ingo Molnar
authored andcommitted
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>
1 parent d761f3e commit 005bd00

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

arch/x86/events/core.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,13 @@ static bool check_hw_exists(void)
262262
return true;
263263

264264
msr_fail:
265-
pr_cont("Broken PMU hardware detected, using software events only.\n");
266-
printk("%sFailed to access perfctr msr (MSR %x is %Lx)\n",
267-
boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR,
268-
reg, val_new);
265+
if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
266+
pr_cont("PMU not available due to virtualization, using software events only.\n");
267+
} else {
268+
pr_cont("Broken PMU hardware detected, using software events only.\n");
269+
pr_err("Failed to access perfctr msr (MSR %x is %Lx)\n",
270+
reg, val_new);
271+
}
269272

270273
return false;
271274
}

0 commit comments

Comments
 (0)