[lkml]   [2012]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: proper struct device selection for dev_printk()
On Thu, May 3, 2012 at 8:47 PM, Dmitry Torokhov
<> wrote:
> On Thu, May 03, 2012 at 07:50:52PM +0200, Kay Sievers wrote:

>> I guess it all depends who is the consumer of the messages, and I
>> would say if userspace is the intended consumer, always use the device
>> that provides the access/interface to userspace. It's easy to walk up
>> the tree and find out about the other things.
> This would be:
> 1. Impossible in most cases
> 2. If it was possible it woudl have to be layer violation.

Yeah, if it would be easy, Greg would not have written the mail. :)

> Taking psmouse as an example you have no idea which interface to use to
> report errors - mouse2, event6 or js1 - these are what visible from
> userspace and all of them could report to the same input device.

True, if the error does not propagate up to the class device, it does
not sound right to do that. But it's still the case that userspace or
any automated message consumer cannot make much sense out of the
message then. It's still targeted at a human.

> We
> however know exactly what serio port we had trouble with.

Sure, if the error occurs in that context, it should be logged with
exactly that context. If it propagates up to the higher devices they
should log themselves.

The point I tried to make was, that we should not in general walk up
to the next bus device for logging, and that the parent devices are
not more useful in general. I wanted to express that a rule like: "In
general, drivers should emit messages for the devices they bind to."
is not the right thing to do, if we *can* establish a context to the
device that is used in userspace.

But sure, if the error can not be propagated to the child devices, we
should not fake anything here either, but the stuff should stay where
it happened.

> Now consider error happending on i8042 level. Do we descend into
> serio layer and reportan error there? Why? Serio layer is perfectly
> fine, and besides why would we confuse user that psmouse driver had an
> issue whereas it was i8042 that needs to be looked at?

As said, it all depends on the intended consumer. Messages about
i8042 devices are not interesting at all for userspace or for
automatic log analysis.

> Also, I do not think that vague "userspace" is consumer for these
> messages; this is really something a human needs to look at and analyze.

Right, they are mainly useful for a human being only. So the attached
metadata does not really matter that much.


 \ /
  Last update: 2012-05-03 21:41    [W:0.054 / U:8.236 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site