Re: [PATCH 2/2] usb: core: Add tracepoints for device allocation and state changes

From: Greg Kroah-Hartman

Date: Tue Oct 14 2025 - 03:57:27 EST


On Mon, Oct 13, 2025 at 10:01:23AM +0800, Kuen-Han Tsai wrote:
> Introduce new tracepoints to the USB core to improve debuggability of
> USB device lifecycle events.
>
> The following tracepoints are added:
>
> - usb_alloc_dev: Triggered when a new USB device structure is allocated,
> providing insights into early device setup.
> - usb_set_device_state: Triggered when the USB device state changes,
> allowing observation of the device's state transitions.
>
> These tracepoints capture detailed information about the USB device,
> including its name, speed, state, bus current value, and authorized
> flag. This will aid developers in diagnosing issues related to device
> enumeration within the USB subsystem.
>
> Examples:
> usb_alloc_dev: usb 1-1 speed 0 state 1 0mA [authorized]

If you are going to change the state to be a string, can you also change
the speed to be a string as well? That will help out with people
wondering what is going on with the speed of the device a lot.

thanks,

greg k-h