public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brendan Simon <brendan.simon@ctam.com.au>
To: mtd@infradead.org
Subject: Re: Flash chip locking
Date: Wed, 28 Jun 2000 21:11:50 -0500	[thread overview]
Message-ID: <395AB066.3070708@ctam.com.au> (raw)
In-Reply-To: 16397.962188563@cygnus.co.uk

David Woodhouse wrote:
> 
> So we try to keep the latency down to a minimum. Rather than the naïve 
> inner loop which looked like this:
> 
> foreach(word to write) {
> 	spin_lock_bh();
> 	writeb(WRITE_COMMAND);
> 	writeb(datum);
> 	while (!done)
> 		;
> 	spin_unlock_bh();
> }
> 
> .... we do something more like
> 
> foreach(word to write) {
> 
> retry:
> 	spin_lock_bh();
> 	if (!ready) {
> 		spin_unlock()
> 		udelay(a little while);
> 		goto retry;
> 	}
> 	writeb(WRITE_COMMAND);
> 	writeb(datum);
> 	spin_unlock_bh();
> 	udelay(expected time for the write we just started);
> 	spin_lock_bh();
> 	check final status, loop or whatever
> 	spin_unlock_bh();
Or to avoid ugly "goto" statements.
   spin_lock_bh();
   while (!ready)
   {
       spin_unlock()
       udelay(a_little_while);
       spin_lock_bh();
   }

You are implying that 128us is a large amount of time to wait.  Maybe 
with todays processors it is, I don't really know if it is or isn't for 
the average processor speed.  Does the udelay() imply that the scheduler 
can switch to another process ?  If so, I would have thought that the 
scheduling process would take a lot longer that 128us, but I could be 
wrong !!!
If no scheduling is performed then then there would be no difference to 
the naive "foreach" loop that you mention.

Are my assumptions reasonable ?

Brendan Simon.




To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

  parent reply	other threads:[~2000-06-28 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-28 10:36 Flash chip locking David Woodhouse
2000-06-28 20:05 ` Philipp Rumpf
2000-06-29  2:11 ` Brendan Simon [this message]
2000-06-28 11:16   ` Kira Brown
2000-06-28 11:24   ` David Woodhouse
2000-06-29 13:49     ` Brendan Simon
2000-06-28 15:12   ` Richard Gooch
2000-10-13  0:16 ` Alice Hennessy
2000-10-13  0:14   ` David Woodhouse
2000-11-04 19:26   ` David Woodhouse

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=395AB066.3070708@ctam.com.au \
    --to=brendan.simon@ctam.com.au \
    --cc=mtd@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox