<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/vhost, branch v6.16</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.16</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.16'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-05-29T15:15:35Z</updated>
<entry>
<title>Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost</title>
<updated>2025-05-29T15:15:35Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2025-05-29T15:15:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8ca154e4910efff1b04e7750e007d75732c68323'/>
<id>urn:sha1:8ca154e4910efff1b04e7750e007d75732c68323</id>
<content type='text'>
Pull virtio updates from Michael Tsirkin:

 - A new virtio RTC driver

 - vhost scsi now logs write descriptors so migration works

 - Some hardening work in virtio core

 - An old spec compliance issue fixed in vhost net

 - A couple of cleanups, fixes in vringh, virtio-pci, vdpa

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio: reject shm region if length is zero
  virtio_rtc: Add RTC class driver
  virtio_rtc: Add Arm Generic Timer cross-timestamping
  virtio_rtc: Add PTP clocks
  virtio_rtc: Add module and driver core
  vringh: use bvec_kmap_local
  vhost: vringh: Use matching allocation type in resize_iovec()
  virtio-pci: Fix result size returned for the admin command completion
  vdpa/octeon_ep: Control PCI dev enabling manually
  vhost-scsi: log event queue write descriptors
  vhost-scsi: log control queue write descriptors
  vhost-scsi: log I/O queue write descriptors
  vhost-scsi: adjust vhost_scsi_get_desc() to log vring descriptors
  vhost: modify vhost_log_write() for broader users
</content>
</entry>
<entry>
<title>vringh: use bvec_kmap_local</title>
<updated>2025-05-27T14:27:53Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2025-05-01T14:22:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=169294a14b3f80ce184fe832ff640b67a1b9eb3b'/>
<id>urn:sha1:169294a14b3f80ce184fe832ff640b67a1b9eb3b</id>
<content type='text'>
Use the bvec_kmap_local helper rather than digging into the bvec
internals.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Message-Id: &lt;20250501142244.2888227-1-hch@lst.de&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Chaitanya Kulkarni &lt;kch@nvidia.com&gt;
</content>
</entry>
<entry>
<title>vhost: vringh: Use matching allocation type in resize_iovec()</title>
<updated>2025-05-27T14:27:53Z</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2025-04-26T06:22:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b3f9967b1fd481ed932f453c38aec99f3c90d95'/>
<id>urn:sha1:8b3f9967b1fd481ed932f453c38aec99f3c90d95</id>
<content type='text'>
In preparation for making the kmalloc family of allocators type aware,
we need to make sure that the returned type from the allocation matches
the type of the variable being assigned. (Before, the allocator would
always return "void *", which can be implicitly cast to any pointer type.)

The assigned type is "struct kvec *", but the returned type will be
"struct iovec *". These have the same allocation size, so there is no
bug:

struct kvec {
        void *iov_base; /* and that should *never* hold a userland pointer */
        size_t iov_len;
};

struct iovec
{
        void __user *iov_base;  /* BSD uses caddr_t (1003.1g requires void *) */
        __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
};

Adjust the allocation type to match the assignment.

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
Message-Id: &lt;20250426062214.work.334-kees@kernel.org&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vhost-scsi: log event queue write descriptors</title>
<updated>2025-05-18T21:25:24Z</updated>
<author>
<name>Dongli Zhang</name>
<email>dongli.zhang@oracle.com</email>
</author>
<published>2025-04-03T06:29:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ac9dcca23615b2131d6510d237b70269fdef2ad4'/>
<id>urn:sha1:ac9dcca23615b2131d6510d237b70269fdef2ad4</id>
<content type='text'>
Log write descriptors for the event queue, leveraging vhost_get_vq_desc()
to retrieve the array of write descriptors to obtain the log buffer.

There is only one path for event queue.

Suggested-by: Joao Martins &lt;joao.m.martins@oracle.com&gt;
Signed-off-by: Dongli Zhang &lt;dongli.zhang@oracle.com&gt;
Reviewed-by: Mike Christie &lt;michael.christie@oracle.com&gt;
Message-Id: &lt;20250403063028.16045-9-dongli.zhang@oracle.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vhost-scsi: log control queue write descriptors</title>
<updated>2025-05-18T21:25:24Z</updated>
<author>
<name>Dongli Zhang</name>
<email>dongli.zhang@oracle.com</email>
</author>
<published>2025-04-03T06:29:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a94c96a352b56bf7aa519ed3084d3d5ac5e76910'/>
<id>urn:sha1:a94c96a352b56bf7aa519ed3084d3d5ac5e76910</id>
<content type='text'>
Log write descriptors for the control queue, leveraging
vhost_scsi_get_desc() and vhost_get_vq_desc() to retrieve the array of
write descriptors to obtain the log buffer.

