Module Name:    src
Committed By:   jdolecek
Date:           Thu Oct  4 19:42:01 UTC 2018

Modified Files:
        src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq wd.c

Log Message:
relax the NOERROR + C_CHAOS, just rerun the xfer instead of panic, to handle
another variant of bad/missing AHCI error recovery, this time under Parallels


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.10 -r1.4.2.11 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.441.2.8 -r1.441.2.9 src/sys/dev/ata/wd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.4.2.10 src/sys/dev/ata/TODO.ncq:1.4.2.11
--- src/sys/dev/ata/TODO.ncq:1.4.2.10	Wed Oct  3 19:20:48 2018
+++ src/sys/dev/ata/TODO.ncq	Thu Oct  4 19:42:01 2018
@@ -1,6 +1,7 @@
 jdolecek-ncqfixes goals:
-- fix ahci(4) error handling under paralles - invalid bio via WD_CHAOS_MONKEY
-  ends up being handled as NOERROR, triggering KASSERT() in wd(4)
+- re-check READ LOG EXT handling under native and Parallels to make sure
+  the NOERROR under Parallels is their bug and not ours
+- run recovery via atathread, move to new function and share ahci/siisata/mvsata
 - remove controller-specific slot bitmaps (ic/siisata.c, ic/ahcisata_core.c)
 
 Bugs

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.441.2.8 src/sys/dev/ata/wd.c:1.441.2.9
--- src/sys/dev/ata/wd.c:1.441.2.8	Thu Oct  4 17:53:23 2018
+++ src/sys/dev/ata/wd.c	Thu Oct  4 19:42:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.441.2.8 2018/10/04 17:53:23 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.441.2.9 2018/10/04 19:42:01 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.8 2018/10/04 17:53:23 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.9 2018/10/04 19:42:01 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -914,13 +914,23 @@ out:
 		bp->b_error = EIO;
 		break;
 	case NOERROR:
+#ifdef WD_CHAOS_MONKEY
+		/*
+		 * For example Parallels AHCI emulation doesn't actually
+		 * return error for the invalid I/O, so just re-run
+		 * the request and do not panic.
+		 */
+		if (__predict_false(xfer->c_flags & C_CHAOS)) {
+			xfer->c_bio.error = REQUEUE;
+			errmsg = "chaos noerror";
+			goto retry2;
+		}
+#endif
+
 noerror:	if ((xfer->c_bio.flags & ATA_CORR) || xfer->c_retries > 0)
 			device_printf(dksc->sc_dev,
 			    "soft error (corrected) xfer %"PRIxPTR"\n",
 			    (intptr_t)xfer & PAGE_MASK);
-#ifdef WD_CHAOS_MONKEY
-		KASSERT((xfer->c_flags & C_CHAOS) == 0);
-#endif
 		break;
 	case ERR_NODEV:
 		bp->b_error = EIO;

Reply via email to