Module Name:    src
Committed By:   jmcneill
Date:           Thu May 21 23:40:02 UTC 2015

Modified Files:
        src/sys/dev/sdmmc: sdmmc.c

Log Message:
sdmmc_task_thread isn't MPSAFE so instead of just wrapping the callback
in KERNEL_LOCK/KERNEL_UNLOCK_ONE, remove KTHREAD_MPSAFE. While here, use
PRI_BIO instead of PRI_NONE for the task thread priority. Since this is
how all transfers are queued, and we have a 1 second timeout on the task
being picked up off the queue (!), better not to rely on a PRI_NONE thread.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sdmmc/sdmmc.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/sdmmc/sdmmc.c
diff -u src/sys/dev/sdmmc/sdmmc.c:1.25 src/sys/dev/sdmmc/sdmmc.c:1.26
--- src/sys/dev/sdmmc/sdmmc.c:1.25	Wed May 20 13:09:34 2015
+++ src/sys/dev/sdmmc/sdmmc.c	Thu May 21 23:40:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc.c,v 1.25 2015/05/20 13:09:34 jmcneill Exp $	*/
+/*	$NetBSD: sdmmc.c,v 1.26 2015/05/21 23:40:02 jmcneill Exp $	*/
 /*	$OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $	*/
 
 /*
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.25 2015/05/20 13:09:34 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.26 2015/05/21 23:40:02 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -217,7 +217,7 @@ sdmmc_doattach(device_t dev)
 {
 	struct sdmmc_softc *sc = device_private(dev);
 
-	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
+	if (kthread_create(PRI_BIO, 0, NULL,
 	    sdmmc_task_thread, sc, &sc->sc_tskq_lwp, "%s", device_xname(dev))) {
 		aprint_error_dev(dev, "couldn't create task thread\n");
 	}
@@ -271,9 +271,7 @@ sdmmc_task_thread(void *arg)
 		if (task != NULL) {
 			sdmmc_del_task1(sc, task);
 			mutex_exit(&sc->sc_tskq_mtx);
-			KERNEL_LOCK(1, curlwp);
 			(*task->func)(task->arg);
-			KERNEL_UNLOCK_ONE(curlwp);
 			mutex_enter(&sc->sc_tskq_mtx);
 		} else {
 			/* Check for the exit condition. */

Reply via email to