Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc sdmmc_task_thread isn't MPSAFE so instead of j...



details:   https://anonhg.NetBSD.org/src/rev/41d50eccb709
branches:  trunk
changeset: 808545:41d50eccb709
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu May 21 23:40:02 2015 +0000

description:
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.

diffstat:

 sys/dev/sdmmc/sdmmc.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r d0b235c1ebe0 -r 41d50eccb709 sys/dev/sdmmc/sdmmc.c
--- a/sys/dev/sdmmc/sdmmc.c     Thu May 21 22:24:24 2015 +0000
+++ b/sys/dev/sdmmc/sdmmc.c     Thu May 21 23:40:02 2015 +0000
@@ -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 @@
 {
        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 @@
                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. */



Home | Main Index | Thread Index | Old Index