diff options
| author | riastradh <riastradh@NetBSD.org> | 2021-09-07 10:43:34 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2021-09-07 10:43:34 +0000 |
| commit | cdaa2b6287c7cd0aba59fe9650ce03ac9171c4b7 (patch) | |
| tree | 595ae72fc5eb831331a4842b8744205e61f57bf6 /sys/dev | |
| parent | 7d33670915914615cb2a638d4f7a984d3f312b27 (diff) | |
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 (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/ugen.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 986484898e9..894be8ec928 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -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 @@ ugen_detach(device_t self, int flags) /* 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)) |
