flashdisk real-time behavior

Till Straumann strauman at slac.stanford.edu
Tue Jan 29 15:16:42 CST 2008

With the new flashdisk support there is an opportunity
for me to reiterate my rant at libblock/bdbuf.

I remind you that bdbuf disables task preemption to
protect internal data structures. Most notably,
the ioctl(BLKIO_REQUEST) is executed non-preemptably.

It seems to me (I have briefly looked at the code but didn't do
an extensive analysis or run-time tests) that the flash write and erase 
are essentially busy-waiting. This would mean that a task
doing I/O to a flash disk may prevent higher-priority tasks
from being scheduled for intolerably long periods.
E.g., with a block size of 512b and a programming time of ~5us/byte
task-preemption is disabled for ~2.5ms.
(I don't even want to think about foreground-erasing...)

At the time (see this thread: 
my concerns were answered by asserting that ioctl(BLKIO_REQUEST)
is a very short operation. This may apply to the ATA driver but not 
to the flash disk driver. Also, it is not obvious to the disk driver 
that the BLKIO_REQUEST ioctl is executed with preemption disabled.

Could someone familiar with the flashdisk comment, please?

Anyways, IMHO libblock/bdbuf should be converted to using mutex protection
(I have started some work in that direction).

-- Till

More information about the rtems-users mailing list