PATCH: add framework for ndelay (nanoseconds)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Linux Kernel Mailing List
ChangeSet 1.953.4.9, 2003/02/02 02:44:15-02:00, [email protected]
[PATCH] PATCH: add framework for ndelay (nanoseconds)
+void
__ndelay(unsigned long usecs)
^^^^^
Review
Quoted 2 lines
(quoted diff) +2
-0+{ + __const_udelay(usecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
^^^^^
Quoted 1 line
+}
Wouldn't it make more sense to call the parameter nsecs' (or ns')?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 5 lines · Geert Uytterhoeven
Quoted 4 lines · Linux Kernel Mailing List
ChangeSet 1.953.4.9, 2003/02/02 02:44:15-02:00, [email protected]
[PATCH] PATCH: add framework for ndelay (nanoseconds)
Quoted 8 lines
Quoted 1 line
+void
__ndelay(unsigned long usecs)^^^^^Review
Quoted 2 lines
(quoted diff) +2
-0+{ + __const_udelay(usecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */^^^^^Quoted 1 line
+}
Wouldn't it make more sense to call the parameter
nsecs' (orns')?
There are more serious problems with this implementation:
1) It's *very* imprecise. Even on an 1 GHz CPU and with HZ = 100 precision is ~86 nsec. With HZ = 1000 it's almost unusable on *any* CPU.
2) Additional delay caused by integer multiplication, cache misses and so on may be large enough, especially on older processors. On 233 MHz PII it's 600-700 nsec (perfectly repeatable), on 600 MHz alpha ev56 - 200-300 nsec.
As of current 2.4, there is the only user of ndelay() - ide_execute_command() that calls ndelay(400). Why udelay(1) cannot be used instead?
Ivan.
Quoted 5 lines · Ivan Kokshaysky
Quoted 1 line
Wouldn't it make more sense to call the parameter
nsecs' (orns')?There are more serious problems with this implementation:
1) It's *very* imprecise. Even on an 1 GHz CPU and with HZ = 100 precision is ~86 nsec. With HZ = 1000 it's almost unusable on *any* CPU.
HZ = 1000 isn't a 2.4 thing.
Quoted 2 lines
As of current 2.4, there is the only user of
ndelay()-ide_execute_command()that calls ndelay(400). Why udelay(1) cannot be used instead?
Why waste 500nS every IDE command as opposed to doing the job right ? The initial ndelay() is a quick implementation. If you don't like it implement a better one, if your box isnt fast implement it as udelay.
In the 2.5 tree I also hope we can avoid the ndelay in some cases
Alan
Quoted 3 lines · Alan Cox
Why waste 500nS every IDE command as opposed to doing the job right ? The initial
ndelay()is a quick implementation. If you don't like it implement a better one, if your box isnt fast implement it as udelay.
Ok, I see. Probably i386 and others need additional shifts to improve precision.
BTW, on alpha it's non-issue, despite that initial overhead.
Ivan.
Quoted 5 lines · Alan Cox
Why waste 500nS every IDE command as opposed to doing the job right ? The initial
ndelay()is a quick implementation. If you don't like it implement a better one, if your box isnt fast implement it as udelay.
The delay should be made controller specific. On most controllers the reading of the alt status we need to do to flush the write command to the drive will also cause enough of a delay so that the ndelay isn't needed at all. For example the on the Promise 20265 and 20267 the alt status read will always take at least 600ns.
Ross