For Task Management Requests, similar to the I/O queue, store the log
buffer during the submission path and log it in the completion or error
handling path.

For Asynchronous Notifications, only the submission path is involved.

Suggested-by: Joao Martins &lt;joao.m.martins@oracle.com&gt;
Signed-off-by: Dongli Zhang &lt;dongli.zhang@oracle.com&gt;
Message-Id: &lt;20250403063028.16045-8-dongli.zhang@oracle.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Mike Christie &lt;michael.christie@oracle.com&gt;
</content>
</entry>
<entry>
<title>vhost-scsi: log I/O queue write descriptors</title>
<updated>2025-05-18T21:25:24Z</updated>
<author>
<name>Dongli Zhang</name>
<email>dongli.zhang@oracle.com</email>
</author>
<published>2025-04-03T06:29:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c2c5c259aad628b3e0b4def7d9c02faad92eda11'/>
<id>urn:sha1:c2c5c259aad628b3e0b4def7d9c02faad92eda11</id>
<content type='text'>
Log write descriptors for the I/O queue, leveraging vhost_scsi_get_desc()
and vhost_get_vq_desc() to retrieve the array of write descriptors to
obtain the log buffer.

In addition, introduce a vhost-scsi specific function to log vring
descriptors. In this function, the 'partial' argument is set to false, and
the 'len' argument is set to 0, because vhost-scsi always logs all pages
shared by a vring descriptor. Add WARN_ON_ONCE() since vhost-scsi doesn't
support VIRTIO_F_ACCESS_PLATFORM.

The per-cmd log buffer is allocated on demand in the submission path after
VHOST_F_LOG_ALL is set. Return -ENOMEM on allocation failure, in order to
send SAM_STAT_TASK_SET_FULL to the guest.

It isn't reclaimed in the completion path. Instead, it is reclaimed when
VHOST_F_LOG_ALL is removed, or during VHOST_SCSI_SET_ENDPOINT when all
commands are destroyed.

Store the log buffer during the submission path and log it in the
completion path. Logging is also required in the error handling path of the
submission process.

Suggested-by: Joao Martins &lt;joao.m.martins@oracle.com&gt;
Signed-off-by: Dongli Zhang &lt;dongli.zhang@oracle.com&gt;
Message-Id: &lt;20250403063028.16045-7-dongli.zhang@oracle.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Mike Christie &lt;michael.christie@oracle.com&gt;
</content>
</entry>
<entry>
<title>vhost-scsi: adjust vhost_scsi_get_desc() to log vring descriptors</title>
<updated>2025-05-18T21:25:24Z</updated>
<author>
<name>Dongli Zhang</name>
<email>dongli.zhang@oracle.com</email>
</author>
<published>2025-04-03T06:29:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e5e6b15b0dadfce456dbd04d2ab564be4d939f6f'/>
<id>urn:sha1:e5e6b15b0dadfce456dbd04d2ab564be4d939f6f</id>
<content type='text'>
Adjust vhost_scsi_get_desc() to facilitate logging of vring descriptors.

Add new arguments to allow passing the log buffer and length to
vhost_get_vq_desc().

In addition, reset 'log_num' since vhost_get_vq_desc() may reset it only
after certain condition checks.

Suggested-by: Joao Martins &lt;joao.m.martins@oracle.com&gt;
Signed-off-by: Dongli Zhang &lt;dongli.zhang@oracle.com&gt;
Reviewed-by: Mike Christie &lt;michael.christie@oracle.com&gt;
Message-Id: &lt;20250403063028.16045-6-dongli.zhang@oracle.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vhost: modify vhost_log_write() for broader users</title>
<updated>2025-05-18T21:25:24Z</updated>
<author>
<name>Dongli Zhang</name>
<email>dongli.zhang@oracle.com</email>
</author>
<published>2025-04-03T06:29:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=41cff026cff53a661ab5483aa20e549943dee115'/>
<id>urn:sha1:41cff026cff53a661ab5483aa20e549943dee115</id>
<content type='text'>
Currently, the only user of vhost_log_write() is vhost-net. The 'len'
argument prevents logging of pages that are not tainted by the RX path.

Adjustments are needed since more drivers (i.e. vhost-scsi) begin using
vhost_log_write(). So far vhost-net RX path may only partially use pages
shared via the last vring descriptor. Unlike vhost-net, vhost-scsi always
logs all pages shared via vring descriptors. To accommodate this,
use (len == U64_MAX) to indicate whether the driver would log all pages of
vring descriptors, or only pages that are tainted by the driver.

