mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Waychison <mikew@google.com>
Cc: Greg KH <greg@kroah.com>,
	torvalds@linux-foundation.org, San Mehat <san@google.com>,
	Aaron Durbin <adurbin@google.com>,
	Duncan Laurie <dlaurie@google.com>,
	linux-kernel@vger.kernel.org, Tim Hockin <thockin@google.com>
Subject: Re: [PATCH v1 5/6] Allow prepending to the dmesg
Date: Mon, 24 Jan 2011 17:01:10 -0800	[thread overview]
Message-ID: <20110124170110.d204c0e9.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110125002459.12637.56291.stgit@mike.mtv.corp.google.com>

On Mon, 24 Jan 2011 16:25:00 -0800
Mike Waychison <mikew@google.com> wrote:

> The next patch in this series (Memory Console driver) would like to
> prepend firmware messages to the kernel logs.

I went to the changelog for "Memory Console driver" to work out why it
wants to do prepending, but it didn't tell me.

> Instead of exposing all the nitty gritty lock details of the kernel's
> printk system to the entire kernel, expose a "prepend_to_dmesg()" that
> attempts to rewrite the in-memory dmesg to inject pre-kernel messages.
> 
> This function only prepends if the start of the kernel's messages are
> still in the ring and there is still room for messages (without losing
> the current tail of the message log).  We determine this by checking out
> whether the bufer has yet been cleared (indicated by a new flag:
> buffer_has_cleared), and by checking whether the buffer is less than
> full (which would indicate that it had wrapped).
> 
> If there is enough room to prepend data, we simply shift the existing
> log contents down and copy into the buffer the tail of the prepended
> data that fits.
> 
> Signed-off-by: Mike Waychison <mikew@google.com>
> ---
>  include/linux/printk.h |    5 ++++
>  kernel/printk.c        |   55 +++++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 59 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index ee048e7..df89965 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -113,6 +113,7 @@ extern int dmesg_restrict;
>  extern int kptr_restrict;
>  
>  void log_buf_kexec_setup(void);
> +void prepend_to_dmesg(const char *buffer, size_t length);

Should have the __init tag in the declaration (can fix link problems on
weird architectures).

>  #else
>  static inline __attribute__ ((format (printf, 1, 0)))
>  int vprintk(const char *s, va_list args)
> @@ -137,6 +138,10 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies,
>  static inline void log_buf_kexec_setup(void)
>  {
>  }
> +
> +void prepend_to_dmesg(const char *buffer, size_t length)
> +{
> +}

Didn't this cause the linker to detect multiple definitions of
prepend_to_dmesg()?

Should be static inline void, or __init and not-inlined in a .c file.

>  #endif
>  
> ...

  reply	other threads:[~2011-01-25  1:01 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25  0:24 [PATCH v1 0/6] google firmware support Mike Waychison
2011-01-25  0:24 ` [PATCH v1 1/6] Add oops notification chain Mike Waychison
2011-01-25  2:06   ` Greg KH
2011-01-25 20:01     ` Mike Waychison
2011-01-25 21:36       ` Jeff Garzik
2011-01-25 21:43         ` Aaron Durbin
2011-01-25 21:54           ` Jeff Garzik
2011-01-25 22:21             ` Aaron Durbin
2011-01-26  2:48               ` Greg KH
2011-01-26 21:50                 ` Mike Waychison
2011-01-25  0:24 ` [PATCH v1 2/6] Introduce CONFIG_GOOGLE_FIRMWARE Mike Waychison
2011-01-25  0:24 ` [PATCH v1 3/6] driver: Google EFI SMI Mike Waychison
2011-01-25  3:17   ` Greg KH
2011-01-25 23:12     ` Mike Waychison
2011-01-26  2:46       ` Greg KH
2011-01-26 23:58         ` Mike Waychison
2011-01-27  1:22           ` Mike Waychison
2011-01-27 23:41             ` Mike Waychison
2011-01-28  2:56               ` Greg KH
2011-02-20  4:44               ` Matt Domsch
2011-02-21 13:58                 ` Matthew Garrett
2011-01-27 10:43           ` Alan Cox
2011-01-27 19:22             ` Mike Waychison
2011-01-28  2:55               ` Greg KH
2011-01-28  2:59           ` Greg KH
2011-01-25  0:24 ` [PATCH v1 4/6] driver: Google Bootlog Mike Waychison
2011-01-25  0:49   ` Alan Cox
2011-01-25  1:38     ` Mike Waychison
2011-01-25  9:43       ` Alan Cox
2011-01-25  0:25 ` [PATCH v1 5/6] Allow prepending to the dmesg Mike Waychison
2011-01-25  1:01   ` Andrew Morton [this message]
2011-01-25  0:25 ` [PATCH v1 6/6] driver: Google Memory Console Mike Waychison
2011-01-25  2:00   ` Greg KH
2011-01-25  3:01 ` [PATCH v1 0/6] google firmware support Greg KH
2011-01-25 19:58   ` Mike Waychison
2011-01-26  2:47     ` Greg KH

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=20110124170110.d204c0e9.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adurbin@google.com \
    --cc=dlaurie@google.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikew@google.com \
    --cc=san@google.com \
    --cc=thockin@google.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®