* RE: using multile partitions on one NAND chip
[not found] <NGENJJFPMHGLPILEKKAMMEAFCFAA.Stephan.Linke@epygi.de>
@ 2004-11-24 18:28 ` Stephan Linke
2004-11-24 20:05 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Stephan Linke @ 2004-11-24 18:28 UTC (permalink / raw)
To: Linux-Mtd
> -----Original Message-----
> From: Stephan Linke [mailto:Stephan.Linke@epygi.de]
> Sent: Mittwoch, 24. November 2004 19:13
> To: tglx@linutronix.de
> Subject: RE: using multile partitions on one NAND chip
>
>
> Hi Thomas,
>
> already noticed the spinlocks; thanks anyway.
>
> On erase the chip is locked in nand_get_chip() and stays locked until
> the ERASE2
> command has been send to the chip to wait for the ready status the chip gets
> unlcoked since the nand_wait() also tries to lock the chip.
> Additinaly nand_wait() unlocks the chip befor calling yield().
> If another task tries nand_get_chip() at this verry moment the erase will be
> interrupted by sending an RESET command. Looks like this is by
> intention since the erase of the blockis restarted after the
> nand_wait() returns.
> (I'm not shure if a 3rd task could start an ERASE command - after the
> 2nd task has interrupted the 1st on - before the first nand_wait()
> returns. This could mislead the first task.)
>
> My real problem is this one:
> Our NAND-chips use to keep the buisy line active "for ever" when the
> RESET command is issued at the wrong point of time. A chip in that
> condition requires a power-on reset to reactivate the chip. Which
> makes it a verry critical condition to us. :)
> At the moment I am fixing this problem by causing our local copy of
> nand_command() (in maps/) to wait for the ready bit of the NAND-chip
> (except for the STATUS commands).
>
> To be more specific: If the RESET is issued when the ERASE is almost
> finished a deadlock of the chips state is verry likely.
>
> As far as I know the RESET should not do any harm to the chip by
> definition. But unfortunately it does. :-(
>
> Stephan
>
>
> > -----Original Message-----
> > From: linux-mtd-bounces@lists.infradead.org
> > [mailto:linux-mtd-bounces@lists.infradead.org]On Behalf Of Thomas
> > Gleixner
> > Sent: Mittwoch, 24. November 2004 17:29
> > To: Stephan Linke
> > Cc: Linux-Mtd
> > Subject: Re: using multile partitions on one NAND chip
> >
> >
> > On Wed, 2004-11-24 at 15:40 +0100, Stephan Linke wrote:
> > > Hi,
> >
> > Please fix your mail client, to 80 characters per line.
> > Read http://david.woodhou.se/email.html
> >
> > > anyone tried using multiple partitions on a NAND flash?
> >
> > Ever looked into the various drivers in drivers/mtd/nand ?
> >
> > > I can't find the protection mechanism that protects lets
> > > say an erase on one block against a read command on the
> > > other block.
> >
> > nand_get_chip() contains the protection.
> >
> > > efficient protection for this. It looks like nand_chip->chip_lock
> > > should do this job but it only protects
> >
> > chip_lock is only for SMP and the lock/unlock macros contain the
> > preemption control if CONFIG_PREEMPT=y. The lock itself is a NOOP on UP
> > systems
> >
> > tglx
> >
> >
> >
> > ______________________________________________________
> > Linux MTD discussion mailing list
> > http://lists.infradead.org/mailman/listinfo/linux-mtd/
> >
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: using multile partitions on one NAND chip
2004-11-24 18:28 ` using multile partitions on one NAND chip Stephan Linke
@ 2004-11-24 20:05 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2004-11-24 20:05 UTC (permalink / raw)
To: Stephan Linke; +Cc: Linux-Mtd
On Wed, 2004-11-24 at 19:12 +0100, Stephan Linke wrote:
> Hi Thomas,
>
> already noticed the spinlocks; thanks anyway.
>
> On erase the chip is locked in nand_get_chip() and stays locked
> until the ERASE2 > command has been send to the chip to wait for the
> ready status the chip gets unlcoked since the nand_wait() also tries
> to lock the chip. Additinaly nand_wait() unlocks the chip befor
> calling yield().
retry:
/* Hardware controller shared among independend devices */
if (this->controller) {
spin_lock (&this->controller->lock);
if (this->controller->active)
active = this->controller->active;
else
this->controller->active = this;
spin_unlock (&this->controller->lock);
}
if (active == this) {
spin_lock (&this->chip_lock);
if (this->state == FL_READY) {
this->state = new_state;
spin_unlock (&this->chip_lock);
return;
}
}
set_current_state (TASK_UNINTERRUPTIBLE);
add_wait_queue (&active->wq, &wait);
spin_unlock (&active->chip_lock);
schedule ();
remove_wait_queue (&active->wq, &wait);
goto retry;
this->state is reset to FL_READY, after the active command is finished.
All waiters on the waitqueue are woken up.
> If another task tries nand_get_chip() at this verry moment the erase
> will be interrupted by sending an RESET command. Looks like this is by
> intention since the erase of the blockis restarted after the
> nand_wait() returns.
We stopped to interrupt the erase since long, due to broken chips, which
do not handle the erase suspend correctly.
But the locking was always safe and without race conditions.
On SMP the spinlock is protecting the state variable against concurrent
access by different tasks on different CPU's.
In case of CONFIG_PREEMPT=y the state variable is protected by
spin_lock() (contains preempt_disable()) on SMP and UP against
concurrent access by different tasks on the same CPU.
CONFIG_PREEMPT=n does not need further protection at this place.
Which version of nand_base.c are you using ?
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* using multile partitions on one NAND chip
@ 2004-11-24 14:40 Stephan Linke
2004-11-24 16:29 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Stephan Linke @ 2004-11-24 14:40 UTC (permalink / raw)
To: Linux-Mtd
Hi,
anyone tried using multiple partitions on a NAND flash?
I can't find the protection mechanism that protects lets say an erase on one block against a read command on the other block.
In my case I am using 2 YAFFS patitions and 1 partition that fakes a read-only NOR flash using the nand_read_ecc() function
(mtd->read_ecc()). I'm not shure if there is an efficient protection for this. It looks like nand_chip->chip_lock should do this job
but it only protects parts of the erase loop agains parts of the nand_chip->waitfunc() wait loop. It does not keep
nand_chip->cmdfunc() from sending a command while an erase command is still active in the nand chip.
Thanks, Stephan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: using multile partitions on one NAND chip
2004-11-24 14:40 Stephan Linke
@ 2004-11-24 16:29 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2004-11-24 16:29 UTC (permalink / raw)
To: Stephan Linke; +Cc: Linux-Mtd
On Wed, 2004-11-24 at 15:40 +0100, Stephan Linke wrote:
> Hi,
Please fix your mail client, to 80 characters per line.
Read http://david.woodhou.se/email.html
> anyone tried using multiple partitions on a NAND flash?
Ever looked into the various drivers in drivers/mtd/nand ?
> I can't find the protection mechanism that protects lets
> say an erase on one block against a read command on the
> other block.
nand_get_chip() contains the protection.
> efficient protection for this. It looks like nand_chip->chip_lock
> should do this job but it only protects
chip_lock is only for SMP and the lock/unlock macros contain the
preemption control if CONFIG_PREEMPT=y. The lock itself is a NOOP on UP
systems
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-11-24 20:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <NGENJJFPMHGLPILEKKAMMEAFCFAA.Stephan.Linke@epygi.de>
2004-11-24 18:28 ` using multile partitions on one NAND chip Stephan Linke
2004-11-24 20:05 ` Thomas Gleixner
2004-11-24 14:40 Stephan Linke
2004-11-24 16:29 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox