Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb usbdi(9): Assert sleepable in usbd_ar_pipe.



details:   https://anonhg.NetBSD.org/src/rev/7fb86d1c863c
branches:  trunk
changeset: 363461:7fb86d1c863c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Mar 13 11:28:33 2022 +0000

description:
usbdi(9): Assert sleepable in usbd_ar_pipe.

Caller of usbd_suspend_pipe or usbd_abort_pipe must be prepared to
sleep for hardware to acknowledge abort and for in-flight callback on
another CPU to complete.  Let's catch the mistake early of calling
them in non-sleepable contexts where they might get lucky.

diffstat:

 sys/dev/usb/usbdi.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 092421068a3c -r 7fb86d1c863c sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sun Mar 13 01:44:37 2022 +0000
+++ b/sys/dev/usb/usbdi.c       Sun Mar 13 11:28:33 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.233 2022/03/03 06:13:23 riastradh Exp $    */
+/*     $NetBSD: usbdi.c,v 1.234 2022/03/13 11:28:33 riastradh Exp $    */
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.233 2022/03/03 06:13:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.234 2022/03/13 11:28:33 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1017,6 +1017,7 @@
        USBHIST_CALLARGS(usbdebug, "pipe = %#jx", (uintptr_t)pipe, 0, 0, 0);
        SDT_PROBE1(usb, device, pipe, abort__start,  pipe);
 
+       ASSERT_SLEEPABLE();
        KASSERT(mutex_owned(pipe->up_dev->ud_bus->ub_lock));
 
 #ifdef USB_DEBUG



Home | Main Index | Thread Index | Old Index