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.
This commit is contained in:
jmcneill 2015-05-21 23:40:02 +00:00
parent b04e6730c1
commit 70ebdf428f
1 changed files with 3 additions and 5 deletions

View File

@ -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. */