Re: panic in usb_detach_device / device_printf

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Sun, 11 May 2025 14:49:15 UTC
On Sat, 10 May 2025, Warner Losh wrote:

> OK. Sorry for the top post.
>
> I need to recreate this because this data is already freed and corrupted.
>
> So is this panic in bhyve? What's the bhyve configuration you are using?
> You say this happens as you move the xhci pass through device back to
> the host. Does the same thing happen if you instead devctl detach the xhciX
> the device instead? It looks like you have a da0 device on the usb bus, any
> others?

"Seems xhci -> ppt"  So this is on the base system moving the XHCI to
ppt to be used in bhyve, otherwise it wouldn't detach all the USB
devices but create them.  I booted a non-FreeBSD guest.

The da0 is created by a blank adapter in the
ugen0.7: <Card Reader Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (200mA)
<Generic- SD/MMC 1.00>             at scbus1 target 0 lun 0 (da0,pass1)
There's no card there.  But it's been like this for years; even before
the reader was supported and I've done this regularly.

> I need a way to reproduce it, and I kinda get what you're doing, but step
> by step instructions would be way better...  And it may be a week before
> I get to it: my daughter is graduating next Friday, so my whole routine and
> schedule is off.

# pciconf -l pci0:0:20:0
xhci0@pci0:0:20:0:      class=0x0c0330 rev=0x21 hdr=0x00 vendor=0x8086 device=0x9d2f subvendor=0x17aa subdevice=0x225d

I cannot reproduce it anymore.  history is gone sadly.  I do not
know what I typed anymore.
My bhyve.sh has these as comments so I likely just pasted them when
bhyve refused to start because of no ppt0 not being there already.

#   devctl detach pci0:0:20:0 || true
#   devctl set driver pci0:0:20:0 ppt || true

/bz

-- 
Bjoern A. Zeeb                                                     r15:7