In addition, removes BUG().

Suggested-by: Joao Martins &lt;joao.m.martins@oracle.com&gt;
Signed-off-by: Dongli Zhang &lt;dongli.zhang@oracle.com&gt;
Message-Id: &lt;20250403063028.16045-5-dongli.zhang@oracle.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vhost/net: Defer TX queue re-enable until after sendmsg</title>
<updated>2025-05-06T01:18:41Z</updated>
<author>
<name>Jon Kohler</name>
<email>jon@nutanix.com</email>
</author>
<published>2025-05-01T02:04:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c2e6b26ffe243be1e78f5a4bfb1a857d6e6f6d6'/>
<id>urn:sha1:8c2e6b26ffe243be1e78f5a4bfb1a857d6e6f6d6</id>
<content type='text'>
In handle_tx_copy, TX batching processes packets below ~PAGE_SIZE and
batches up to 64 messages before calling sock-&gt;sendmsg.

Currently, when there are no more messages on the ring to dequeue,
handle_tx_copy re-enables kicks on the ring *before* firing off the
batch sendmsg. However, sock-&gt;sendmsg incurs a non-zero delay,
especially if it needs to wake up a thread (e.g., another vhost worker).

If the guest submits additional messages immediately after the last ring
check and disablement, it triggers an EPT_MISCONFIG vmexit to attempt to
kick the vhost worker. This may happen while the worker is still
processing the sendmsg, leading to wasteful exit(s).

This is particularly problematic for single-threaded guest submission
threads, as they must exit, wait for the exit to be processed
(potentially involving a TTWU), and then resume.

In scenarios like a constant stream of UDP messages, this results in a
sawtooth pattern where the submitter frequently vmexits, and the
vhost-net worker alternates between sleeping and waking.

A common solution is to configure vhost-net busy polling via userspace
(e.g., qemu poll-us). However, treating the sendmsg as the "busy"
period by keeping kicks disabled during the final sendmsg and
performing one additional ring check afterward provides a significant
performance improvement without any excess busy poll cycles.

If messages are found in the ring after the final sendmsg, requeue the
TX handler. This ensures fairness for the RX handler and allows
vhost_run_work_list to cond_resched() as needed.

Test Case
    TX VM: taskset -c 2 iperf3  -c rx-ip-here -t 60 -p 5200 -b 0 -u -i 5
    RX VM: taskset -c 2 iperf3 -s -p 5200 -D
    6.12.0, each worker backed by tun interface with IFF_NAPI setup.
    Note: TCP side is largely unchanged as that was copy bound

6.12.0 unpatched
    EPT_MISCONFIG/second: 5411
    Datagrams/second: ~382k
    Interval         Transfer     Bitrate         Lost/Total Datagrams
    0.00-30.00  sec  15.5 GBytes  4.43 Gbits/sec  0/11481630 (0%)  sender

6.12.0 patched
    EPT_MISCONFIG/second: 58 (~93x reduction)
    Datagrams/second: ~650k  (~1.7x increase)
    Interval         Transfer     Bitrate         Lost/Total Datagrams
    0.00-30.00  sec  26.4 GBytes  7.55 Gbits/sec  0/19554720 (0%)  sender

Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: Jon Kohler &lt;jon@nutanix.com&gt;
Acked-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Link: https://patch.msgid.link/20250501020428.1889162-1-jon@nutanix.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vhost-scsi: Fix vhost_scsi_send_status()</title>
<updated>2025-04-18T14:08:11Z</updated>
<author>
<name>Dongli Zhang</name>
<email>dongli.zhang@oracle.com</email>
</author>
<published>2025-04-03T06:29:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=58465d86071b61415e25fb054201f61e83d21465'/>
<id>urn:sha1:58465d86071b61415e25fb054201f61e83d21465</id>
<content type='text'>
Although the support of VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 was
signaled by the commit 664ed90e621c ("vhost/scsi: Set
VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits"),
vhost_scsi_send_bad_target() still assumes the response in a single
descriptor.

Similar issue in vhost_scsi_send_bad_target() has been fixed in previous
commit. In addition, similar issue for vhost_scsi_complete_cmd_work() has
been fixed by the commit 6dd88fd59da8 ("vhost-scsi: unbreak any layout for
response").

Fixes: 3ca51662f818 ("vhost-scsi: Add better resource allocation failure handling")
Signed-off-by: Dongli Zhang &lt;dongli.zhang@oracle.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Reviewed-by: Mike Christie &lt;michael.christie@oracle.com&gt;
Message-Id: &lt;20250403063028.16045-4-dongli.zhang@oracle.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
</feed>
