* [PATCH] x86/mce: Fix initialization error warning
@ 2017-01-16 21:49 Prarit Bhargava
2017-01-16 21:56 ` Thomas Gleixner
2017-01-16 21:56 ` Borislav Petkov
0 siblings, 2 replies; 11+ messages in thread
From: Prarit Bhargava @ 2017-01-16 21:49 UTC (permalink / raw)
To: linux-kernel
Cc: Prarit Bhargava, Tony Luck, Borislav Petkov, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, x86, linux-edac
When booting kernel with mce=off a loud warning from the mce code
is displayed. This causes confusion for end users.
Add a check to see if MCE is available before outputting the warning
message.
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-edac@vger.kernel.org
---
arch/x86/kernel/cpu/mcheck/mce.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 00ef43233e03..943a0c440c55 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2662,7 +2662,8 @@ static __init int mcheck_init_device(void)
free_cpumask_var(mce_device_initialized);
err_out:
- pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
+ if (mce_available(&boot_cpu_data))
+ pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
return err;
}
--
1.7.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 21:49 [PATCH] x86/mce: Fix initialization error warning Prarit Bhargava
@ 2017-01-16 21:56 ` Thomas Gleixner
2017-01-16 21:56 ` Borislav Petkov
1 sibling, 0 replies; 11+ messages in thread
From: Thomas Gleixner @ 2017-01-16 21:56 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, Tony Luck, Borislav Petkov, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On Mon, 16 Jan 2017, Prarit Bhargava wrote:
> When booting kernel with mce=off a loud warning from the mce code
> is displayed. This causes confusion for end users.
>
> Add a check to see if MCE is available before outputting the warning
> message.
Sigh.
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: linux-edac@vger.kernel.org
> ---
> arch/x86/kernel/cpu/mcheck/mce.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index 00ef43233e03..943a0c440c55 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -2662,7 +2662,8 @@ static __init int mcheck_init_device(void)
> free_cpumask_var(mce_device_initialized);
>
> err_out:
> - pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
> + if (mce_available(&boot_cpu_data))
> + pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
This is really crap. Why would you check the same condition twice? Just
because it's so much more complicated than doing the obvious:
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2615,10 +2615,8 @@ static __init int mcheck_init_device(voi
enum cpuhp_state hp_online;
int err;
- if (!mce_available(&boot_cpu_data)) {
- err = -EIO;
- goto err_out;
- }
+ if (!mce_available(&boot_cpu_data))
+ return -EIO;
if (!zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL)) {
err = -ENOMEM;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 21:49 [PATCH] x86/mce: Fix initialization error warning Prarit Bhargava
2017-01-16 21:56 ` Thomas Gleixner
@ 2017-01-16 21:56 ` Borislav Petkov
2017-01-16 22:06 ` Prarit Bhargava
1 sibling, 1 reply; 11+ messages in thread
From: Borislav Petkov @ 2017-01-16 21:56 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, Tony Luck, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On Mon, Jan 16, 2017 at 04:49:41PM -0500, Prarit Bhargava wrote:
> When booting kernel with mce=off a loud warning from the mce code
> is displayed. This causes confusion for end users.
Is this what you call a loud warning?
[ 1.885648] mce: Unable to init device /dev/mcelog (rc: -5)
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 21:56 ` Borislav Petkov
@ 2017-01-16 22:06 ` Prarit Bhargava
2017-01-16 22:43 ` Borislav Petkov
0 siblings, 1 reply; 11+ messages in thread
From: Prarit Bhargava @ 2017-01-16 22:06 UTC (permalink / raw)
To: Borislav Petkov
Cc: linux-kernel, Tony Luck, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On 01/16/2017 04:56 PM, Borislav Petkov wrote:
> On Mon, Jan 16, 2017 at 04:49:41PM -0500, Prarit Bhargava wrote:
>> When booting kernel with mce=off a loud warning from the mce code
>> is displayed. This causes confusion for end users.
>
> Is this what you call a loud warning?
>
> [ 1.885648] mce: Unable to init device /dev/mcelog (rc: -5)
Yes, it was loud enough to generate a bug report from a user.
FWIW, I just found this from last year calling the same message "scary". It
doesn't look like there was a follow up though.
https://lkml.org/lkml/2016/2/9/354
P.
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 22:06 ` Prarit Bhargava
@ 2017-01-16 22:43 ` Borislav Petkov
2017-01-16 23:13 ` Prarit Bhargava
0 siblings, 1 reply; 11+ messages in thread
From: Borislav Petkov @ 2017-01-16 22:43 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, Tony Luck, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On Mon, Jan 16, 2017 at 05:06:02PM -0500, Prarit Bhargava wrote:
> Yes, it was loud enough to generate a bug report from a user.
Yeah, because all users are sane and we should do whatever they want -
no questions asked. Especially those who boot with "mce=off".
Did you actually ask that user why she/he is even booting with
"mce=off"?
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 22:43 ` Borislav Petkov
@ 2017-01-16 23:13 ` Prarit Bhargava
2017-01-16 23:32 ` Borislav Petkov
0 siblings, 1 reply; 11+ messages in thread
From: Prarit Bhargava @ 2017-01-16 23:13 UTC (permalink / raw)
To: Borislav Petkov
Cc: linux-kernel, Tony Luck, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On 01/16/2017 05:43 PM, Borislav Petkov wrote:
> On Mon, Jan 16, 2017 at 05:06:02PM -0500, Prarit Bhargava wrote:
>> Yes, it was loud enough to generate a bug report from a user.
>
> Yeah, because all users are sane and we should do whatever they want -
> no questions asked. Especially those who boot with "mce=off".
>
> Did you actually ask that user why she/he is even booting with
> "mce=off"?
Yes, mce=off is the default for kdump:
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory
mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail
acpi_no_memhotplug transparent_hugepage=never"
There is a race condition between NMI completing on a CPU and the MCE
synchronization timing out that results in a kernel panic on the kdump kernel,
and a loss of the dump image. There have been a few attempts to fix it over the
years. It seems as simple as setting a flag in native_machine_crash_shutdown()
and querying it in do_machine_check() to avoid mce & nmi race.
P.
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 23:13 ` Prarit Bhargava
@ 2017-01-16 23:32 ` Borislav Petkov
2017-01-16 23:50 ` Prarit Bhargava
2017-01-17 8:34 ` Thomas Gleixner
0 siblings, 2 replies; 11+ messages in thread
From: Borislav Petkov @ 2017-01-16 23:32 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, Tony Luck, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On Mon, Jan 16, 2017 at 06:13:39PM -0500, Prarit Bhargava wrote:
> Yes, mce=off is the default for kdump:
So fix kdump to disable MCA properly instead of sending me brown paper
bags.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 23:32 ` Borislav Petkov
@ 2017-01-16 23:50 ` Prarit Bhargava
2017-01-17 8:34 ` Thomas Gleixner
1 sibling, 0 replies; 11+ messages in thread
From: Prarit Bhargava @ 2017-01-16 23:50 UTC (permalink / raw)
To: Borislav Petkov
Cc: linux-kernel, Tony Luck, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, linux-edac, Don Zickus
On 01/16/2017 06:32 PM, Borislav Petkov wrote:
> On Mon, Jan 16, 2017 at 06:13:39PM -0500, Prarit Bhargava wrote:
>> Yes, mce=off is the default for kdump:
>
> So fix kdump to disable MCA properly instead of sending me brown paper
> bags.
Sure, I'll take a shot at it.
Thanks,
P.
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-16 23:32 ` Borislav Petkov
2017-01-16 23:50 ` Prarit Bhargava
@ 2017-01-17 8:34 ` Thomas Gleixner
2017-01-17 9:08 ` Borislav Petkov
1 sibling, 1 reply; 11+ messages in thread
From: Thomas Gleixner @ 2017-01-17 8:34 UTC (permalink / raw)
To: Borislav Petkov
Cc: Prarit Bhargava, linux-kernel, Tony Luck, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On Tue, 17 Jan 2017, Borislav Petkov wrote:
> On Mon, Jan 16, 2017 at 06:13:39PM -0500, Prarit Bhargava wrote:
> > Yes, mce=off is the default for kdump:
>
> So fix kdump to disable MCA properly instead of sending me brown paper
> bags.
That's one thing, but OTOH we really can avoid the KERN_ERR level print out
for the case where mce is not available (for whatever reasons: HW / Virt /
command line ....).
The simple 2 liner I posted earlier in this thread does it nicely.
Thanks,
tglx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-17 8:34 ` Thomas Gleixner
@ 2017-01-17 9:08 ` Borislav Petkov
2017-01-17 9:09 ` Thomas Gleixner
0 siblings, 1 reply; 11+ messages in thread
From: Borislav Petkov @ 2017-01-17 9:08 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Prarit Bhargava, linux-kernel, Tony Luck, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On Tue, Jan 17, 2017 at 09:34:18AM +0100, Thomas Gleixner wrote:
> That's one thing, but OTOH we really can avoid the KERN_ERR level print out
> for the case where mce is not available (for whatever reasons: HW / Virt /
> command line ....).
>
> The simple 2 liner I posted earlier in this thread does it nicely.
Well, I seem to remember at the time of this:
9c15a24b038f ("x86/mce: Improve mcheck_init_device() error handling")
that I requested to have that error message there so that we *know* when
that function fails instead of trying to decipher "Hey, mcelog doesn't
start here" and wonder why.
But we can kill it just as well, especially as there's patch deprecating
/dev/mcelog floating around. We can reorg error messages in that
function later, if deemed necessary.
So sure.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/mce: Fix initialization error warning
2017-01-17 9:08 ` Borislav Petkov
@ 2017-01-17 9:09 ` Thomas Gleixner
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Gleixner @ 2017-01-17 9:09 UTC (permalink / raw)
To: Borislav Petkov
Cc: Prarit Bhargava, linux-kernel, Tony Luck, Ingo Molnar,
H. Peter Anvin, x86, linux-edac
On Tue, 17 Jan 2017, Borislav Petkov wrote:
> On Tue, Jan 17, 2017 at 09:34:18AM +0100, Thomas Gleixner wrote:
> > That's one thing, but OTOH we really can avoid the KERN_ERR level print out
> > for the case where mce is not available (for whatever reasons: HW / Virt /
> > command line ....).
> >
> > The simple 2 liner I posted earlier in this thread does it nicely.
>
> Well, I seem to remember at the time of this:
>
> 9c15a24b038f ("x86/mce: Improve mcheck_init_device() error handling")
>
> that I requested to have that error message there so that we *know* when
> that function fails instead of trying to decipher "Hey, mcelog doesn't
> start here" and wonder why.
>
> But we can kill it just as well, especially as there's patch deprecating
> /dev/mcelog floating around. We can reorg error messages in that
> function later, if deemed necessary.
Your decision.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-01-17 9:10 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 21:49 [PATCH] x86/mce: Fix initialization error warning Prarit Bhargava
2017-01-16 21:56 ` Thomas Gleixner
2017-01-16 21:56 ` Borislav Petkov
2017-01-16 22:06 ` Prarit Bhargava
2017-01-16 22:43 ` Borislav Petkov
2017-01-16 23:13 ` Prarit Bhargava
2017-01-16 23:32 ` Borislav Petkov
2017-01-16 23:50 ` Prarit Bhargava
2017-01-17 8:34 ` Thomas Gleixner
2017-01-17 9:08 ` Borislav Petkov
2017-01-17 9:09 ` Thomas Gleixner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.