All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Josh Triplett <josh@joshtriplett.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>,
	"David S. Miller" <davem@davemloft.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"Fabio M. Di Nitto" <fdinitto@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Olaf Hering <olaf@aepfle.de>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Tejun Heo <tj@kernel.org>, "H. Peter Anvin" <hpa@linux.intel.com>,
	Yinghai LU <yinghai@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 0/5] Persist printk buffer across reboots.
Date: Tue, 13 Mar 2012 01:32:32 -0700	[thread overview]
Message-ID: <4F5F0620.2020404@codeaurora.org> (raw)
In-Reply-To: <1331617001-20906-1-git-send-email-apenwarr@gmail.com>

On 3/12/2012 10:36 PM, Avery Pennarun wrote:
> The last patch in this series implements a new CONFIG_PRINTK_PERSIST option
> that, when enabled, puts the printk buffer in a well-defined memory location
> so that we can keep appending to it after a reboot.  The upshot is that,
> even after a kernel panic or non-panic hard lockup, on the next boot
> userspace will be able to grab the kernel messages leading up to it.  It
> could then upload the messages to a server (for example) to keep crash
> statistics.
>
> The preceding patches in the series are mostly just things I fixed up while
> working on that patch.
>
> Some notes:
>
> - I'm not totally sure of the locking or portability issues when calling
>    memblock or bootmem.  This all happens really early, and I *think*
>    interrupts are still disabled at that time, so it's probably okay.
>
> - Tested this version on x86 (kvm) and it works with soft reboot (ie. reboot
>    -f).  Since some BIOSes wipe the memory during boot, you might not have
>    any luck.  It should be great on many embedded systems, though, including
>    the MIPS system I've tested a variant of this patch on.  (Our MIPS build
>    is based on a slightly older kernel so it's not 100% the same, but I think
>    this should behave identically.)
>
> - The way we choose a well-defined memory location is slightly suspicious
>    (we just count down from the top of the address space) but I've tested it
>    pretty carefully, and it seems to be okay.
>
> - In printk.c with CONFIG_PRINTK_PERSIST set, we're #defining words like
>    log_end.  It might be cleaner to replace all instances of log_end with
>    LOG_END to make this more clear.  This is also the reason the struct
>    logbits members start with _: because otherwise they conflict with the
>    macro.  Suggestions welcome.

Android has something similar called ram_console (see 
staging/android/ram_console.c). The console is dumped to a ram buffer 
that is reserved very early in platform setup code. Then when the phone 
reboots you can cat /proc/last_kmsg to get the previous kernel message 
for debugging. Can you use that code?

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Josh Triplett <josh@joshtriplett.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>,
	"David S. Miller" <davem@davemloft.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"Fabio M. Di Nitto" <fdinitto@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Olaf Hering <olaf@aepfle.de>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Tejun Heo <tj@kernel.org>, "H. Peter Anvin" <hpa@linux.intel.com>,
	Yinghai LU <yinghai@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 0/5] Persist printk buffer across reboots.
Date: Tue, 13 Mar 2012 01:32:32 -0700	[thread overview]
Message-ID: <4F5F0620.2020404@codeaurora.org> (raw)
In-Reply-To: <1331617001-20906-1-git-send-email-apenwarr@gmail.com>

On 3/12/2012 10:36 PM, Avery Pennarun wrote:
> The last patch in this series implements a new CONFIG_PRINTK_PERSIST option
> that, when enabled, puts the printk buffer in a well-defined memory location
> so that we can keep appending to it after a reboot.  The upshot is that,
> even after a kernel panic or non-panic hard lockup, on the next boot
> userspace will be able to grab the kernel messages leading up to it.  It
> could then upload the messages to a server (for example) to keep crash
> statistics.
>
> The preceding patches in the series are mostly just things I fixed up while
> working on that patch.
>
> Some notes:
>
> - I'm not totally sure of the locking or portability issues when calling
>    memblock or bootmem.  This all happens really early, and I *think*
>    interrupts are still disabled at that time, so it's probably okay.
>
> - Tested this version on x86 (kvm) and it works with soft reboot (ie. reboot
>    -f).  Since some BIOSes wipe the memory during boot, you might not have
>    any luck.  It should be great on many embedded systems, though, including
>    the MIPS system I've tested a variant of this patch on.  (Our MIPS build
>    is based on a slightly older kernel so it's not 100% the same, but I think
>    this should behave identically.)
>
> - The way we choose a well-defined memory location is slightly suspicious
>    (we just count down from the top of the address space) but I've tested it
>    pretty carefully, and it seems to be okay.
>
> - In printk.c with CONFIG_PRINTK_PERSIST set, we're #defining words like
>    log_end.  It might be cleaner to replace all instances of log_end with
>    LOG_END to make this more clear.  This is also the reason the struct
>    logbits members start with _: because otherwise they conflict with the
>    macro.  Suggestions welcome.

