diff options
author | sos <sos@FreeBSD.org> | 2001-01-14 19:36:20 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2001-01-14 19:36:20 +0000 |
commit | 0feaf5cc8aebac724da356d516dcd87929c2bc1e (patch) | |
tree | d0e7e9d85a926212ebb6f0cb85938fa21317e661 | |
parent | d43290aabadb7fada357495c79ad4834af350ce8 (diff) | |
download | FreeBSD-src-0feaf5cc8aebac724da356d516dcd87929c2bc1e.zip FreeBSD-src-0feaf5cc8aebac724da356d516dcd87929c2bc1e.tar.gz |
Use prober atomic operations when test&set'ing ->active.
This turns some of my lockups under SMP into spontanious reboots...
-rw-r--r-- | sys/dev/ata/ata-all.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index b720441..9ec4296 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -1159,7 +1159,7 @@ out: case ATA_IDLE: if (scp->flags & ATA_QUEUED) { - scp->active = ATA_ACTIVE; + scp->active = ATA_ACTIVE; /* XXX */ if (ata_service(scp) == ATA_OP_CONTINUES) return; } @@ -1192,11 +1192,9 @@ ata_start(struct ata_softc *scp) struct atapi_request *atapi_request; #endif - if (scp->active != ATA_IDLE) + if (!atomic_cmpset_int(&scp->active, ATA_IDLE, ATA_ACTIVE)) return; - scp->active = ATA_ACTIVE; - #if NATADISK > 0 /* find & call the responsible driver if anything on the ATA queue */ if (TAILQ_EMPTY(&scp->ata_queue)) { @@ -1728,9 +1726,9 @@ ata_change_mode(struct ata_softc *scp, int device, int mode) { int s = splbio(); - while (scp->active != ATA_IDLE) + while (!atomic_cmpset_int(&scp->active, ATA_IDLE, ATA_ACTIVE)) tsleep((caddr_t)&s, PRIBIO, "atachm", hz/4); - scp->active = ATA_REINITING; + ata_dmainit(scp, device, ata_pmode(ATA_PARAM(scp, device)), mode < ATA_DMA ? -1 : ata_wmode(ATA_PARAM(scp, device)), mode < ATA_DMA ? -1 : ata_umode(ATA_PARAM(scp, device))); |