From: Jonah Palmer <jonah.palmer@oracle.com>
To: Lei Yang <leiyang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
qemu-devel@nongnu.org, si-wei.liu@oracle.com,
boris.ostrovsky@oracle.com, raphael@enfabrica.net,
kwolf@redhat.com, hreitz@redhat.com, pasic@linux.ibm.com,
borntraeger@linux.ibm.com, farman@linux.ibm.com,
thuth@redhat.com, richard.henderson@linaro.org, david@redhat.com,
iii@linux.ibm.com, cohuck@redhat.com,
Eugenio Perez Martin <eperezma@redhat.com>,
pbonzini@redhat.com, fam@euphon.net, stefanha@redhat.com,
qemu-block@nongnu.org, qemu-s390x@nongnu.org,
virtio-fs@lists.linux.dev
Subject: Re: [PATCH v1 0/8] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support
Date: Fri, 8 Mar 2024 08:39:00 -0500 [thread overview]
Message-ID: <701ec0a8-0af0-4cad-af18-c5b66b955a6d@oracle.com> (raw)
In-Reply-To: <CAPpAL=xRiVfr4tObY_MwudQ0qyhWOqMzaHQaCdx7YtMnZc7GDw@mail.gmail.com>
On 3/8/24 8:28 AM, Lei Yang wrote:
> Hi Jonah
>
> QE tested this series v1 with a tap device with vhost=off with
> regression tests, everything works fine. And QE also add
> "notification_data=true" to the qemu command line then got "1" when
> performing the command [1] inside the guest.
> [1] cut -c39 /sys/devices/pci0000:00/0000:00:01.3/0000:05:00.0/virtio1/features
>
> Tested-by: Lei Yang <leiyang@redhat.com>
>
Thank you for double-checking this series for me Lei! I appreciate it :)
Jonah
> On Thu, Mar 7, 2024 at 7:18 PM Eugenio Perez Martin <eperezma@redhat.com> wrote:
>>
>> On Wed, Mar 6, 2024 at 8:34 AM Michael S. Tsirkin <mst@redhat.com> wrote:
>>>
>>> On Wed, Mar 06, 2024 at 08:07:31AM +0100, Eugenio Perez Martin wrote:
>>>> On Wed, Mar 6, 2024 at 6:34 AM Jason Wang <jasowang@redhat.com> wrote:
>>>>>
>>>>> On Tue, Mar 5, 2024 at 3:46 AM Jonah Palmer <jonah.palmer@oracle.com> wrote:
>>>>>>
>>>>>> The goal of these patches are to add support to a variety of virtio and
>>>>>> vhost devices for the VIRTIO_F_NOTIFICATION_DATA transport feature. This
>>>>>> feature indicates that a driver will pass extra data (instead of just a
>>>>>> virtqueue's index) when notifying the corresponding device.
>>>>>>
>>>>>> The data passed in by the driver when this feature is enabled varies in
>>>>>> format depending on if the device is using a split or packed virtqueue
>>>>>> layout:
>>>>>>
>>>>>> Split VQ
>>>>>> - Upper 16 bits: shadow_avail_idx
>>>>>> - Lower 16 bits: virtqueue index
>>>>>>
>>>>>> Packed VQ
>>>>>> - Upper 16 bits: 1-bit wrap counter & 15-bit shadow_avail_idx
>>>>>> - Lower 16 bits: virtqueue index
>>>>>>
>>>>>> Also, due to the limitations of ioeventfd not being able to carry the
>>>>>> extra provided by the driver, ioeventfd is left disabled for any devices
>>>>>> using this feature.
>>>>>
>>>>> Is there any method to overcome this? This might help for vhost.
>>>>>
>>>>
>>>> As a half-baked idea, read(2)ing an eventfd descriptor returns an
>>>> 8-byte integer already. The returned value of read depends on eventfd
>>>> flags, but both have to do with the number of writes of the other end.
>>>>
>>>> My proposal is to replace this value with the last value written by
>>>> the guest, so we can extract the virtio notification data from there.
>>>> The behavior of read is similar to not-EFD_SEMAPHORE, reading a value
>>>> and then blocking if read again without writes. The behavior of KVM
>>>> writes is different, as it is not a counter anymore.
>>>>
>>>> Thanks!
>>>
>>>
>>> I doubt you will be able to support this in ioeventfd...
>>
>> I agree.
>>
>>> But vhost does not really need the value at all.
>>> So why mask out ioeventfd with vhost?
>>
>> The interface should not be able to start with vhost-kernel because
>> the feature is not offered by the vhost-kernel device. So ioeventfd is
>> always enabled with vhost-kernel.
>>
>> Or do you mean we should allow it and let vhost-kernel fetch data from
>> the avail ring as usual? I'm ok with that but then the guest can place
>> any value to it, so the driver cannot be properly "validated by
>> software" that way.
>>
>>> vhost-vdpa is probably the only one that might need it...
>>
>> Right, but vhost-vdpa already supports doorbell memory regions so I
>> guess it has little use, isn't it?
>>
>> Thanks!
>>
>>>
>>>
>>>
>>>>> Thanks
>>>>>
>>>>>>
>>>>>> A significant aspect of this effort has been to maintain compatibility
>>>>>> across different backends. As such, the feature is offered by backend
>>>>>> devices only when supported, with fallback mechanisms where backend
>>>>>> support is absent.
>>>>>>
>>>>>> Jonah Palmer (8):
>>>>>> virtio/virtio-pci: Handle extra notification data
>>>>>> virtio-pci: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA
>>>>>> virtio-mmio: Handle extra notification data
>>>>>> virtio-mmio: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA
>>>>>> virtio-ccw: Handle extra notification data
>>>>>> virtio-ccw: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA
>>>>>> vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits
>>>>>> virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition
>>>>>>
>>>>>> hw/block/vhost-user-blk.c | 1 +
>>>>>> hw/net/vhost_net.c | 2 ++
>>>>>> hw/s390x/s390-virtio-ccw.c | 16 ++++++++++++----
>>>>>> hw/s390x/virtio-ccw.c | 6 ++++--
>>>>>> hw/scsi/vhost-scsi.c | 1 +
>>>>>> hw/scsi/vhost-user-scsi.c | 1 +
>>>>>> hw/virtio/vhost-user-fs.c | 2 +-
>>>>>> hw/virtio/vhost-user-vsock.c | 1 +
>>>>>> hw/virtio/virtio-mmio.c | 15 +++++++++++----
>>>>>> hw/virtio/virtio-pci.c | 16 +++++++++++-----
>>>>>> hw/virtio/virtio.c | 18 ++++++++++++++++++
>>>>>> include/hw/virtio/virtio.h | 5 ++++-
>>>>>> net/vhost-vdpa.c | 1 +
>>>>>> 13 files changed, 68 insertions(+), 17 deletions(-)
>>>>>>
>>>>>> --
>>>>>> 2.39.3
>>>>>>
>>>>>
>>>
>>
>>
>
prev parent reply other threads:[~2024-03-08 13:40 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 19:46 [PATCH v1 0/8] virtio,vhost: Add VIRTIO_F_NOTIFICATION_DATA support Jonah Palmer
2024-03-04 19:46 ` [PATCH v1 1/8] virtio/virtio-pci: Handle extra notification data Jonah Palmer
2024-03-05 8:04 ` Eugenio Perez Martin
2024-03-04 19:46 ` [PATCH v1 2/8] virtio-pci: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA Jonah Palmer
2024-03-08 17:00 ` Michael S. Tsirkin
2024-03-08 17:36 ` Eugenio Perez Martin
2024-03-08 17:45 ` Jonah Palmer
2024-03-08 19:19 ` Michael S. Tsirkin
2024-03-11 14:53 ` Jonah Palmer
2024-03-11 15:47 ` Michael S. Tsirkin
2024-03-12 14:33 ` Jonah Palmer
2024-03-12 14:58 ` Michael S. Tsirkin
2024-03-12 15:06 ` Jonah Palmer
2024-03-04 19:46 ` [PATCH v1 3/8] virtio-mmio: Handle extra notification data Jonah Palmer
2024-03-05 8:05 ` Eugenio Perez Martin
2024-03-04 19:46 ` [PATCH v1 4/8] virtio-mmio: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA Jonah Palmer
2024-03-05 8:05 ` Eugenio Perez Martin
2024-03-04 19:46 ` [PATCH v1 5/8] virtio-ccw: Handle extra notification data Jonah Palmer
2024-03-11 15:55 ` Eric Farman
2024-03-04 19:46 ` [PATCH v1 6/8] virtio-ccw: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA Jonah Palmer
2024-03-04 19:46 ` [PATCH v1 7/8] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits Jonah Palmer
2024-03-04 19:46 ` [PATCH v1 8/8] virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition Jonah Palmer
2024-03-06 5:33 ` [PATCH v1 0/8] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support Jason Wang
2024-03-06 7:07 ` Eugenio Perez Martin
2024-03-06 7:33 ` [PATCH v1 0/8] virtio,vhost: " Michael S. Tsirkin
2024-03-07 11:16 ` [PATCH v1 0/8] virtio, vhost: " Eugenio Perez Martin
2024-03-08 13:28 ` Lei Yang
2024-03-08 13:39 ` Jonah Palmer [this message]
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=701ec0a8-0af0-4cad-af18-c5b66b955a6d@oracle.com \
--to=jonah.palmer@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=eperezma@redhat.com \
--cc=fam@euphon.net \
--cc=farman@linux.ibm.com \
--cc=hreitz@redhat.com \
--cc=iii@linux.ibm.com \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=leiyang@redhat.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=raphael@enfabrica.net \
--cc=richard.henderson@linaro.org \
--cc=si-wei.liu@oracle.com \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
--cc=virtio-fs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).