Re: [PATCH v2 2/2] vhost/vsock: keep IOTLB across feature updates

"Michael S. Tsirkin" <[email protected]> Mon, 3 Aug 2026 23:20:48 -0400
Newsgroups org.kernel.vger.kvm,dev.linux.lists.virtualization,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Fri, Jul 31, 2026 at 06:34:14PM +0800, Jia Jia wrote:
> VHOST_SET_FEATURES is also used to update logging while a device is
> running. When ACCESS_PLATFORM stays enabled, allocating a new empty
> IOTLB on every call drops valid translations and forces avoidable
> misses.
> 
> Initialize the device IOTLB only when one does not already exist.
> 
> Signed-off-by: Jia Jia <[email protected]>


You did not CCc all maintainers and lists with this patchset.
./scripts/get_maintainer.pl -f drivers/vhost/vsock.c
will help find out whom to copy.

thanks!

> ---
>  drivers/vhost/vsock.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> index 562b9e139a76..3703fd219039 100644
> --- a/drivers/vhost/vsock.c
> +++ b/drivers/vhost/vsock.c
> @@ -893,7 +893,8 @@ static int vhost_vsock_set_features(struct vhost_vsock *vsock, u64 features)
>  		goto err;
>  	}
>  
> -	if ((features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) {
> +	if ((features & (1ULL << VIRTIO_F_ACCESS_PLATFORM)) &&
> +	    !vsock->dev.iotlb) {
>  		if (vhost_init_device_iotlb(&vsock->dev))
>  			goto err;
>  	}
> -- 
> 2.34.1