* ahci led: reset spins.
@ 2019-11-17 4:50 ori
0 siblings, 0 replies; only message in thread
From: ori @ 2019-11-17 4:50 UTC (permalink / raw)
To: 9front
On one of my machines, there was aa fairly constant load from the
ialed kproc, because it was stuck in a loop resetting the ahci
controller. The controller never came back.
I'm guessing the controller was confused because there are no
drives attached. I added a timeout as a workaround.
The AHCI spec says:
If the HBA has not cleared GHC.HR to ‘0’ within 1 second of
software setting GHC.HR to ‘1’, the HBA is in
a hung or locked state.
And I've tested on a couple of machines, both with and without
drives attached, and it seems to work -- but given that people
seem to think accessing disks is important, more testing should
probably be done before committing:
diff -r c4896008f196 sys/src/9/pc/sdiahci.c
--- a/sys/src/9/pc/sdiahci.c Fri Nov 15 13:26:25 2019 -0800
+++ b/sys/src/9/pc/sdiahci.c Sat Nov 16 20:23:26 2019 -0800
@@ -1215,13 +1215,20 @@
ahciencreset(Ctlr *c)
{
Ahba *h;
+ int ndelay;
if(c->enctype == Eesb)
return 0;
h = c->hba;
h->emctl |= Emrst;
- while(h->emctl & Emrst)
+ ndelay = 0;
+ while(h->emctl & Emrst){
+ if(ndelay++ > 1000){
+ print("hung ctlr: %s\n", Tname(c));
+ return -1;
+ }
delay(1);
+ }
return 0;
}
@@ -1403,7 +1410,8 @@
memset(map, 0, sizeof map);
for(i = 0; i < niactlr; i++)
if(iactlr[i].enctype != 0){
- ahciencreset(iactlr + i);
+ if(ahciencreset(iactlr + i) == -1)
+ continue;
map[i] = 1;
j++;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-17 4:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-17 4:50 ahci led: reset spins ori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).