linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: Grant Erickson <gerickson@nuovations.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] Add Alternative Log Buffer Support for printk Messages
Date: Sat, 31 Jan 2009 10:59:01 +0100	[thread overview]
Message-ID: <20090131095901.E1D1583644C3@gemini.denx.de> (raw)
In-Reply-To: <C5A8B8CD.143B5%gerickson@nuovations.com>

Dear Grant & Andrew,

In message <C5A8B8CD.143B5%gerickson@nuovations.com> you wrote:
>
> > We have an external log buffer, into which stuff was written by (say)
> > the boot prom code.

Correct. Typically we use this in U-Boot to pass Power-On Self Test
results to applications running under Linux, using the standard syslog
tools.

Another are of use is to save the log buffer over a reset (crash)  of
the  system,  so  that  it can be read either rom the boot loader or,
after a reboot, from Linux.

> > We want that to come out on the console during bootup.

Not necessarily. The main function is to feed it into the syslog
processing.

> > So what we do is to divert the normal printk log buffer so that it
> > starts writing at the tail of that existing external buffer.  We emit
> > the entire buffer some time during bootup.  We henceforth continue to
> > use that external buffer in the normal manner. If so, why do it this way?

Do you have a better approach how to share  the  log  buffer  between
Linux  and  a boot loader in such a way that the content will survive
crahses and reboots?


> I believe this to be a useful feature for the embedded system space;
> however, I am not wedded in any way to the current implementation and am
> happy to evolve it as needed to meet the needs of key stakeholders.

Indeed we use this heavily in embedded systems, mainly to process POST
results under Linux (for example, to disable certain functions when
the POST results indicate hardware issues, etc.).

> > Why not just copy the external buffer's contents into the normal buffer during
> > bootup?  ie: printk("%s", external_buffer).

For two reasons:

1) Additional copy operation (ok, that's cheap).

2) We would lose the capability that the buffer content even survives 
   a reset / crash / reboot.

   This is a feature can be very useful in embedded systems where
   there is (at least normally) nobody looking at any console
   messages; being able to see the kernel's crash messages after a
   reboot in the normal syslog messages can be really helpful.

> > I think a quite bad part of this feature is that it renders the
> > kernel's log_buf_len boot parameter (and its Kconfig defult)
> > ineffective.  That's a pretty useful feature - people often set it to
> > 1MB or more during problem diagnosis, and the new unalterable 16kbytes
> > is very very small.

Yes, we are aware of this, but it's a compromise. Basicly it depends
on hardware capabilities. In most cases, it is sufficient to keep the
syslog buffer in RAM. But if you really have to guarantee that the
content of the buffer remains stable, this cannot be used because
during a processor reset there will be usually a too long pause until
the memory controller gets re-initialized and RAM refresh continues -
we might lose data in this time. In most cases it just works fine,
but it's out of spec. In such situations, when such a guarantee is
needed, we can use any SRAM that may be available on the board, or we
can use some on-chip-memory (OCM, basicly also SRAM) that might be on
the processor.

The OCM on the processors in question is 16 kB, hence the limitation
there.


But note that the code is general enough to support the other options
(other, bigger SRAM, or arbitrarily sized buffer in RAM), too.

> Agreed; however, I'm not sure how often this technique is employed in
> embedded systems versus desktop systems.

I haven't seen this ever used in desktop systems yet. And I doubt if
there is any x86 with a boot loader that supports somehting like this.

But there is for example a pretty large number of mobile cranes all
ove rthe workd which are using this feature :-)

> I'd be happy to keep the existing log buffer and perform a prepend from the
> boot buffer to it rather than an append of the kernel buffer to the boot
> buffer. Thoughts?

Please don't - this would implement only the way to pass the buffer
from the boot loader too Linux, but not the way back.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
What we anticipate seldom occurs;  what  we  least  expect  generally
happens.                                          - Bengamin Disraeli

  parent reply	other threads:[~2009-01-31  9:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21 17:39 [RFC] Add Alternative Log Buffer Support for printk Messages Grant Erickson
2009-01-21 20:37 ` David Miller
2009-01-27 13:36 ` Carl-Daniel Hailfinger
2009-01-30 19:51 ` Andrew Morton
2009-01-30 22:01   ` Grant Erickson
2009-01-30 22:28     ` Andrew Morton
2009-01-31 10:01       ` Wolfgang Denk
2009-01-31  9:59     ` Wolfgang Denk [this message]
2009-02-03  1:08       ` Carl-Daniel Hailfinger
2009-02-18 21:27 Timo Juhani Lindfors
     [not found] <49D17E5D.30306@gmx.net>
2009-03-31 15:58 ` Grant Erickson

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=20090131095901.E1D1583644C3@gemini.denx.de \
    --to=wd@denx.de \
    --cc=akpm@linux-foundation.org \
    --cc=gerickson@nuovations.com \
    --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;
as well as URLs for NNTP newsgroup(s).