From: Andrew Morton <akpm@linux-foundation.org>
To: Grant Erickson <gerickson@nuovations.com>
Cc: linux-kernel@vger.kernel.org, wd@denx.de
Subject: Re: [RFC] Add Alternative Log Buffer Support for printk Messages
Date: Fri, 30 Jan 2009 14:28:25 -0800 [thread overview]
Message-ID: <20090130142825.e63ee797.akpm@linux-foundation.org> (raw)
In-Reply-To: <C5A8B8CD.143B5%gerickson@nuovations.com>
On Fri, 30 Jan 2009 14:01:49 -0800
Grant Erickson <gerickson@nuovations.com> wrote:
> Your summary is precisely the intent. As I
> mentioned in check-in notice, this isn't my work per se, but a fix of prior
> unsubmitted work. Consequently, I can only speculate on the original
> implementation choices of the primary authors (Yuri Tikhonov
> <yur@emcraft.com> on behalf of Denx from what I can ascertain from GIT
> logs). I've added Wolfgang in the event he can add background where
> appropriate.
>
> 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.
>
> > Why not just copy the external buffer's contents into the normal buffer during
> > bootup? ie: printk("%s", external_buffer).
>
> Again, conjecturing, I suspect the goal was to ensure that the boot messages
> appear on the console or in the syslog before kernel messages of that
> particular boot cycle. Depending on the board and architecture in question,
> the kernel log buffer may have several messages in it by the time the log
> coalescing code runs. For example, on the board I tested this on:
>
> # dmesg
> U-Boot 1.3.3 (Jan 9 2009 - 10:24:45)
> POST memory PASSED
> POST ecc PASSED
> POST cache PASSED
> POST ethernet PASSED
> Using Kilauea machine description
> log_buf=fdffc000
> Linux version 2.6.27.7 (gerickson@ubuntu-fusion) (gcc version 4.0.0
> (DENX ELDK 4.1 4.0.0)) #1 Fri Jan 9 10:30:30 PST 2009
It shouldn't be too hard to cook up some way of copying some data into
th log buffer before the kernel itself has put anything in there, if
that's all which is needed.
something similar to this?
include/linux/kernel.h | 2 ++
init/main.c | 6 ++++++
kernel/printk.c | 8 ++++++++
3 files changed, 16 insertions(+)
diff -puN init/main.c~a init/main.c
--- a/init/main.c~a
+++ a/init/main.c
@@ -535,11 +535,17 @@ void __init __weak thread_info_cache_ini
{
}
+void __init __weak arch_copy_boot_messages(void)
+{
+}
+
asmlinkage void __init start_kernel(void)
{
char * command_line;
extern struct kernel_param __start___param[], __stop___param[];
+ arch_copy_boot_messages();
+
smp_setup_processor_id();
/*
diff -puN kernel/printk.c~a kernel/printk.c
--- a/kernel/printk.c~a
+++ a/kernel/printk.c
@@ -493,6 +493,14 @@ static void emit_log_char(char c)
logged_chars++;
}
+void emit_log_string(const char *s)
+{
+ spin_lock_irqsave(&logbuf_lock);
+ while (*s)
+ emit_log_char(*s++);
+ spin_unlock_irqsave(&logbuf_lock);
+}
+
/*
* Zap console related locks when oopsing. Only zap at most once
* every 10 seconds, to leave time for slow consoles to print a
diff -puN include/linux/kernel.h~a include/linux/kernel.h
--- a/include/linux/kernel.h~a
+++ a/include/linux/kernel.h
@@ -257,6 +257,8 @@ static inline bool printk_timed_ratelimi
extern int printk_needs_cpu(int cpu);
extern void printk_tick(void);
+extern void __init arch_copy_boot_messages(void);
+extern void emit_log_string(const char *s);
extern void asmlinkage __attribute__((format(printf, 1, 2)))
early_printk(const char *fmt, ...);
_
next prev parent reply other threads:[~2009-01-30 22:28 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 [this message]
2009-01-31 10:01 ` Wolfgang Denk
2009-01-31 9:59 ` Wolfgang Denk
2009-02-03 1:08 ` Carl-Daniel Hailfinger
-- strict thread matches above, loose matches on Subject: below --
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=20090130142825.e63ee797.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=gerickson@nuovations.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wd@denx.de \
/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