Re: [PATCH v15 2/4] usb: offload: add apis for offload usage tracking

From: Greg KH
Date: Wed Aug 13 2025 - 10:52:38 EST


On Fri, Aug 01, 2025 at 03:39:31AM +0000, Guan-Yu Lin wrote:
> Introduce offload_usage and corresponding apis to track offload usage
> on each USB device. Offload denotes that there is another co-processor
> accessing the USB device via the same USB host controller. To optimize
> power usage, it's essential to monitor whether the USB device is
> actively used by other co-processor. This information is vital when
> determining if a USB device can be safely suspended during system power
> state transitions.
>
> Signed-off-by: Guan-Yu Lin <guanyulin@xxxxxxxxxx>
> ---
> drivers/usb/core/Kconfig | 10 +++
> drivers/usb/core/Makefile | 1 +
> drivers/usb/core/offload.c | 136 +++++++++++++++++++++++++++++++++++++
> drivers/usb/core/usb.c | 1 +
> include/linux/usb.h | 18 +++++
> 5 files changed, 166 insertions(+)
> create mode 100644 drivers/usb/core/offload.c
>
> diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
> index 58e3ca7e4793..d5d38657f929 100644
> --- a/drivers/usb/core/Kconfig
> +++ b/drivers/usb/core/Kconfig
> @@ -143,3 +143,13 @@ config USB_DEFAULT_AUTHORIZATION_MODE
> ACPI selecting value 2 is analogous to selecting value 0.
>
> If unsure, keep the default value.
> +
> +config USB_OFFLOAD
> + bool "Enable USB offload feature"

I'm confused, we already have a "USB offload feature" that went into the
last kernel release, why do we need a separate config option for this as
well? Shouldn't this code only get built if the drivers that need it
select it automatically? Forcing distros to configure this isn't
generally a good idea if at all possible.


> + depends on USB
> + depends on USB_XHCI_SIDEBAND_SUSPEND
> + help
> + Offload denotes that there is another co-processor accessing the
> + USB device via the same USB host controller, creating the
> + "offloaded USB transfers". Say Y to allow offloaded USB
> + transfers during system sleep (Suspend-to-RAM).

Especially because all "desktops" do not want this code selected, so
having it in all distros feels like a waste to me.

thanks,

greg k-h