public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Petr Mládek" <pmladek@suse.cz>
To: Alex Elder <elder@linaro.org>
Cc: Kay Sievers <kay@vrfy.org>,
	akpm@linux-foundation.org, bp@suse.de, john.stultz@linaro.org,
	jack@suse.cz, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/5] printk: more log flag simplification
Date: Fri, 18 Jul 2014 11:22:04 +0200	[thread overview]
Message-ID: <20140718092204.GW6774@pathway.suse.cz> (raw)
In-Reply-To: <53C87E5B.2060505@linaro.org>

On Thu 2014-07-17 20:54:35, Alex Elder wrote:
> On 07/17/2014 08:37 PM, Kay Sievers wrote:
> > On Thu, Jul 17, 2014 at 7:59 PM, Alex Elder <elder@linaro.org> wrote:
> >> This series rearranges the log code in such a way that the LOG_CONT
> >> and LOG_PREFIX log record flags can be eliminated entirely.  The
> >> result should be considerably easier to understand than before.  It
> >> builds on another recently-posted series of patches:
> >>     https://lkml.org/lkml/2014/7/17/363
> >>
> >> The first patch exploits the fact that LOG_CONT and LOG_NEWLINE
> >> are inverses, and uses LOG_NEWLINE (or its negation) anywhere
> >> LOG_CONT is used.  As a result, LOG_CONT is no longer needed, so
> >> it's eliminated.

I think that only this part is usable. It would make sense to move it
to the other patch set.

> >> The next three patches together eliminate LOG_PREFIX.  The effect
> >> of LOG_PREFIX is to complete the previous log entry before recording
> >> a new one.  Patch 2 arranges to do this directly, marking the previous
> >> log record with LOG_NEWLINE whenever a new record is presented with
> >> LOG_PREFIX set.  Patch 3 stops saving LOG_PREFIX in any log records,
> >> and patch 4 finally gets rid of LOG_PREFIX.
>>>
> >> The last patch is just some cleanup of the code now that it's gone
> >> through this transformation.

The other patches would break readers. You could not modify older
records because the might already have been proceed.

You would need to add another hacks to the readers. I think that using
LOG_PREFIX is more clear and less hacky.

> > Continuation lines are racy and unreliable by definition, they create
> > a problem that cannot be solved properly, so we need to try to make
> > the best out of it. The idea of the record buffer flags was to record
> > what actually happened when things race against each other. A line
> > without a newline is recorded as a line without a newline.
> 
> Understood.
> 
> > Your simplifying patches changes the code to store how things will
> > *look* like when exported, not what actually *happened*; like it
> > pretends the earlier line had a newline, while that might not have
> > been the case.
> 
> What do you mean by "exported?"  Does the result in syslog
> or /proc/kmsg (or the console for that matter) actually
> differ?  I'll have to look again, but I think they do not.

Yes, they are asynchronous. Each of them has its own speed and
behavior.

Console is like a dog. It tries to process all new messages until
the very last one.

Syslog and kmsg are interfaces that are used by userspace tools,
e.g. syslogd, dmesg. They are asked to read selected part of
the ring buffer, usually the last messages. They might be asked to
seek, read everything again, ...

Syslog and kmsg have to release the logbuf_lock every time they copy
some line to the userspace. This is the time when the ring buffer
might get rotated and they might miss the end of continuous line.


Best Regards,
Petr

      reply	other threads:[~2014-07-18  9:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 17:59 [PATCH 0/5] printk: more log flag simplification Alex Elder
2014-07-17 17:59 ` [PATCH 1/5] printk: kill LOG_CONT Alex Elder
2014-07-17 17:59 ` [PATCH 2/5] printk: update previous message for LOG_PREFIX Alex Elder
2014-07-18  9:02   ` Petr Mládek
2014-07-18 12:04     ` Alex Elder
2014-07-17 17:59 ` [PATCH 3/5] printk: stop actually recording LOG_PREFIX Alex Elder
2014-07-17 17:59 ` [PATCH 4/5] printk: kill LOG_PREFIX Alex Elder
2014-07-17 17:59 ` [PATCH 5/5] printk: rename LOG_NEWLINE and tidy up Alex Elder
2014-07-18  1:37 ` [PATCH 0/5] printk: more log flag simplification Kay Sievers
2014-07-18  1:54   ` Alex Elder
2014-07-18  9:22     ` Petr Mládek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140718092204.GW6774@pathway.suse.cz \
    --to=pmladek@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=elder@linaro.org \
    --cc=jack@suse.cz \
    --cc=john.stultz@linaro.org \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox