public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Re: [RFC] Improving udelay/ndelay on platforms where that is possible
       [not found]   ` <4b707ce0-6067-ab36-e167-1acf348d26bf@free.fr>
@ 2017-11-01 19:48     ` Baruch Siach
  2017-11-02 16:12       ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Baruch Siach @ 2017-11-01 19:48 UTC (permalink / raw)
  To: Marc Gonzalez
  Cc: Alan Cox, Mark Rutland, Mason, Russell King, Jonathan Austin,
	Arnd Bergmann, Nicolas Pitre, Peter Zijlstra, Stephen Boyd,
	Michael Turquette, Kevin Hilman, Will Deacon, LKML,
	Steven Rostedt, Douglas Anderson, John Stultz, Thomas Gleixner,
	Linus Torvalds, Ingo Molnar, Linux ARM, linux-mtd

Hi Marc,

On Wed, Nov 01, 2017 at 08:03:20PM +0100, Marc Gonzalez wrote:
> On 01/11/2017 18:53, Alan Cox wrote: 
> > For that matter given the bad blocks don't randomly change why not cache
> > them ?
> 
> That's a good question, I'll ask the NAND framework maintainer.
> Store them where, by the way? On the NAND chip itself?

Yes. In the bad block table (bbt). See drivers/mtd/nand/nand_bbt.c.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] Improving udelay/ndelay on platforms where that is possible
  2017-11-01 19:48     ` [RFC] Improving udelay/ndelay on platforms where that is possible Baruch Siach
@ 2017-11-02 16:12       ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-11-02 16:12 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Marc Gonzalez, Mark Rutland, Alan Cox, Russell King,
	Jonathan Austin, Arnd Bergmann, Mason, Peter Zijlstra,
	Will Deacon, Michael Turquette, Nicolas Pitre, Stephen Boyd, LKML,
	Steven Rostedt, Douglas Anderson, Kevin Hilman, John Stultz,
	linux-mtd, Thomas Gleixner, Linus Torvalds, Ingo Molnar,
	Linux ARM

On Wed, 1 Nov 2017 21:48:22 +0200
Baruch Siach <baruch@tkos.co.il> wrote:

> Hi Marc,
> 
> On Wed, Nov 01, 2017 at 08:03:20PM +0100, Marc Gonzalez wrote:
> > On 01/11/2017 18:53, Alan Cox wrote:   
> > > For that matter given the bad blocks don't randomly change why not cache
> > > them ?  
> > 
> > That's a good question, I'll ask the NAND framework maintainer.
> > Store them where, by the way? On the NAND chip itself?  
> 
> Yes. In the bad block table (bbt). See drivers/mtd/nand/nand_bbt.c.

Yes, you can cache this information in a bad block table stored on the
flash. But still, the ndelay()/udelay() problem remains: reading the
out-of-band area of each eraseblock to re-create the bad block table is
just one use case. This ndelay() is something you can have on all kind
of read/write operations. As Thomas Gleixner stated, this is not really
needed on modern NAND controllers which take care of various
timing constraints internally, but still, we have some controllers
that are not that smart, and we have to support them.

I'm not concerned about performances here, and if I'm told that we
should turn all ndelay() calls into usleep_range() ones, then I'm
perfectly fine with that, but I need a guarantee that when I say "I
want to wait at least X ns/us", the function does not return before
that time has expired.

Not sure if that would work, but maybe we could create a wrapper like

void nand_ndelay(unsigned long nanoseconds)
{
	ktime_t end = ktime_add_ns(ktime_get(), nanoseconds);

	do {
		ndelay(nanoseconds);
	} while (ktime_before(ktime_get(), end));
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-02 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <d3f42f35-8175-58f6-78b7-3331efe64da2@sigmadesigns.com>
     [not found] ` <20171101175325.2557ce85@alans-desktop>
     [not found]   ` <4b707ce0-6067-ab36-e167-1acf348d26bf@free.fr>
2017-11-01 19:48     ` [RFC] Improving udelay/ndelay on platforms where that is possible Baruch Siach
2017-11-02 16:12       ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox