All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Simon Kagstrom <simon.kagstrom@netinsight.net>
Cc: Artem.Bityutskiy@nokia.com,
	linux-mtd <linux-mtd@lists.infradead.org>,
	Aaro Koskinen <aaro.koskinen@nokia.com>
Subject: Re: [PATCH 2/3]: mtdoops: Use panic_write if panic_on_oops is set
Date: Sun, 11 Oct 2009 09:00:20 +0300	[thread overview]
Message-ID: <1255240820.3359.33.camel@localhost> (raw)
In-Reply-To: <1254979692.3359.32.camel@localhost>

On Thu, 2009-10-08 at 08:28 +0300, Artem Bityutskiy wrote:
> On Fri, 2009-10-02 at 16:06 +0200, Simon Kagstrom wrote:
> > mtdoops will not store the oops if panic_on_oops is set. This patch
> > makes use of panic_write if panic_on_oops is set. mtdoops_inc_counter is
> > also not good to call on panics, since the call to mtd->read suspends
> > the panic (at least with my NAND flash), so defer that. There is also no
> > point in doing it since we cannot recover from the panic anyway.
> > 
> > panic_on_oops is not exported to modules, so make mtdoops in-kernel only
> > 
> > Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
> > ---
> >  drivers/mtd/Kconfig   |    2 +-
> >  drivers/mtd/mtdoops.c |    8 ++++++--
> >  2 files changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
> > index ecf90f5..6b39a8b 100644
> > --- a/drivers/mtd/Kconfig
> > +++ b/drivers/mtd/Kconfig
> > @@ -305,7 +305,7 @@ config SSFDC
> >  	  flash. You can mount it with FAT file system.
> >  
> >  config MTD_OOPS
> > -	tristate "Log panic/oops to an MTD buffer"
> > +	bool "Log panic/oops to an MTD buffer"
> >  	depends on MTD
> >  	help
> >  	  This enables panic and oops messages to be logged to a circular
> > diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
> > index 244582c..cc2c187 100644
> > --- a/drivers/mtd/mtdoops.c
> > +++ b/drivers/mtd/mtdoops.c
> > @@ -215,7 +215,11 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic)
> >  		printk(KERN_ERR "mtdoops: Write failure at %d (%td of %d written), err %d.\n",
> >  			cxt->nextpage * cxt->page_size, retlen,	cxt->page_size, ret);
> >  
> > -	mtdoops_inc_counter(cxt);
> > +	/* Go to next page, but skip this if we are currently panicking.
> > +	 * We will not recover from that anyway, and the mtd->read call
> > +	 * causes the panic to suspend */
> > +	if (!in_interrupt() && !panic_on_oops)
> > +		mtdoops_inc_counter(cxt);
> 
> Hmm, what if we are in an oops we want to write more than one time,
> because the oops output is large? With this change we will write twice
> to the same flash area in that case, which is bad.
> 
> Basically, if you skip 'mtdoops_inc_counter()', you should disallow any
> further mtdoops writes, so you need something like 'ctx->i_am_screwed'
> flag, I guess.
> 
> Also, I think this kind of check should be inside
> 'mtdoops_inc_counter()', not outside. It is just cleaner.
> 
> BTW, 'mtdoops_inc_counter()' reads flash before each write, which is
> strange. If an eraseblock was erased, everything is 0xFFed there. Why
> not to maintain an internal array which contains erased/not erased
> status of each eraseblock?
> 
> > @@ -340,7 +344,7 @@ static void mtdoops_console_sync(void)
> >  	cxt->ready = 0;
> >  	spin_unlock_irqrestore(&cxt->writecount_lock, flags);
> >  
> > -	if (mtd->panic_write && in_interrupt())
> > +	if (mtd->panic_write && (in_interrupt() || panic_on_oops))
> >  		/* Interrupt context, we're going to panic so try and log */
> >  		mtdoops_write(cxt, 1);

Oh, panic_on_oops is not exported. So we should either export it or make
mtdoops to be always compiled-in.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  parent reply	other threads:[~2009-10-11  6:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-02 14:05 [PATCH 0/3]: mtdoops fixes and improvements Simon Kagstrom
2009-10-02 14:06 ` [PATCH 1/3]: mtdoops: Make page size configurable Simon Kagstrom
2009-10-08  5:17   ` Artem Bityutskiy
2009-10-02 14:06 ` [PATCH 2/3]: mtdoops: Use panic_write if panic_on_oops is set Simon Kagstrom
2009-10-08  5:28   ` Artem Bityutskiy
2009-10-08  6:38     ` Simon Kagstrom
2009-10-11  6:00     ` Artem Bityutskiy [this message]
2009-10-12  6:23       ` Simon Kagstrom
2009-10-02 14:07 ` [PATCH 3/3]: mtdoops: store all kernel messages in a circular buffer Simon Kagstrom
2009-10-06 12:37   ` Simon Kagstrom
2009-10-06 14:50   ` [PATCH v2 " Simon Kagstrom
2009-10-08 14:42 ` [PATCH v2 0/3]: mtdoops fixes and improvements Simon Kagstrom
2009-10-08 14:44   ` [PATCH v2 1/3]: mtdoops: Keep track of clean/dirty mtdoops pages in an array Simon Kagstrom
2009-10-08 14:45   ` [PATCH v2 2/3]: mtdoops: Make page size configurable Simon Kagstrom
2009-10-08 14:45   ` [PATCH v2 3/3]: mtdoops: store all kernel messages in a circular buffer Simon Kagstrom
2009-10-08 15:15   ` [PATCH v2 0/3]: mtdoops fixes and improvements Simon Kagstrom
2009-10-08 15:25 ` [PATCH v3 " Simon Kagstrom
2009-10-08 15:26   ` [PATCH v3 1/3]: mtdoops: Keep track of clean/dirty mtdoops pages in an array Simon Kagstrom
2009-10-11 10:29     ` Artem Bityutskiy
2009-10-08 15:27   ` [PATCH v3 2/3]: mtdoops: Make page size configurable Simon Kagstrom
2009-10-11 10:38     ` Artem Bityutskiy
2009-10-08 15:27   ` [PATCH v3 3/3]: mtdoops: store all kernel messages in a circular buffer Simon Kagstrom
2009-10-11 10:04   ` [PATCH v3 0/3]: mtdoops fixes and improvements Artem Bityutskiy
2009-10-11 11:02   ` Artem Bityutskiy
2009-10-12 11:06   ` [PATCH v4 " Simon Kagstrom
2009-10-12 11:07     ` [PATCH v4 1/4]: mtdoops: avoid erasing already empty areas Simon Kagstrom
2009-10-12 11:09     ` [PATCH v4 2/4]: mtdoops: Keep track of used/unused mtdoops pages in an array Simon Kagstrom
2009-10-12 11:09     ` [PATCH v4 3/4]: mtdoops: Make page (record) size configurable Simon Kagstrom
2009-10-12 11:09     ` [PATCH v4 4/4]: mtdoops: store all kernel messages in a circular buffer Simon Kagstrom

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=1255240820.3359.33.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=Artem.Bityutskiy@nokia.com \
    --cc=aaro.koskinen@nokia.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=simon.kagstrom@netinsight.net \
    /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.