Re: [PATCH] printk: Revert the buffered-printk() changes for now

From: Ingo Molnar
Date: Wed Jun 27 2012 - 01:53:00 EST



* Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> On Mon, Jun 25, 2012 at 10:48:54AM -0400, Steven Rostedt wrote:
> > On Mon, 2012-06-25 at 16:07 +0200, Ingo Molnar wrote:
> >
> > > System logging is an arguably secondary role, and it
> > > should not degrade printk()s primary role.
> >
> > I would argue that printk() should not play the role of
> > normal system logging. It's main role should be for boot up
> > and crashes. If devices need to log information to
> > userspace, it should really use some other means. What was
> > /sys made for anyway?
>
> Specifically not for logging. See the very old discussions of
> this a long time ago (back in the 2.5 days), if you are
> curious.
>
> printk() is the best thing we have for logging as everyone
> uses it and the information in it is exactly what userspace
> wants to know about. Because of that, why wouldn't we use it?

I agree with Greg's point there: the reality is that we have
over 50,000 printk() sites in the kernel, which is a heck of a
good source of system logging information, which we are not
going to change over to some other facility, even if we had some
marginal reasons to do it.

Just consider the life time of printk() call sites: in most
cases it gets added as a debugging printout, as a: "Hey, I just
finished reading Linux Device Drivers, 3rd Edition, and this
best ever Linux driver is now ALIVE!!" tag of success.

Then it gets extended with a few more printouts of unexpected
behavior: "So, if you got here the hardware must be buggy or you
must be doing something stupid, as the driver code sure as heck
is perfect".

Most of the printk()s get removed during productization, but
some actually make sense and remain (and some don't make sense
but just never trigger).

Very few people add printk()s as "inform the system logging
daemon about an event". The prevailing mindset is that perfect
code does not need any logging, so what is left are over 50,000
call sites of bragging and debugging code, occasionally massaged
to be somewhat user friendly.

System logging and tracing in particular can hook off this
mechanism, but we probably aren't going to change the social
role of printk()s overnight (or ever).

> Anyway, your "never buffer printk data" patch looks like the
> right solution here, I'm guessing you are going to respin it
> based on the feedback so far, right?

Acked-by: Ingo Molnar <mingo@xxxxxxxxxx>

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/