usbd_fill_deviceinfo() does not generate any I/O so there's no need to call it from a USB thread. So the diff below kills usb_fill_di_task().
While here do not skip USB devices without attached drivers. If you disable ugen(4) in your kernel they are properly handled. usbdevs(8) will simply not print any 'driver:' line. Ok? Index: usb.c =================================================================== RCS file: /cvs/src/sys/dev/usb/usb.c,v retrieving revision 1.122 diff -u -p -r1.122 usb.c --- usb.c 18 Nov 2018 16:33:26 -0000 1.122 +++ usb.c 25 Dec 2018 22:34:49 -0000 @@ -118,7 +118,6 @@ struct proc *usb_task_thread_proc = NULL void usb_abort_task_thread(void *); struct proc *usb_abort_task_thread_proc = NULL; -void usb_fill_di_task(void *); void usb_fill_udc_task(void *); void usb_fill_udf_task(void *); @@ -511,26 +510,6 @@ usbclose(dev_t dev, int flag, int mode, } void -usb_fill_di_task(void *arg) -{ - struct usb_device_info *di = (struct usb_device_info *)arg; - struct usb_softc *sc; - struct usbd_device *dev; - - /* check that the bus and device are still present */ - if (di->udi_bus >= usb_cd.cd_ndevs) - return; - sc = usb_cd.cd_devs[di->udi_bus]; - if (sc == NULL) - return; - dev = sc->sc_bus->devices[di->udi_addr]; - if (dev == NULL) - return; - - usbd_fill_deviceinfo(dev, di); -} - -void usb_fill_udc_task(void *arg) { struct usb_device_cdesc *udc = (struct usb_device_cdesc *)arg; @@ -692,7 +671,6 @@ usbioctl(dev_t devt, u_long cmd, caddr_t { struct usb_device_info *di = (void *)data; int addr = di->udi_addr; - struct usb_task di_task; struct usbd_device *dev; if (addr < 1 || addr >= USB_MAX_DEVICES) @@ -702,21 +680,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t if (dev == NULL) return (ENXIO); - di->udi_bus = unit; - - /* All devices get a driver, thanks to ugen(4). If the - * task ends without adding a driver name, there was an error. - */ - di->udi_devnames[0][0] = '\0'; - - usb_init_task(&di_task, usb_fill_di_task, di, - USB_TASK_TYPE_GENERIC); - usb_add_task(sc->sc_bus->root_hub, &di_task); - usb_wait_task(sc->sc_bus->root_hub, &di_task); - - if (di->udi_devnames[0][0] == '\0') - return (ENXIO); - + usbd_fill_deviceinfo(dev, di); break; }