All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Juergen Gross <jgross@suse.com>, Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	x86@kernel.org, boris.ostrovsky@oracle.com, hpa@zytor.com,
	tglx@linutronix.de, mingo@redhat.com, tony.luck@intel.com,
	bp@alien8.de
Subject: Re: [PATCH v2] xen/mce: don't issue error message for failed /dev/mcelog registration
Date: Tue, 13 Jun 2017 12:30:23 -0700	[thread overview]
Message-ID: <1497382223.18751.23.camel@perches.com> (raw)
In-Reply-To: <3a7376bd-1a93-1bc2-f7b6-f2a95f641a5d@suse.com>

On Tue, 2017-06-13 at 21:27 +0200, Juergen Gross wrote:
> 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@suse.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.

You should definitely mention that behavior change
in the changelog.

  reply	other threads:[~2017-06-13 19:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 13:45 [PATCH v2] xen/mce: don't issue error message for failed /dev/mcelog registration Juergen Gross
2017-06-13 15:20 ` Ingo Molnar
2017-06-13 15:20 ` Ingo Molnar
2017-06-13 16:13   ` Juergen Gross
2017-06-13 16:31     ` Joe Perches
2017-06-13 16:31     ` Joe Perches
2017-06-13 19:27       ` Juergen Gross
2017-06-13 19:27       ` Juergen Gross
2017-06-13 19:30         ` Joe Perches [this message]
2017-06-14  7:49           ` Juergen Gross
2017-06-14  7:49           ` Juergen Gross
2017-06-13 19:30         ` Joe Perches
2017-06-13 16:13   ` Juergen Gross
  -- strict thread matches above, loose matches on Subject: below --
2017-06-13 13:45 Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497382223.18751.23.camel@perches.com \
    --to=joe@perches.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.