Re: [PATCH v3 for 9.1 0/6] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support
Mon, Mar 18, 2024 at 12:22:02PM CET, jonah.pal...@oracle.com wrote: > > >On 3/16/24 11:45 AM, Jiri Pirko wrote: >> Fri, Mar 15, 2024 at 05:55:51PM CET, jonah.pal...@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, having both VIRTIO_F_NOTIFICATION_DATA >> > feature and ioeventfd enabled is a functional mismatch. The user must >> > explicitly disable ioeventfd for the device in the Qemu arguments when >> > using this feature, else the device will fail to complete realization. >> > >> > For example, a device must explicitly enable notification_data as well >> > as disable ioeventfd: >> > >> > -device virtio-scsi-pci,...,ioeventfd=off,notification_data=on >> > >> > 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. >> > >> > v3: Validate VQ idx via. virtio_queue_get_num() (pci, mmio, ccw) >> > Rename virtio_queue_set_shadow_avail_data >> > Only pass in upper 16 bits of 32-bit extra data (was redundant) >> > Make notification compatibility check function static >> > Drop tags on patches 1/6, 3/6, and 4/6 >> > >> > v2: Don't disable ioeventfd by default, user must disable it >> > Drop tags on patch 2/6 >> > >> > Jonah Palmer (6): >> > virtio/virtio-pci: Handle extra notification data >> > virtio: Prevent creation of device using notification-data with ioeventfd >> > virtio-mmio: Handle extra notification data >> > virtio-ccw: Handle extra notification data >> > vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits >> > virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition >> >> Jonah, do you have kernel patches to add this feature as well? >> >> Thanks! > >Hi Jiri! I think there are already kernel patches for >VIRTIO_F_NOTIFICATION_DATA, unless you're referring to something more >specific that wasn't included in these patches: > >[1]: virtio: add VIRTIO_F_NOTIFICATION_DATA feature support >https://lore.kernel.org/lkml/20230324195029.2410503-1-vik...@daynix.com/ > >[2]: virtio-vdpa: add VIRTIO_F_NOTIFICATION_DATA feature support >https://lore.kernel.org/lkml/20230413081855.36643-3-alvaro.ka...@solid-run.com/ I missed this. Thx! > >Jonah
Re: [PATCH v3 for 9.1 0/6] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support
On 3/16/24 11:45 AM, Jiri Pirko wrote: Fri, Mar 15, 2024 at 05:55:51PM CET, jonah.pal...@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, having both VIRTIO_F_NOTIFICATION_DATA feature and ioeventfd enabled is a functional mismatch. The user must explicitly disable ioeventfd for the device in the Qemu arguments when using this feature, else the device will fail to complete realization. For example, a device must explicitly enable notification_data as well as disable ioeventfd: -device virtio-scsi-pci,...,ioeventfd=off,notification_data=on 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. v3: Validate VQ idx via. virtio_queue_get_num() (pci, mmio, ccw) Rename virtio_queue_set_shadow_avail_data Only pass in upper 16 bits of 32-bit extra data (was redundant) Make notification compatibility check function static Drop tags on patches 1/6, 3/6, and 4/6 v2: Don't disable ioeventfd by default, user must disable it Drop tags on patch 2/6 Jonah Palmer (6): virtio/virtio-pci: Handle extra notification data virtio: Prevent creation of device using notification-data with ioeventfd virtio-mmio: Handle extra notification data virtio-ccw: Handle extra notification data vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition Jonah, do you have kernel patches to add this feature as well? Thanks! Hi Jiri! I think there are already kernel patches for VIRTIO_F_NOTIFICATION_DATA, unless you're referring to something more specific that wasn't included in these patches: [1]: virtio: add VIRTIO_F_NOTIFICATION_DATA feature support https://lore.kernel.org/lkml/20230324195029.2410503-1-vik...@daynix.com/ [2]: virtio-vdpa: add VIRTIO_F_NOTIFICATION_DATA feature support https://lore.kernel.org/lkml/20230413081855.36643-3-alvaro.ka...@solid-run.com/ Jonah
Re: [PATCH v3 for 9.1 0/6] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support
Fri, Mar 15, 2024 at 05:55:51PM CET, jonah.pal...@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, having both VIRTIO_F_NOTIFICATION_DATA >feature and ioeventfd enabled is a functional mismatch. The user must >explicitly disable ioeventfd for the device in the Qemu arguments when >using this feature, else the device will fail to complete realization. > >For example, a device must explicitly enable notification_data as well >as disable ioeventfd: > >-device virtio-scsi-pci,...,ioeventfd=off,notification_data=on > >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. > >v3: Validate VQ idx via. virtio_queue_get_num() (pci, mmio, ccw) >Rename virtio_queue_set_shadow_avail_data >Only pass in upper 16 bits of 32-bit extra data (was redundant) >Make notification compatibility check function static >Drop tags on patches 1/6, 3/6, and 4/6 > >v2: Don't disable ioeventfd by default, user must disable it >Drop tags on patch 2/6 > >Jonah Palmer (6): > virtio/virtio-pci: Handle extra notification data > virtio: Prevent creation of device using notification-data with ioeventfd > virtio-mmio: Handle extra notification data > virtio-ccw: Handle extra notification data > vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits > virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition Jonah, do you have kernel patches to add this feature as well? Thanks!