Notice: We have migrated to GitLab launching 2024-05-01 see here:

#1275 closed defect (fixed)

ATA driver disables task preemption during busy-wait

Reported by: strauman Owned by: Joel Sherrill
Priority: normal Milestone: 4.9
Component: fs Version: 4.7
Severity: major Keywords:
Cc: strauman@…, thomas.doerfler@…, chrisj@… Blocked By:


The ATA driver (libchip/ide/ata.c)
uses (the IMHO very bad practice) of protecting
a critical section by disabling preemption.

This is aggravated by the fact that the critical
section in question here contains a few loops
where the driver busy-waits for the device
to become ready.

I propose to introduce a mutex for protecting
the critical section so that using ATA has
minimal impact on the response time of other

(Sidenote: while this is a relatively easy fix
the 'bdbuf' buffer cache implementation suffers
from the same problem (even though critical
sections there are more deterministic))

I strongly discourage the use of disk I/O
(libblock/bdbuf/ata/ide) while real-time critical
tasks execute.

Change History (2)

comment:1 Changed on 01/10/08 at 22:04:51 by strauman

Cc: strauman added
Severity: criticalmajor

comment:2 Changed on 08/06/08 at 03:43:14 by Chris Johns

Cc: Chris Johns added
Resolution: fixed
Status: newclosed

Added mutex protection rather than disable pre-emption.

Note: See TracTickets for help on using tickets.