NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amd64/54217: Biostar X370GT5 may fail to boot with SATA controller enabled



The following reply was made to PR port-amd64/54217; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-amd64/54217: Biostar X370GT5 may fail to boot with SATA
 controller enabled
Date: Mon, 10 Jun 2019 05:31:46 +0000

 these weren't sent to gnats (send to gnats-bugs, not gnats-admin; you
 often have to set this by hand if replying to your own PR or post)
 
    ------
 
 From: Andrius V <vezhlys%gmail.com@localhost>
 To: port-amd64-maintainer%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
 	netbsd-bugs%netbsd.org@localhost
 Subject: Re: port-amd64/54217: Biostar X370GT5 may fail to boot with SATA
 	controller enabled
 Date: Thu, 23 May 2019 23:36:27 +0300
 
 Not sure if it will help but file location got lost during copy paste
 from the shell in the first line of the trace messages (everything
 else is the same):
 
 panic: kernel diagnostic assertion "mutex_owned(&chp->ch_lock)"
 failed: file "/usr/src/sys/dev/ata/ata_subr.c", line 275
 
 
 From: Andrius V <vezhlys%gmail.com@localhost>
 To: port-amd64-maintainer%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
 	netbsd-bugs%netbsd.org@localhost
 Subject: Re: port-amd64/54217: Biostar X370GT5 may fail to boot with SATA
 	controller enabled
 Date: Fri, 24 May 2019 01:40:46 +0300
 
 The issue seems to be "caused" by changes implemented for kern/49457
 (starting this commit:
 https://github.com/NetBSD/src/commit/4b35af44f7c014375586795a95e72b32833e5bf3
 + two subsequent ones). The retry logic in wd_get_params tries to
 reset the drive but it requires an ata channel lock which apparently
 is not always available on boot. Adding a lock does help to avoid the
 crash but second SATA drive is not detected properly in that case, so
 I am not sure how it should be actually fixed:
 
 autoconfiguration error: ahcisata0 port 5: clearing WDCTL_RST failed for drive 0
 wd1: autoconfiguration error: IDENTIFY failed
 wd1: fixing 0 sector size
 wd1: secperunit and ncylinders are zero
 wd1(ahcisata0:5:0): using PIO mode 0
 
 Changes I did:
 --- a/sys/dev/ata/wd.c
 +++ b/sys/dev/ata/wd.c
 @@ -1644,6 +1644,7 @@ int
  wd_get_params(struct wd_softc *wd, uint8_t flags, struct ataparams *params)
  {
         int retry = 0;
 +       struct ata_channel *chp;
 
  again:
         switch (wd->atabus->ata_get_params(wd->drvp, flags, params)) {
 @@ -1652,7 +1653,10 @@ again:
         case CMD_ERR:
                 if (retry == 0) {
                         retry++;
 +                       chp = wd->drvp->chnl_softc;
 +                       ata_channel_lock(chp);
                         (*wd->atabus->ata_reset_drive)(wd->drvp, flags, NULL);
 +                       ata_channel_unlock(chp);
                         goto again;
                 }
 


Home | Main Index | Thread Index | Old Index