Re: [PATCH 0/2] be2iscsi: Logging neatening

From: Bart Van Assche
Date: Tue Aug 16 2016 - 21:54:46 EST


On 08/14/16 10:29, Joe Perches wrote:
> On Sun, 2016-08-14 at 17:09 +0000, Bart Van Assche wrote:
>> My primary concern is how to enable and disable log messages from user
>> space. Many drivers define their own logging macros and export a bitmask
>> that allows to enable and disable logging messages per category. These
>> bitmask control mechanisms are annoying because figuring out what bit
>> controls which message category requires a search through the driver
>> source code. I'd like to see all these custom logging macros disappear
>> and being replaced by a single mechanism. The "dynamic debug" mechanism
>> e.g. is in my opinion much easier to use than the different custom
>> logging mechanisms.
>
> Dynamic debug doesn't have a bitmask function and
> still requires looking through the code for lines
> and format strings.
>
> I think you are looking for a system wide equivalent
> for the ethtool/netif_<level> mechanism.
>
> Nothing like that exists currently.
>
> Some code uses a bitmask/and, other code uses a
> level/comparison.
>
> Care to propose something?

Hello Joe,

As far as I can see all that the ethtool msglevel API implements is a
mechanism to query and set the log level from user space. What various
SCSI drivers implement is not a log level but a log mask mechanism. How
about the following approach to associate a name with each bit in a log
mask, to export these names to user space and to make it possible to
enable/disable messages per log category:
* Introduce a variant of pr_debug() that allows to specify a textual
representation of the log category (a short string without spaces).
* Make the log category names available in
/sys/kernel/debug/dynamic_debug/...
* Today dynamic debug allows to enable/disable log messages by
specifying the source file name, function name, line number, module
name and/or format string. My proposal is to make it also possible to
enable/disable log messages based on the log category name.

Anyway, this is just a proposal. Anyone is welcome to come up with an
alternative proposal.

Bart.