Message ID | 20170620211637.2590-1-bp@alien8.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Borislav, How about skipping the misc_register() steps and keep silence if you know it is running as Dom0 ? as it is easy to know. Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com> On Wed, Jun 21, 2017 at 5:16 AM, Borislav Petkov <bp@alien8.de> wrote: > From: Juergen Gross <jgross@suse.com> > > When running under Xen as dom0, /dev/mcelog is being provided by Xen > instead of the normal mcelog character device of the MCE core. Convert > an error message being issued by the MCE core in this case to an > informative message that Xen has registered the device. > > Signed-off-by: Juergen Gross <jgross@suse.com> > Cc: Tony Luck <tony.luck@intel.com> > Cc: linux-edac <linux-edac@vger.kernel.org> > Cc: x86-ml <x86@kernel.org> > Cc: xen-devel@lists.xenproject.org > Link: http://lkml.kernel.org/r/20170614084059.19294-1-jgross@suse.com > [ Massage a bit. ] > Signed-off-by: Borislav Petkov <bp@suse.de> > --- > arch/x86/kernel/cpu/mcheck/dev-mcelog.c | 8 +++++++- > drivers/xen/mcelog.c | 2 ++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c > index a80427c30c93..10cec43aac38 100644 > --- a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c > +++ b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c > @@ -415,9 +415,15 @@ 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); > + 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; > } > + > mce_register_decode_chain(&dev_mcelog_nb); > return 0; > } > diff --git a/drivers/xen/mcelog.c b/drivers/xen/mcelog.c > index a493c7315e94..6cc1c15bcd84 100644 > --- a/drivers/xen/mcelog.c > +++ b/drivers/xen/mcelog.c > @@ -408,6 +408,8 @@ static int __init xen_late_init_mcelog(void) > if (ret) > goto deregister; > > + pr_info("/dev/mcelog registered by Xen\n"); > + > return 0; > > deregister: > -- > 2.13.0 >
diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c index a80427c30c93..10cec43aac38 100644 --- a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c +++ b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c @@ -415,9 +415,15 @@ 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); + 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; } + mce_register_decode_chain(&dev_mcelog_nb); return 0; } diff --git a/drivers/xen/mcelog.c b/drivers/xen/mcelog.c index a493c7315e94..6cc1c15bcd84 100644 --- a/drivers/xen/mcelog.c +++ b/drivers/xen/mcelog.c @@ -408,6 +408,8 @@ static int __init xen_late_init_mcelog(void) if (ret) goto deregister; + pr_info("/dev/mcelog registered by Xen\n"); + return 0; deregister: