Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pad Don't hold the thread_lock between successive ca...
details: https://anonhg.NetBSD.org/src/rev/465817bdeb27
branches: trunk
changeset: 350901:465817bdeb27
user: nat <nat%NetBSD.org@localhost>
date: Thu Jan 26 04:10:27 2017 +0000
description:
Don't hold the thread_lock between successive calls to sc_intr as it
breaks mixing.
This will help passing the atf test. Changes to audio.c to ensue this
will be in a followup commit.
diffstat:
sys/dev/pad/pad.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diffs (64 lines):
diff -r 62b7d0ada9d4 -r 465817bdeb27 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Thu Jan 26 03:54:54 2017 +0000
+++ b/sys/dev/pad/pad.c Thu Jan 26 04:10:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.26 2016/10/15 07:08:06 nat Exp $ */
+/* $NetBSD: pad.c,v 1.27 2017/01/26 04:10:27 nat Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.26 2016/10/15 07:08:06 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.27 2017/01/26 04:10:27 nat Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -362,11 +362,11 @@
err = 0;
- mutex_enter(&sc->sc_lock);
- intr = sc->sc_intr;
- intrarg = sc->sc_intrarg;
+ while (uio->uio_resid > 0 && !err) {
+ mutex_enter(&sc->sc_lock);
+ intr = sc->sc_intr;
+ intrarg = sc->sc_intrarg;
- while (uio->uio_resid > 0 && !err) {
getmicrotime(&now);
nowusec = (now.tv_sec * 1000000) + now.tv_usec;
lastusec = (sc->sc_last.tv_sec * 1000000) +
@@ -394,7 +394,6 @@
mutex_exit(&sc->sc_lock);
err = uiomove(pb.pb_ptr, pb.pb_len, uio);
- mutex_enter(&sc->sc_lock);
continue;
}
@@ -407,16 +406,17 @@
intr = sc->sc_intr;
intrarg = sc->sc_intrarg;
err = 0;
+ mutex_exit(&sc->sc_lock);
continue;
}
err = cv_wait_sig(&sc->sc_condvar, &sc->sc_lock);
- if (err != 0)
+ if (err != 0) {
+ mutex_exit(&sc->sc_lock);
break;
+ }
- intr = sc->sc_intr;
- intrarg = sc->sc_intrarg;
+ mutex_exit(&sc->sc_lock);
}
- mutex_exit(&sc->sc_lock);
return err;
}
Home |
Main Index |
Thread Index |
Old Index