Re: [PATCH v6 5/5] vhost/vsock: add VHOST_RESET_OWNER ioctl
From: Andrey Drobyshev
Date: Wed Jul 29 2026 - 13:19:23 EST
On 7/29/26 7:57 PM, Stefano Garzarella wrote:
> On Fri, Jul 24, 2026 at 02:45:42PM +0300, Andrey Drobyshev wrote:
>> From: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>
>>
>> This ioctl is needed for QEMU's CPR (checkpoint-restore) migration of
>> the guest with vhost-vsock device. For this to work, we need to reset
>> the device ownership on the source side by calling RESET_OWNER, and then
>> claim it on the dest side by calling SET_OWNER. We expect not to lose any
>> AF_VSOCK connection while this happens.
>>
>> To that end, unlike the release path, RESET_OWNER keeps the guest CID
>> hashed: established connections survive, and host sends issued while
>> the device is between owners simply stay on send_pkt_queue until the
>> next device start drains them.
>>
>> Since the device stays reachable through the CID hash, the lockless
>> send/cancel paths can race with the worker teardown in
>> vhost_workers_free(). The previous commit ("vhost: synchronize with
>> RCU readers when freeing workers") makes that safe.
>>
>> Signed-off-by: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>
>> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@xxxxxxxxxxxxx>
>> ---
>> drivers/vhost/vsock.c | 32 ++++++++++++++++++++++++++++++++
>> 1 file changed, 32 insertions(+)
>
> I thought I had already reviewed this, but anyway:
>
> Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
>
I explicitly dropped your R-b since the logic was slightly altered as
noted in the cover letter:
Patch 5: add 'sync' param to vhost_dev_reset_owner() call.
Thank you,
Andrey