From: sashiko-bot@kernel.org
To: "Jia Jia" <physicalmtea@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v4 3/3] vhost/vsock: keep IOTLB across feature updates
Date: Sat, 15 Aug 2026 07:29:36 +0000 [thread overview]
Message-ID: <20260815072936.8510A1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260814072903.124991-4-physicalmtea@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch fails to apply its fixes consistently across the vhost subsystem. The patch correctly fixes the issue of dropped IOTLB translations and missing cleanup on VHOST_SET_FEATURES for vhost-vsock, but completely misses identical bugs in vhost-net. Because `vhost_net_set_features()` lacks the `!n->dev.iotlb` existence check, it continues to unconditionally wipe and reallocate the IOTLB on every feature update when `VIRTIO_F_ACCESS_PLATFORM` is set. Furthermore, it lacks the teardown logic to clear the IOTLB when the feature is dynamically disabled, leaving stale translations active.
--
--- Patch [3]: [PATCH v4 3/3] vhost/vsock: keep IOTLB across feature updates ---
commit 43e7ccb915735bc2e366b5df4fab08c7d9c89e1e
Author: Jia Jia <physicalmtea@gmail.com>
vhost/vsock: keep IOTLB across feature updates
This commit updates vhost-vsock to only initialize the device IOTLB when one
does not already exist. This prevents dropping valid translations and forcing
avoidable misses when features like logging are updated while the device is
running.
> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> index a18fe1335349b..b5536075fc397 100644
> --- a/drivers/vhost/vsock.c
> +++ b/drivers/vhost/vsock.c
> @@ -886,7 +886,8 @@ static int vhost_vsock_set_features(struct vhost_vsock *vsock, u64 features)
> vsock->dev.iotlb)
> vhost_clear_device_iotlb(&vsock->dev);
>
> - 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;
> }
[Severity: High]
This is a pre-existing issue, but should this same fix be applied consistently
to the rest of the vhost subsystem?
Looking at vhost_net_set_features() in drivers/vhost/net.c, it lacks this
existence check and continues to unconditionally wipe and reallocate the IOTLB
on every feature update when VIRTIO_F_ACCESS_PLATFORM is set:
drivers/vhost/net.c:vhost_net_set_features() {
...
if (virtio_features_test_bit(features, VIRTIO_F_ACCESS_PLATFORM)) {
if (vhost_init_device_iotlb(&n->dev))
goto out_unlock;
}
...
}
This unconditionally reallocates the IOTLB and drops all valid translations,
which could cause a storm of IOTLB misses and latency spikes during events like
live migration when VHOST_F_LOG_ALL is toggled.
Additionally, vhost-net appears to be missing the teardown logic to clear the
IOTLB when the feature is dynamically disabled, which could leave stale
translations active.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814072903.124991-1-physicalmtea@gmail.com?part=3
next prev parent reply other threads:[~2026-08-15 7:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 7:29 [PATCH v4 0/3] vhost/vsock: fix device IOTLB feature lifecycle Jia Jia
2026-08-14 7:29 ` [PATCH v4 1/3] vhost: add helper to clear device IOTLB Jia Jia
2026-08-14 7:58 ` Stefano Garzarella
2026-08-15 7:29 ` sashiko-bot
2026-08-14 7:29 ` [PATCH v4 2/3] vhost/vsock: discard IOTLB when ACCESS_PLATFORM is cleared Jia Jia
2026-08-14 7:58 ` Stefano Garzarella
2026-08-15 7:29 ` sashiko-bot
2026-08-14 7:29 ` [PATCH v4 3/3] vhost/vsock: keep IOTLB across feature updates Jia Jia
2026-08-14 8:02 ` Stefano Garzarella
2026-08-14 11:56 ` Jia Jia
2026-08-15 7:29 ` sashiko-bot [this message]
2026-08-14 7:52 ` [PATCH v4 0/3] vhost/vsock: fix device IOTLB feature lifecycle Stefano Garzarella
2026-08-14 11:56 ` Jia Jia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260815072936.8510A1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=physicalmtea@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.