Source-Changes-HG archive

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

[src/jdolecek-ncqfixes]: src/sys/dev/ata replace KASSERT() for READ LOG EXT r...



details:   https://anonhg.NetBSD.org/src/rev/e433c94a7b4b
branches:  jdolecek-ncqfixes
changeset: 850585:e433c94a7b4b
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Sep 24 19:48:02 2018 +0000

description:
replace KASSERT() for READ LOG EXT returning without error indication
with just log to avoid triggering panic under QEMU - it doesn't implement
the command for AHCI emulation

diffstat:

 sys/dev/ata/TODO.ncq |   4 ++--
 sys/dev/ata/ata.c    |  28 +++++++++++++++++++---------
 2 files changed, 21 insertions(+), 11 deletions(-)

diffs (85 lines):

diff -r 6af6f8ff058e -r e433c94a7b4b sys/dev/ata/TODO.ncq
--- a/sys/dev/ata/TODO.ncq      Sat Sep 22 17:52:24 2018 +0000
+++ b/sys/dev/ata/TODO.ncq      Mon Sep 24 19:48:02 2018 +0000
@@ -1,9 +1,9 @@
 jdolecek-ncqfixes goals:
-- re-fix QEMU ahci(4) bug workaround (no READ LOG EXT support) - now it
-  triggers KASSERT()
 - fix ahci(4) error handling under paralles - invalid bio via WD_CHAOS_MONKEY
   ends up being handled as NOERROR, triggering KASSERT() in wd(4)
 - remove controller-specific slot bitmaps (ic/siisata.c, ic/ahcisata_core.c)
+- revert rev 1.431 of wd.c (AT_POOL removal) - ensure still works
+  for the reset-via-thread case
 
 Bugs
 ----
diff -r 6af6f8ff058e -r e433c94a7b4b sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Sat Sep 22 17:52:24 2018 +0000
+++ b/sys/dev/ata/ata.c Mon Sep 24 19:48:02 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata.c,v 1.141.6.9 2018/09/22 16:14:25 jdolecek Exp $   */
+/*     $NetBSD: ata.c,v 1.141.6.10 2018/09/24 19:48:02 jdolecek Exp $  */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.9 2018/09/22 16:14:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.10 2018/09/24 19:48:02 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -972,7 +972,7 @@
        for (int i = 0; i < sizeof(drvp->recovery_blk); i++)
                cksum += tb[i];
        if (cksum != 0) {
-               aprint_error_dev(drvp->drv_softc,
+               device_printf(drvp->drv_softc,
                    "invalid checksum %x for READ LOG EXT page %x\n",
                    cksum, page);
                rv = EINVAL;
@@ -989,10 +989,20 @@
        *status = tb[2];
        *err = tb[3];
 
-       KASSERTMSG((*status & WDCS_ERR),
-           "%s: non-error command slot %d reported by READ LOG EXT page %x: "
-           "err %x status %x\n",
-           device_xname(drvp->drv_softc), *slot, page, *err, *status);
+       if ((*status & WDCS_ERR) == 0) {
+               /*
+                * We expect error here. Normal physical drives always
+                * do, it's part of ATA standard. However, QEMU AHCI emulation
+                * misehandles READ LOG EXT in a way that the command itself
+                * returns without error, but no data is transferred.
+                */
+               device_printf(drvp->drv_softc,
+                   "READ LOG EXT page %x failed to report error: "
+                   "slot %d err %x status %x\n",
+                   page, *slot, *err, *status);
+               rv = EOPNOTSUPP;
+               goto out;
+       }
 
        rv = 0;
 
@@ -1460,7 +1470,7 @@
                        xfer->c_flags &= ~C_FREE;
                        ata_channel_unlock(chp);
 
-                       aprint_normal_dev(drvp->drv_softc,
+                       device_printf(drvp->drv_softc,
                            "xfer %p freed while invoking timeout\n", xfer); 
 
                        ata_free_xfer(chp, xfer);
@@ -1470,7 +1480,7 @@
                /* Race vs. callout_stop() in ata_deactivate_xfer() */
                ata_channel_unlock(chp);
 
-               aprint_normal_dev(drvp->drv_softc,
+               device_printf(drvp->drv_softc,
                    "xfer %p deactivated while invoking timeout\n", xfer); 
                return true;
        }



Home | Main Index | Thread Index | Old Index