public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Changli Gao <xiaosuo@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: memconsole: a virtual console to record the Oops message for debugging purpose.
Date: Sun, 21 Jun 2009 08:58:44 +0200	[thread overview]
Message-ID: <20090621065844.GC1810@ucw.cz> (raw)
In-Reply-To: <412e6f7f0906131829y6e0abb00j85e221f92ab439d2@mail.gmail.com>

On Sun 2009-06-14 09:29:48, Changli Gao wrote:
> Dear Linus:
> 
> In the production environment, it is hard to find the causion of an
> Oops message if a bug causes the kernel panics. Though the Oops
> message is printed on the screen, we can't read the whole message in
> most cases due to the size of the screen, and it is hard to save the
> Oops message for debugging. I know kdump is a choice, but it needs
> more memory, and in most cases, Oops messages are enough to find out
> the bugs. The other choices are netconsole and serial line, but they
> both need extra computers.
> 
> memconsole as a virtual console, will save the messages into a block
> of boot memory reserved. Because the memory won't be cleaned(if the
> self-check on memory is disabled) between two starts, the oops
> messages as the other console messages will be saved between them, and
> you have a chance to see what happened in the last start.
> 
> In order to avoid the corruption of the memory used by memconsole, I
> find the memory from the end to the start.
> 
> Here is the code, and the code is mess currently. Am I in the right
> direction? Are my assumptions right?
> 
> the following code is appended to the file mm/bootmem.c

Generate proper patch...

> void *memconsole_mem_start = NULL;
> EXPORT_SYMBOL_GPL(memconsole_mem_start);
> unsigned int memconsole_mem_size = 0;
> EXPORT_SYMBOL_GPL(memconsole_mem_size);
> 
> static int __init memconsole_setup(char *str)
> {
>         unsigned long start;
> 
>         memconsole_mem_size = simple_strtoul(str, NULL, 10);
>         memconsole_mem_size = PAGE_ALIGN(memconsole_mem_size);
>         for (start = max_low_pfn - (memconsole_mem_size >> PAGE_SHIFT);
>              start >= min_low_pfn;
>              start -= (memconsole_mem_size >> PAGE_SHIFT)) {
>                 if (reserve_bootmem_generic(start << PAGE_SHIFT,
>                                             memconsole_mem_size,
>                                             BOOTMEM_EXCLUSIVE) >= 0)
>                         break;
>         }
>         if (start < min_low_pfn)
>                 panic("Can't reserve bootmem for memconsole\n");
>         memconsole_mem_start = phys_to_virt(start << PAGE_SHIFT);
>         printk("reserve bootmem for memconsole %u@%p\n",
>                memconsole_mem_size, memconsole_mem_start);
> 
>         return 1;
> }
> __setup("memconsole=", memconsole_setup);
> 
> An individual kernel module is used to implement the whole function.

> Certainly, I tested it on my virtual machine, and I did work.

...and test it on real hw...?
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2009-06-21  7:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-14  1:29 memconsole: a virtual console to record the Oops message for debugging purpose Changli Gao
2009-06-15  7:11 ` Amerigo Wang
2009-06-15  8:07   ` Changli Gao
2009-06-15  8:45     ` Américo Wang
2009-06-21  6:58 ` Pavel Machek [this message]
2009-06-21 13:14   ` Changli Gao

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=20090621065844.GC1810@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=xiaosuo@gmail.com \
    /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