2008-12-15 23:15:22

by Ben Dooks

[permalink] [raw]
Subject: driver probe error reporting

This runs on from the discussion in [1] on how drivers (especially
one using a variant of the device driver framework) report errors
on probe. There are two main classes of errors, the type which happen
at probe time (device not responding, not enough memory, etc) and
errors that are due to configuration such as missing device configuration
data.

It has been suggested that using dev_err() to report any configuration
data error is a bloat of code as a properly debugged kernel should never
find itself in this state.

Unfortunatley the only diagnostic dev_xxx() macro is dev_dbg() which is
only available if the the driver code itself defines DEBUG. I would think
it would be better to have a macro that can be turned on/off by a kernel
configuration for when debugging which turns on the messages that are
important to developers creating new machine/arch support but disabled
for shipping kernels.

Basically, what are people's thoughts on a "Verbose probe error"
configuration option in the "Kernel hacking" submenu with its own
dev_probe_err() or similar macro?


[1] http://groups.google.com/group/fa.linux.kernel/browse_thread/thread/ce6260537381dd94/7ed3f699db907357?show_docid=7ed3f699db907357

--
Ben ([email protected], http://www.fluff.org/)

'a smiley only costs 4 bytes'


2008-12-17 06:43:23

by Greg KH

[permalink] [raw]
Subject: Re: driver probe error reporting

On Mon, Dec 15, 2008 at 11:15:02PM +0000, Ben Dooks wrote:
> This runs on from the discussion in [1] on how drivers (especially
> one using a variant of the device driver framework) report errors
> on probe. There are two main classes of errors, the type which happen
> at probe time (device not responding, not enough memory, etc) and
> errors that are due to configuration such as missing device configuration
> data.
>
> It has been suggested that using dev_err() to report any configuration
> data error is a bloat of code as a properly debugged kernel should never
> find itself in this state.
>
> Unfortunatley the only diagnostic dev_xxx() macro is dev_dbg() which is
> only available if the the driver code itself defines DEBUG. I would think
> it would be better to have a macro that can be turned on/off by a kernel
> configuration for when debugging which turns on the messages that are
> important to developers creating new machine/arch support but disabled
> for shipping kernels.

Not anymore, dev_dbg() can be dynamically switched on and off at runtime
in 2.6.28.

> Basically, what are people's thoughts on a "Verbose probe error"
> configuration option in the "Kernel hacking" submenu with its own
> dev_probe_err() or similar macro?

It is not needed, see the above :)

thanks,

greg k-h

2008-12-17 12:45:29

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: driver probe error reporting

On Wednesday, 17 of December 2008, Greg KH wrote:
> On Mon, Dec 15, 2008 at 11:15:02PM +0000, Ben Dooks wrote:
> > This runs on from the discussion in [1] on how drivers (especially
> > one using a variant of the device driver framework) report errors
> > on probe. There are two main classes of errors, the type which happen
> > at probe time (device not responding, not enough memory, etc) and
> > errors that are due to configuration such as missing device configuration
> > data.
> >
> > It has been suggested that using dev_err() to report any configuration
> > data error is a bloat of code as a properly debugged kernel should never
> > find itself in this state.
> >
> > Unfortunatley the only diagnostic dev_xxx() macro is dev_dbg() which is
> > only available if the the driver code itself defines DEBUG. I would think
> > it would be better to have a macro that can be turned on/off by a kernel
> > configuration for when debugging which turns on the messages that are
> > important to developers creating new machine/arch support but disabled
> > for shipping kernels.
>
> Not anymore, dev_dbg() can be dynamically switched on and off at runtime
> in 2.6.28.

IMO, there's a problem with that, because it turns on _all_ of the debug info
from the entire kernel, which is _never_ necessary. Almost always you need
debug output for specific subsystem, if not for specific driver, and all of the
superfluous debug data resulting from the "dynamic printk" only makes things
harder.

Thanks,
Rafael

2008-12-17 18:47:29

by Greg KH

[permalink] [raw]
Subject: Re: driver probe error reporting

