[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161024152736.2635492-1-arnd@arndb.de>
Date: Mon, 24 Oct 2016 17:26:37 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Ingo Molnar <mingo@...hat.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Josh Poimboeuf <jpoimboe@...hat.com>,
Borislav Petkov <bp@...e.de>, Andi Kleen <ak@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] perf/x86: always warn about broken BIOS
The intialization function checks for various failure scenarios, but
unfortunately the compiler gets a little confused about the possible
combinations, leading to a false-positive build warning when
-Wmaybe-uninitialized is set:
arch/x86/events/core.c: In function ‘init_hw_perf_events’:
arch/x86/events/core.c:264:3: warning: ‘reg_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
arch/x86/events/core.c:264:3: warning: ‘val_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n",
It seems reasonable to move the check for the broken BIOS a little
higher in the function, which will lead to the kernel warning about
both the BIOS and and broken hardware if both are faulty, but it
has no effect otherwise at runtime.
Moving it ahead of the check for broken hardware however gets rid
of the compile-time warning.
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
arch/x86/events/core.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 76697acdc507..185d3b27e881 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -228,6 +228,15 @@ static bool check_hw_exists(void)
}
/*
+ * We still allow the PMU driver to operate:
+ */
+ if (bios_fail) {
+ pr_cont("Broken BIOS detected, complain to your hardware vendor.\n");
+ pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n",
+ reg_fail, val_fail);
+ }
+
+ /*
* If all the counters are enabled, the below test will always
* fail. The tools will also become useless in this scenario.
* Just fail and disable the hardware counters.
@@ -252,15 +261,6 @@ static bool check_hw_exists(void)
if (ret || val != val_new)
goto msr_fail;
- /*
- * We still allow the PMU driver to operate:
- */
- if (bios_fail) {
- pr_cont("Broken BIOS detected, complain to your hardware vendor.\n");
- pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n",
- reg_fail, val_fail);
- }
-
return true;
msr_fail:
--
2.9.0
Powered by blists - more mailing lists