Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb ugen(4): Use cv_broadcast to wake all I/O operat...
details: https://anonhg.NetBSD.org/src/rev/6c745cdb6909
branches: trunk
changeset: 1023432:6c745cdb6909
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Sep 07 10:43:34 2021 +0000
description:
ugen(4): Use cv_broadcast to wake all I/O operations on detach.
Nothing prevents two concurrent reads or two concurrent writes on any
particular ugen endpoint, as far as I can tell, and we need to wake
all of them, so use cv_broadcast rather than cv_signal on detach.
XXX It's not clear to me that cv_signal in the xfer completion
callbacks is correct either: any one consumer might use less than the
full buffer. So I think either we should use cv_broadcast, or
consumers that don't use the whole buffer need to issue cv_signal too
to wake up another consumer even if we want to avoid a thundering
herd.
diffstat:
sys/dev/usb/ugen.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r f4e3de08221e -r 6c745cdb6909 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c Tue Sep 07 10:43:21 2021 +0000
+++ b/sys/dev/usb/ugen.c Tue Sep 07 10:43:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.164 2021/09/07 10:43:21 riastradh Exp $ */
+/* $NetBSD: ugen.c,v 1.165 2021/09/07 10:43:34 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.164 2021/09/07 10:43:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.165 2021/09/07 10:43:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1220,7 +1220,7 @@
/* Wake everyone */
for (i = 0; i < USB_MAX_ENDPOINTS; i++) {
for (dir = OUT; dir <= IN; dir++)
- cv_signal(&sc->sc_endpoints[i][dir].cv);
+ cv_broadcast(&sc->sc_endpoints[i][dir].cv);
}
/* Wait for processes to go away. */
if (cv_timedwait(&sc->sc_detach_cv, &sc->sc_lock, hz * 60))
Home |
Main Index |
Thread Index |
Old Index