Android has something similar called ram_console (see 
staging/android/ram_console.c). The console is dumped to a ram buffer 
that is reserved very early in platform setup code. Then when the phone 
reboots you can cat /proc/last_kmsg to get the previous kernel message 
for debugging. Can you use that code?

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


  parent reply	other threads:[~2012-03-13  8:32 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13  5:36 [PATCH 0/5] Persist printk buffer across reboots Avery Pennarun
2012-03-13  5:36 ` Avery Pennarun
2012-03-13  5:36 ` [PATCH 1/5] mm: bootmem: BUG() if you try to allocate bootmem too late Avery Pennarun
2012-03-13  5:36   ` Avery Pennarun
2012-03-13  5:36 ` [PATCH 2/5] mm: bootmem: it's okay to reserve_bootmem an invalid address Avery Pennarun
2012-03-13  5:36   ` Avery Pennarun
2012-03-13  5:36 ` [PATCH 3/5] mm: nobootmem: implement reserve_bootmem() in terms of memblock Avery Pennarun
2012-03-13  5:36   ` Avery Pennarun
2012-03-13  5:36 ` [PATCH 4/5] printk: use alloc_bootmem() instead of memblock_alloc() Avery Pennarun
2012-03-13  5:36   ` Avery Pennarun
2012-03-13  6:13   ` Yinghai Lu
2012-03-13  6:13     ` Yinghai Lu
2012-03-13  6:40     ` Avery Pennarun
2012-03-13  6:40       ` Avery Pennarun
2012-03-13  8:26       ` Ingo Molnar
2012-03-13  8:26         ` Ingo Molnar
2012-03-13 21:50       ` Yinghai Lu
2012-03-13 21:50         ` Yinghai Lu
2012-03-14  2:23         ` Avery Pennarun
2012-03-14  2:23           ` Avery Pennarun
2012-03-13  5:36 ` [PATCH 5/5] printk: CONFIG_PRINTK_PERSIST: persist printk buffer across reboots Avery Pennarun
2012-03-13  5:36   ` Avery Pennarun
2012-03-13  5:53 ` [PATCH 0/5] Persist " David Miller
2012-03-13  5:53   ` David Miller
2012-03-13  6:00   ` Avery Pennarun
2012-03-13  6:00     ` Avery Pennarun
2012-03-13  6:50     ` David Miller
2012-03-13  6:50       ` David Miller
2012-03-13  7:14       ` Avery Pennarun
2012-03-13  7:14         ` Avery Pennarun
2012-03-13  7:18         ` David Miller
2012-03-13  7:18           ` David Miller
2012-03-13  8:10           ` Avery Pennarun
2012-03-13  8:10             ` Avery Pennarun
2012-03-13  8:16             ` David Miller
2012-03-13  8:16               ` David Miller
2012-03-13 13:50   ` Peter Zijlstra
2012-03-13 13:50     ` Peter Zijlstra
2012-03-14  1:57     ` Daniel Walker
2012-03-14  1:57       ` Daniel Walker
2012-03-13  8:32 ` Stephen Boyd [this message]
2012-03-13  8:32   ` Stephen Boyd
2012-03-13 17:08 ` Daniel Walker
2012-03-13 17:08   ` Daniel Walker
2012-03-13 22:10   ` Andrew Morton
2012-03-13 22:10     ` Andrew Morton
2012-03-14  2:19     ` Daniel Walker
2012-03-14  2:19       ` Daniel Walker
2012-03-15 22:10       ` Seiji Aguchi
2012-03-15 22:10         ` Seiji Aguchi
2012-03-14  2:21     ` Avery Pennarun
2012-03-14  2:21       ` Avery Pennarun

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=4F5F0620.2020404@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=apenwarr@gmail.com \
    --cc=davem@davemloft.net \
    --cc=fdinitto@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hpa@linux.intel.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=olaf@aepfle.de \
    --cc=paul.gortmaker@windriver.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=tj@kernel.org \
    --cc=yinghai@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.