[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a7376bd-1a93-1bc2-f7b6-f2a95f641a5d@suse.com>
Date: Tue, 13 Jun 2017 21:27:35 +0200
From: Juergen Gross <jgross@...e.com>
To: Joe Perches <joe@...ches.com>, Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org,
x86@...nel.org, boris.ostrovsky@...cle.com, hpa@...or.com,
tglx@...utronix.de, mingo@...hat.com, tony.luck@...el.com,
bp@...en8.de
Subject: Re: [PATCH v2] xen/mce: don't issue error message for failed
/dev/mcelog registration
On 13/06/17 18:31, Joe Perches wrote:
> On Tue, 2017-06-13 at 18:13 +0200, Juergen Gross wrote:
>> On 13/06/17 17:20, Ingo Molnar wrote:
>>> * Juergen Gross <jgross@...e.com> wrote:
>>>
>>>> When running under Xen as dom0 /dev/mcelog is being registered by Xen
>>>> instead of the normal mcelog driver. Avoid an error message being
>>>> issued by the mcelog driver in this case. Instead issue an informative
>>>> message that Xen has registered the device.
> []
>>>> diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c
> []
>>>> @@ -388,9 +388,16 @@ static __init int dev_mcelog_init_device(void)
>>>> /* register character device /dev/mcelog */
>>>> err = misc_register(&mce_chrdev_device);
>>>> if (err) {
>>>> - pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
>>>> - return err;
>>>> + if (err == -EBUSY)
>>>> + /* Xen dom0 might have registered the device already. */
>>>> + pr_info("Unable to init device /dev/mcelog, already registered");
>>>> + else {
>>>> + pr_err("Unable to init device /dev/mcelog (rc: %d)\n",
>>>> + err);
>>>> + return err;
>>>> + }
>>>
>>> Please only use balanced curly braces in conditional statements.
>>
>> Okay, will change.
>
> Perhaps better is to reverse the test
>
> if (err != -EBUSY) {
> pr_err("Unable to ....", err);
> return err;
> }
> pr_info("etc...");
Okay.
>
> [ rest of code at this indentation ]
>
> but it looks like you added a logic defect too and
> this code should be:
>
> if (err) {
> if (err == -EBUSY)
> pr_info(...)
> else
> pr_err(...)
> return err;
> }
>
> or less indented using
>
> err = misc_register(&mce_chrdev_device);
> if (err == -EBUSY) {
> pr_info(...);
> return err;
> } else if (err) {
> pr_err(...);
> return err;
> }
I didn't want to omit the call to mce_register_decode_chain() in the Xen
case.
Juergen
Powered by blists - more mailing lists