mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Borislav Petkov <bp@alien8.de>
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
Subject: Re: [PATCH] xen/mce: don't issue error message for failed /dev/mcelog registration
Date: Tue, 13 Jun 2017 15:14:53 +0200	[thread overview]
Message-ID: <2b3a43ca-a256-a59a-533d-08fc3a5c9dae@suse.com> (raw)
In-Reply-To: <20170613130216.3iodsfs6ygpxnovk@pd.tnic>

On 13/06/17 15:02, Borislav Petkov wrote:
> On Tue, Jun 13, 2017 at 02:49:21PM +0200, Juergen Gross 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.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>  arch/x86/kernel/cpu/mcheck/dev-mcelog.c | 6 +++++-
>>  drivers/xen/mcelog.c                    | 2 ++
>>  2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c
>> index 9c632cb88546..43fbe2a70051 100644
>> --- a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c
>> +++ b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c
>> @@ -14,6 +14,7 @@
>>  #include <linux/slab.h>
>>  #include <linux/kmod.h>
>>  #include <linux/poll.h>
>> +#include <xen/xen.h>
>>  
>>  #include "mce-internal.h"
>>  
>> @@ -387,10 +388,13 @@ static __init int dev_mcelog_init_device(void)
>>  
>>  	/* register character device /dev/mcelog */
>>  	err = misc_register(&mce_chrdev_device);
>> -	if (err) {
>> +	/* Xen dom0 might have registered the device already. */
>> +	if (err && (err != -EBUSY || !xen_initial_domain() ||
>> +		    !IS_ENABLED(CONFIG_XEN_MCE_LOG))) {
>>  		pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
> 
> Let's simplify that:
> 
> 	if (err) {
> 		if (err == -EBUSY)
> 			const char *s = ", already registered";
> 		else
> 			const char *s = "";
> 
> 		pr_err("Unable to init device /dev/mcelog (rc: %d)%s\n", err, s);

I'd rather avoid the pr_err() in the -EBUSY case. What about:

if (err) {
	if (err == -EBUSY)
		pr_info("Unable to init device /dev/mcelog, already registered");
	else
		pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
}


Juergen

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 12:49 Juergen Gross
2017-06-13 13:02 ` Borislav Petkov
2017-06-13 13:14   ` Juergen Gross [this message]
2017-06-13 13:17     ` Borislav Petkov

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=2b3a43ca-a256-a59a-533d-08fc3a5c9dae@suse.com \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®