All of lore.kernel.org
 help / color / mirror / Atom feed
* Lowering the log level in watchdog_dev_register when err==-EBUSY
@ 2017-10-11 17:46 Radu Rendec
  2017-10-11 18:46 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Radu Rendec @ 2017-10-11 17:46 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, linux-kernel

Hello,

In a project I'm working on we have a valid use case where we activate
both the i6300esb and softdog watchdogs. We always activate i6300esb
first (which uses the "legacy" watchdog API) and then softdog. This
gets us two "error" level messages (coming from watchdog_cdev_register)
although softdog falls back to the "new" API and registers its char
device just fine.

Since watchdog_cdev_register/watchdog_dev_register seem to be used only
by watchdog_register_device and the latter always falls back to the
"new" API, I'm thinking about lowering the log level of these messages
when err is -EBUSY. Something along the lines of:

--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -928,11 +928,14 @@ static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno)
                watchdog_miscdev.parent = wdd->parent;
                err = misc_register(&watchdog_miscdev);
                if (err != 0) {
-                       pr_err("%s: cannot register miscdev on minor=%d (err=%d).\n",
-                               wdd->info->identity, WATCHDOG_MINOR, err);
-                       if (err == -EBUSY)
-                               pr_err("%s: a legacy watchdog module is probably present.\n",
-                                       wdd->info->identity);
+                       if (err == -EBUSY) {
+                               pr_info("%s: cannot register miscdev on minor=%d (err=%d).\n",
+                                               wdd->info->identity, WATCHDOG_MINOR, err);
+                               pr_info("%s: a legacy watchdog module is probably present.\n",
+                                               wdd->info->identity);
+                       } else
+                               pr_err("%s: cannot register miscdev on minor=%d (err=%d).\n",
+                                       wdd->info->identity, WATCHDOG_MINOR, err);
                        old_wd_data = NULL;
                        kfree(wd_data);
                        return err;

Does this look like a good approach? If not, what would you recommend?
In any case, I want to upstream the change, so better ask first :)

Thanks,
Radu Rendec

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lowering the log level in watchdog_dev_register when err==-EBUSY
  2017-10-11 17:46 Lowering the log level in watchdog_dev_register when err==-EBUSY Radu Rendec
@ 2017-10-11 18:46 ` Guenter Roeck
  2017-10-12 18:15   ` Radu Rendec
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2017-10-11 18:46 UTC (permalink / raw)
  To: Radu Rendec; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On Wed, Oct 11, 2017 at 06:46:31PM +0100, Radu Rendec wrote:
> Hello,
> 
> In a project I'm working on we have a valid use case where we activate
> both the i6300esb and softdog watchdogs. We always activate i6300esb
> first (which uses the "legacy" watchdog API) and then softdog. This
> gets us two "error" level messages (coming from watchdog_cdev_register)
> although softdog falls back to the "new" API and registers its char
> device just fine.
> 
> Since watchdog_cdev_register/watchdog_dev_register seem to be used only
> by watchdog_register_device and the latter always falls back to the
> "new" API, I'm thinking about lowering the log level of these messages
> when err is -EBUSY. Something along the lines of:
> 
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -928,11 +928,14 @@ static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno)
>                 watchdog_miscdev.parent = wdd->parent;
>                 err = misc_register(&watchdog_miscdev);
>                 if (err != 0) {
> -                       pr_err("%s: cannot register miscdev on minor=%d (err=%d).\n",
> -                               wdd->info->identity, WATCHDOG_MINOR, err);
> -                       if (err == -EBUSY)
> -                               pr_err("%s: a legacy watchdog module is probably present.\n",
> -                                       wdd->info->identity);
> +                       if (err == -EBUSY) {
> +                               pr_info("%s: cannot register miscdev on minor=%d (err=%d).\n",
> +                                               wdd->info->identity, WATCHDOG_MINOR, err);
> +                               pr_info("%s: a legacy watchdog module is probably present.\n",
> +                                               wdd->info->identity);
> +                       } else
> +                               pr_err("%s: cannot register miscdev on minor=%d (err=%d).\n",
> +                                       wdd->info->identity, WATCHDOG_MINOR, err);
>                         old_wd_data = NULL;
>                         kfree(wd_data);
>                         return err;
> 
> Does this look like a good approach? If not, what would you recommend?
> In any case, I want to upstream the change, so better ask first :)
> 

I would suggest to convert the offending driver to use the watchdog subsystem
(and along the line remove the restriction of only supporting a single
instance). You have the hardware, so that should be a straightforward change.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lowering the log level in watchdog_dev_register when err==-EBUSY
  2017-10-11 18:46 ` Guenter Roeck
@ 2017-10-12 18:15   ` Radu Rendec
  2017-10-12 19:54     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Radu Rendec @ 2017-10-12 18:15 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On Wed, 2017-10-11 at 11:46 -0700, Guenter Roeck wrote:
> On Wed, Oct 11, 2017 at 06:46:31PM +0100, Radu Rendec wrote:
> > In a project I'm working on we have a valid use case where we activate
> > both the i6300esb and softdog watchdogs. We always activate i6300esb
> > first (which uses the "legacy" watchdog API) and then softdog. This
> > gets us two "error" level messages (coming from watchdog_cdev_register)
> > although softdog falls back to the "new" API and registers its char
> > device just fine.
> > 
> > Since watchdog_cdev_register/watchdog_dev_register seem to be used only
> > by watchdog_register_device and the latter always falls back to the
> > "new" API, I'm thinking about lowering the log level of these messages
> > when err is -EBUSY.
>
> I would suggest to convert the offending driver to use the watchdog subsystem
> (and along the line remove the restriction of only supporting a single
> instance). You have the hardware, so that should be a straightforward change.

Thanks for the suggestion! That makes sense. I will start working on
converting i6300esb and submit a patch in a few days.

By the way, I don't have the hardware. I'm using it with KVM (Qemu),
but I guess that's good enough since I'm not going to touch any of the
code parts that deal with the hardware.

Radu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lowering the log level in watchdog_dev_register when err==-EBUSY
  2017-10-12 18:15   ` Radu Rendec
@ 2017-10-12 19:54     ` Guenter Roeck
  2017-10-13 10:46       ` Radu Rendec
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2017-10-12 19:54 UTC (permalink / raw)
  To: Radu Rendec; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On Thu, Oct 12, 2017 at 07:15:59PM +0100, Radu Rendec wrote:
> On Wed, 2017-10-11 at 11:46 -0700, Guenter Roeck wrote:
> > On Wed, Oct 11, 2017 at 06:46:31PM +0100, Radu Rendec wrote:
> > > In a project I'm working on we have a valid use case where we activate
> > > both the i6300esb and softdog watchdogs. We always activate i6300esb
> > > first (which uses the "legacy" watchdog API) and then softdog. This
> > > gets us two "error" level messages (coming from watchdog_cdev_register)
> > > although softdog falls back to the "new" API and registers its char
> > > device just fine.
> > > 
> > > Since watchdog_cdev_register/watchdog_dev_register seem to be used only
> > > by watchdog_register_device and the latter always falls back to the
> > > "new" API, I'm thinking about lowering the log level of these messages
> > > when err is -EBUSY.
> >
> > I would suggest to convert the offending driver to use the watchdog subsystem
> > (and along the line remove the restriction of only supporting a single
> > instance). You have the hardware, so that should be a straightforward change.
> 
> Thanks for the suggestion! That makes sense. I will start working on
> converting i6300esb and submit a patch in a few days.
> 
> By the way, I don't have the hardware. I'm using it with KVM (Qemu),
> but I guess that's good enough since I'm not going to touch any of the
> code parts that deal with the hardware.
> 
Ah, interesting. Can you send me the qemu command line ?

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lowering the log level in watchdog_dev_register when err==-EBUSY
  2017-10-12 19:54     ` Guenter Roeck
@ 2017-10-13 10:46       ` Radu Rendec
  0 siblings, 0 replies; 5+ messages in thread
From: Radu Rendec @ 2017-10-13 10:46 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On Thu, 2017-10-12 at 12:54 -0700, Guenter Roeck wrote:
> On Thu, Oct 12, 2017 at 07:15:59PM +0100, Radu Rendec wrote:
> > Thanks for the suggestion! That makes sense. I will start working on
> > converting i6300esb and submit a patch in a few days.
> > 
> > By the way, I don't have the hardware. I'm using it with KVM (Qemu),
> > but I guess that's good enough since I'm not going to touch any of the
> > code parts that deal with the hardware.
> > 
> 
> Ah, interesting. Can you send me the qemu command line ?

Sure, this is as easy as adding "-device i6300esb" to the qemu command
line.

For what is worth, my full command line is:

qemu-system-i386 \
	-enable-kvm \
	-hda fed26.qcow2 \
	-cdrom ~/Downloads/Fedora-Everything-netinst-i386-26-1.5.iso \
	-m 512 \
	-smp 4 \
	-netdev user,id=net0 \
	-netdev tap,id=net1,br=virbr0,helper=/usr/libexec/qemu-bridge-helper \
	-device e1000,netdev=net0 \
	-device e1000,netdev=net1 \
	-device i6300esb

Thanks,
Radu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-13 10:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 17:46 Lowering the log level in watchdog_dev_register when err==-EBUSY Radu Rendec
2017-10-11 18:46 ` Guenter Roeck
2017-10-12 18:15   ` Radu Rendec
2017-10-12 19:54     ` Guenter Roeck
2017-10-13 10:46       ` Radu Rendec

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.