On Wed, Dec 17, 2008 at 01:44:52PM +0100, Rafael J. Wysocki wrote:
> On Wednesday, 17 of December 2008, Greg KH wrote:
> > On Mon, Dec 15, 2008 at 11:15:02PM +0000, Ben Dooks wrote:
> > > This runs on from the discussion in [1] on how drivers (especially
> > > one using a variant of the device driver framework) report errors
> > > on probe. There are two main classes of errors, the type which happen
> > > at probe time (device not responding, not enough memory, etc) and
> > > errors that are due to configuration such as missing device configuration
> > > data.
> > >
> > > It has been suggested that using dev_err() to report any configuration
> > > data error is a bloat of code as a properly debugged kernel should never
> > > find itself in this state.
> > >
> > > Unfortunatley the only diagnostic dev_xxx() macro is dev_dbg() which is
> > > only available if the the driver code itself defines DEBUG. I would think
> > > it would be better to have a macro that can be turned on/off by a kernel
> > > configuration for when debugging which turns on the messages that are
> > > important to developers creating new machine/arch support but disabled
> > > for shipping kernels.
> >
> > Not anymore, dev_dbg() can be dynamically switched on and off at runtime
> > in 2.6.28.
>
> IMO, there's a problem with that, because it turns on _all_ of the debug info
> from the entire kernel, which is _never_ necessary.

No, it is turned on and off on a per-module basis, not for the whole
kernel (although that is possible if you so desire.)

So this should not be an issue.

thanks,

greg k-h

2008-12-17 21:45:29

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: driver probe error reporting

On Wednesday, 17 of December 2008, Greg KH wrote:
> On Wed, Dec 17, 2008 at 01:44:52PM +0100, Rafael J. Wysocki wrote:
> > On Wednesday, 17 of December 2008, Greg KH wrote:
> > > On Mon, Dec 15, 2008 at 11:15:02PM +0000, Ben Dooks wrote:
> > > > This runs on from the discussion in [1] on how drivers (especially
> > > > one using a variant of the device driver framework) report errors
> > > > on probe. There are two main classes of errors, the type which happen
> > > > at probe time (device not responding, not enough memory, etc) and
> > > > errors that are due to configuration such as missing device configuration
> > > > data.
> > > >
> > > > It has been suggested that using dev_err() to report any configuration
> > > > data error is a bloat of code as a properly debugged kernel should never
> > > > find itself in this state.
> > > >
> > > > Unfortunatley the only diagnostic dev_xxx() macro is dev_dbg() which is
> > > > only available if the the driver code itself defines DEBUG. I would think
> > > > it would be better to have a macro that can be turned on/off by a kernel
> > > > configuration for when debugging which turns on the messages that are
> > > > important to developers creating new machine/arch support but disabled
> > > > for shipping kernels.
> > >
> > > Not anymore, dev_dbg() can be dynamically switched on and off at runtime
> > > in 2.6.28.
> >
> > IMO, there's a problem with that, because it turns on _all_ of the debug info
> > from the entire kernel, which is _never_ necessary.
>
> No, it is turned on and off on a per-module basis, not for the whole
> kernel (although that is possible if you so desire.)
>
> So this should not be an issue.

Well, recently I've been debugging suspend-resume quite a lot and I had to
compile it out. I use verbose PM debugging for that, which is based on
dev_dbg(), and it is very inconvenient with dynamic printk.

Thanks,
Rafael

2008-12-17 22:42:46

by Greg KH

[permalink] [raw]
Subject: Re: driver probe error reporting

