Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc We can't block our interrupt while sdmmc_detac...
details: https://anonhg.NetBSD.org/src/rev/b32dfe0fd7c6
branches: trunk
changeset: 783457:b32dfe0fd7c6
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Sat Dec 22 21:24:49 2012 +0000
description:
We can't block our interrupt while sdmmc_detach_card is called, as
it can issue commands, and some host drivers have interrupt-driven
command completion. Prevents assertion (or deadlock) upon detach
of sdhc(4) with inserted card.
diffstat:
sys/dev/sdmmc/sdmmc.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r 98e5d32bfb36 -r b32dfe0fd7c6 sys/dev/sdmmc/sdmmc.c
--- a/sys/dev/sdmmc/sdmmc.c Sat Dec 22 20:21:09 2012 +0000
+++ b/sys/dev/sdmmc/sdmmc.c Sat Dec 22 21:24:49 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmc.c,v 1.19 2012/12/22 20:21:09 jakllsch Exp $ */
+/* $NetBSD: sdmmc.c,v 1.20 2012/12/22 21:24:49 jakllsch 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.19 2012/12/22 20:21:09 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.20 2012/12/22 21:24:49 jakllsch Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -271,8 +271,15 @@
}
/* time to die. */
sc->sc_dying = 0;
- if (ISSET(sc->sc_flags, SMF_CARD_PRESENT))
+ if (ISSET(sc->sc_flags, SMF_CARD_PRESENT)) {
+ /*
+ * sdmmc_card_detach() may issue commands,
+ * so temporarily drop the interrupt-blocking lock.
+ */
+ mutex_exit(&sc->sc_tskq_mtx);
sdmmc_card_detach(sc, DETACH_FORCE);
+ mutex_enter(&sc->sc_tskq_mtx);
+ }
sc->sc_tskq_lwp = NULL;
cv_broadcast(&sc->sc_tskq_cv);
mutex_exit(&sc->sc_tskq_mtx);
Home |
Main Index |
Thread Index |
Old Index