Re: [PATCH v2] usbip: tools: Add usbip host driver availability check

Shuah Khan
2026-03-27T17:51:35Z

On 3/27/26 02:39, Zongmin Zhou wrote:
>
> On 2026/3/27 02:43, Shuah Khan wrote:
>> On 3/26/26 02:43, Greg KH wrote:

[removed text]

>>
>> The problem Zongmin is trying fix ish when usbipd starts, it looks for
>> exported if any - if it doesn't find any it assumes there aren't any
>> exported and doesn't detect that usbip_host driver isn't loaded.
>>
>> refresh_exported_devices() doesn't have the logic and it shouldn't
>> include that logic because this hook is called periodically to
>> refresh the list of exported devices. Starting usbipd and loading
>> the driver are distinct steps and without any dependencies.
>>
>> This patch he is trying to add that detection so a message can be printed
>> to say "load the driver".
>>
>> A message can be added easily to cover two cases:
>>
>> 1. usbip_host driver isn't loaded
>> 2. There are no exported devices.
>>
>> refresh_exported_devices() will not find any devices in both
>> of the above scenarios. It isn't an error if it can't find
>> any exported devices.
>>
>> An informational message when refresh_exported_devices()
>> when it doesn't find any devices could help users.
>>
>> Zongmin,
>>
>> Would adding a message that says
>> "Check if usbip_host driver is loaded or export devices"
>> solve the problem of hard to debug problem you are addressing here?
>>
> Shuah,
>
> Your suggestion makes sense.
> Adding an informational message when no devices are found would be a simple
> and clean solution that helps users debug without being intrusive.
>
> However, I plan to add the info() message in usbip_generic_driver_open() instead of
> refresh_exported_devices(), because:
> - usbip_generic_driver_open() is called only once at initialization.
> - refresh_exported_devices() is called periodically to refresh the exported device list.

refresh_exported_devices() isn't called periodically - it is called
from usbip_host_driver op: refresh_device_list and it will be called
whenever usbipd (host side) calls it whenever it receives a request from
user-space via process_request()

For example running "usbip list -l" command will trigger a run of
refresh_exported_devices() via usbip_host_driver op: refresh_device_list

I don't think it will that noisy to add a message to refresh_exported_devices()
when device list is zero. Currently the logic doesn't detect device list zero.
You have add that condition to print informational message.

> - When the server has no exported devices, having zero devices
>   is normal and not worth frequent info messages.

That is correct. Zero exported devices isn't an error and this could
persist until devices are exported.

>
> Theoretically, we only need to prompt once at startup. Is my understanding correct?> > I'll also remove the existing error messages like below,
> since they cannot accurately determine whether the driver is loaded:
>
> if (ret)
>     err("please load " USBIP_CORE_MOD_NAME ".ko and "
>         USBIP_HOST_DRV_NAME ".ko!");

Leave this one alone, because it gets called from a couple of places.

thanks,
-- Shuah