From 70ebdf428f68d6956e9857a87566daa0b4e301d2 Mon Sep 17 00:00:00 2001 From: jmcneill Date: Thu, 21 May 2015 23:40:02 +0000 Subject: [PATCH] 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. --- sys/dev/sdmmc/sdmmc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c index fcaa614650d3..5206e8a3d4e6 100644 --- a/sys/dev/sdmmc/sdmmc.c +++ b/sys/dev/sdmmc/sdmmc.c @@ -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 -__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. */