On Wed, Dec 17, 2008 at 10:44:34PM +0100, Rafael J. Wysocki wrote:
> On Wednesday, 17 of December 2008, Greg KH wrote:
> > On Wed, Dec 17, 2008 at 01:44:52PM +0100, Rafael J. Wysocki wrote:
> > > On Wednesday, 17 of December 2008, Greg KH wrote:
> > > > On Mon, Dec 15, 2008 at 11:15:02PM +0000, Ben Dooks wrote:
> > > > > This runs on from the discussion in [1] on how drivers (especially
> > > > > one using a variant of the device driver framework) report errors
> > > > > on probe. There are two main classes of errors, the type which happen
> > > > > at probe time (device not responding, not enough memory, etc) and
> > > > > errors that are due to configuration such as missing device configuration
> > > > > data.
> > > > >
> > > > > It has been suggested that using dev_err() to report any configuration
> > > > > data error is a bloat of code as a properly debugged kernel should never
> > > > > find itself in this state.
> > > > >
> > > > > Unfortunatley the only diagnostic dev_xxx() macro is dev_dbg() which is
> > > > > only available if the the driver code itself defines DEBUG. I would think
> > > > > it would be better to have a macro that can be turned on/off by a kernel
> > > > > configuration for when debugging which turns on the messages that are
> > > > > important to developers creating new machine/arch support but disabled
> > > > > for shipping kernels.
> > > >
> > > > Not anymore, dev_dbg() can be dynamically switched on and off at runtime
> > > > in 2.6.28.
> > >
> > > IMO, there's a problem with that, because it turns on _all_ of the debug info
> > > from the entire kernel, which is _never_ necessary.
> >
> > No, it is turned on and off on a per-module basis, not for the whole
> > kernel (although that is possible if you so desire.)
> >
> > So this should not be an issue.
>
> Well, recently I've been debugging suspend-resume quite a lot and I had to
> compile it out. I use verbose PM debugging for that, which is based on
> dev_dbg(), and it is very inconvenient with dynamic printk.

I'm confused, if you enable dynamic printk, it uses dev_dbg(). And then
you can turn it on or off on a per-module basis.

What are you suggesting we do instead?

thanks,

greg k-h

2008-12-17 23:05:31

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: driver probe error reporting

On Wednesday, 17 of December 2008, Greg KH wrote:
> On Wed, Dec 17, 2008 at 10:44:34PM +0100, Rafael J. Wysocki wrote:
> > On Wednesday, 17 of December 2008, Greg KH wrote:
> > > On Wed, Dec 17, 2008 at 01:44:52PM +0100, Rafael J. Wysocki wrote:
> > > > On Wednesday, 17 of December 2008, Greg KH wrote:
> > > > > On Mon, Dec 15, 2008 at 11:15:02PM +0000, Ben Dooks wrote:
> > > > > > This runs on from the discussion in [1] on how drivers (especially
> > > > > > one using a variant of the device driver framework) report errors
> > > > > > on probe. There are two main classes of errors, the type which happen
> > > > > > at probe time (device not responding, not enough memory, etc) and
> > > > > > errors that are due to configuration such as missing device configuration
> > > > > > data.
> > > > > >
> > > > > > It has been suggested that using dev_err() to report any configuration
> > > > > > data error is a bloat of code as a properly debugged kernel should never
> > > > > > find itself in this state.
> > > > > >
> > > > > > Unfortunatley the only diagnostic dev_xxx() macro is dev_dbg() which is
> > > > > > only available if the the driver code itself defines DEBUG. I would think
> > > > > > it would be better to have a macro that can be turned on/off by a kernel
> > > > > > configuration for when debugging which turns on the messages that are
> > > > > > important to developers creating new machine/arch support but disabled
> > > > > > for shipping kernels.
> > > > >
> > > > > Not anymore, dev_dbg() can be dynamically switched on and off at runtime
> > > > > in 2.6.28.
> > > >
> > > > IMO, there's a problem with that, because it turns on _all_ of the debug info
> > > > from the entire kernel, which is _never_ necessary.
> > >
> > > No, it is turned on and off on a per-module basis, not for the whole
> > > kernel (although that is possible if you so desire.)
> > >
> > > So this should not be an issue.
> >
> > Well, recently I've been debugging suspend-resume quite a lot and I had to
> > compile it out. I use verbose PM debugging for that, which is based on
> > dev_dbg(), and it is very inconvenient with dynamic printk.
>
> I'm confused, if you enable dynamic printk, it uses dev_dbg(). And then
> you can turn it on or off on a per-module basis.
>
> What are you suggesting we do instead?

For suspend-resume debugging I need dev_dbg() to work for all devices,
but only in a couple of specific code paths.

Well, I probably could enable it right before suspend and disable right after
the resume. I'll try that and see if I can filter the noise out this way.

Thanks,
Rafael