Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
* [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag
       [not found]         ` <CAJaqyWd632RiE9Zhc8OLsQbnaC42VG1FW97UMDHPQRofukYPrg@mail.gmail.com>
@ 2023-05-24  4:06           ` Jason Wang
  2023-05-24 10:10             ` Michael S. Tsirkin
  2023-05-24 16:25             ` Eugenio Perez Martin
  0 siblings, 2 replies; 6+ messages in thread
From: Jason Wang @ 2023-05-24  4:06 UTC (permalink / raw)
  To: Eugenio Perez Martin
  Cc: Shannon Nelson, Michael S. Tsirkin, si-wei.liu, longpeng2,
	Lei Yang, Laurent Vivier, alvaro.karsz, Gautam Dawar, Cindy Lu,
	Zhu Lingshan, Liuxiangdong, Parav Pandit, Harpreet Singh Anand,
	Gonglei (Arei), Shannon Nelson, Stefano Garzarella,
	Dragos Tatulea, Virtio-Dev

On Tue, May 23, 2023 at 1:55 PM Eugenio Perez Martin
<eperezma@redhat.com> wrote:
>
> On Mon, May 22, 2023 at 11:22 PM Shannon Nelson <shannon.nelson@amd.com> wrote:
> >
> > On 5/22/23 1:07 PM, Eugenio Perez Martin wrote:
> > >
> > > On Mon, May 22, 2023 at 9:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > >>
> > >> On Mon, May 22, 2023 at 08:57:27PM +0200, Eugenio Pérez wrote:
> > >>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > >>> ---
> > >>>   include/uapi/linux/vhost_types.h | 2 ++
> > >>>   1 file changed, 2 insertions(+)
> > >>>
> > >>> diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
> > >>> index c5690a8992d8..a1b316f49b38 100644
> > >>> --- a/include/uapi/linux/vhost_types.h
> > >>> +++ b/include/uapi/linux/vhost_types.h
> > >>> @@ -165,5 +165,7 @@ struct vhost_vdpa_iova_range {
> > >>>   #define VHOST_BACKEND_F_SUSPEND  0x4
> > >>>   /* Device can be resumed */
> > >>>   #define VHOST_BACKEND_F_RESUME  0x5
> > >>> +/* Device can enable virtqueues after DRIVER_OK */
> > >>
> > >> A bit more detail on what does this mean?
> > >> It's normally driver that enables VQs not device itself ...
> > >>
> > >
> > > I agree, it is not well explained.
> > >
> > > What about "Device supports the driver to enable virtqueues after DRIVER_OK"?
> > >
> > >>> +#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK  0x6
> >
> > Does this mean it is possible only after DRIVER_OK, or does it mean in
> > addition to before DRIVER_OK?  It isn't clear to me.
> >
> > Maybe something like
> > "Device supports virtqueue enable only after DRIVER_OK"
> > or
> > "Device supports virtqueue enable both before and after DRIVER_OK"
> >
>
> I agree too,
>
> With the previous suggestion it would be:
>
> "Device supports the driver to enable virtqueues both before and after
> DRIVER_OK"

Btw, I think it might be worth clarifying whether or not this is
supported by the current virtio spec. Spec seems to be unclear on
this:

1) The driver MUST NOT write a 0 to queue_enable.
2) if reset is support, driver can wrote 1 to re-enable a virtqueue

But it doesn't say if the driver can write 1 after DRIVER_OK without reset.

Thanks


>
> Does it look better?
>
> Thanks!
>
> > sln
> >
> >
> > >>>
> > >>>   #endif
> > >>> --
> > >>> 2.31.1
> > >>
> > >
> >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag
  2023-05-24  4:06           ` [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag Jason Wang
@ 2023-05-24 10:10             ` Michael S. Tsirkin
  2023-05-26  6:21               ` Jason Wang
  2023-05-24 16:25             ` Eugenio Perez Martin
  1 sibling, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2023-05-24 10:10 UTC (permalink / raw)
  To: Jason Wang
  Cc: Eugenio Perez Martin, Shannon Nelson, si-wei.liu, longpeng2,
	Lei Yang, Laurent Vivier, alvaro.karsz, Gautam Dawar, Cindy Lu,
	Zhu Lingshan, Liuxiangdong, Parav Pandit, Harpreet Singh Anand,
	Gonglei (Arei), Shannon Nelson, Stefano Garzarella,
	Dragos Tatulea, Virtio-Dev

On Wed, May 24, 2023 at 12:06:47PM +0800, Jason Wang wrote:
> On Tue, May 23, 2023 at 1:55 PM Eugenio Perez Martin
> <eperezma@redhat.com> wrote:
> >
> > On Mon, May 22, 2023 at 11:22 PM Shannon Nelson <shannon.nelson@amd.com> wrote:
> > >
> > > On 5/22/23 1:07 PM, Eugenio Perez Martin wrote:
> > > >
> > > > On Mon, May 22, 2023 at 9:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > > >>
> > > >> On Mon, May 22, 2023 at 08:57:27PM +0200, Eugenio Pérez wrote:
> > > >>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > > >>> ---
> > > >>>   include/uapi/linux/vhost_types.h | 2 ++
> > > >>>   1 file changed, 2 insertions(+)
> > > >>>
> > > >>> diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
> > > >>> index c5690a8992d8..a1b316f49b38 100644
> > > >>> --- a/include/uapi/linux/vhost_types.h
> > > >>> +++ b/include/uapi/linux/vhost_types.h
> > > >>> @@ -165,5 +165,7 @@ struct vhost_vdpa_iova_range {
> > > >>>   #define VHOST_BACKEND_F_SUSPEND  0x4
> > > >>>   /* Device can be resumed */
> > > >>>   #define VHOST_BACKEND_F_RESUME  0x5
> > > >>> +/* Device can enable virtqueues after DRIVER_OK */
> > > >>
> > > >> A bit more detail on what does this mean?
> > > >> It's normally driver that enables VQs not device itself ...
> > > >>
> > > >
> > > > I agree, it is not well explained.
> > > >
> > > > What about "Device supports the driver to enable virtqueues after DRIVER_OK"?
> > > >
> > > >>> +#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK  0x6
> > >
> > > Does this mean it is possible only after DRIVER_OK, or does it mean in
> > > addition to before DRIVER_OK?  It isn't clear to me.
> > >
> > > Maybe something like
> > > "Device supports virtqueue enable only after DRIVER_OK"
> > > or
> > > "Device supports virtqueue enable both before and after DRIVER_OK"
> > >
> >
> > I agree too,
> >
> > With the previous suggestion it would be:
> >
> > "Device supports the driver to enable virtqueues both before and after
> > DRIVER_OK"
> 
> Btw, I think it might be worth clarifying whether or not this is
> supported by the current virtio spec. Spec seems to be unclear on
> this:
> 
> 1) The driver MUST NOT write a 0 to queue_enable.
> 2) if reset is support, driver can wrote 1 to re-enable a virtqueue
> 
> But it doesn't say if the driver can write 1 after DRIVER_OK without reset.
> 
> Thanks

I don't think it can. Do any drivers do this?


> 
> >
> > Does it look better?
> >
> > Thanks!
> >
> > > sln
> > >
> > >
> > > >>>
> > > >>>   #endif
> > > >>> --
> > > >>> 2.31.1
> > > >>
> > > >
> > >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag
  2023-05-24  4:06           ` [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag Jason Wang
  2023-05-24 10:10             ` Michael S. Tsirkin
@ 2023-05-24 16:25             ` Eugenio Perez Martin
  2023-05-26  6:25               ` Jason Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Eugenio Perez Martin @ 2023-05-24 16:25 UTC (permalink / raw)
  To: Jason Wang
  Cc: Shannon Nelson, Michael S. Tsirkin, si-wei.liu, longpeng2,
	Lei Yang, Laurent Vivier, alvaro.karsz, Gautam Dawar, Cindy Lu,
	Zhu Lingshan, Liuxiangdong, Parav Pandit, Harpreet Singh Anand,
	Gonglei (Arei), Shannon Nelson, Stefano Garzarella,
	Dragos Tatulea, Virtio-Dev

On Wed, May 24, 2023 at 6:07 AM Jason Wang <jasowang@redhat.com> wrote:
>
> On Tue, May 23, 2023 at 1:55 PM Eugenio Perez Martin
> <eperezma@redhat.com> wrote:
> >
> > On Mon, May 22, 2023 at 11:22 PM Shannon Nelson <shannon.nelson@amd.com> wrote:
> > >
> > > On 5/22/23 1:07 PM, Eugenio Perez Martin wrote:
> > > >
> > > > On Mon, May 22, 2023 at 9:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > > >>
> > > >> On Mon, May 22, 2023 at 08:57:27PM +0200, Eugenio Pérez wrote:
> > > >>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > > >>> ---
> > > >>>   include/uapi/linux/vhost_types.h | 2 ++
> > > >>>   1 file changed, 2 insertions(+)
> > > >>>
> > > >>> diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
> > > >>> index c5690a8992d8..a1b316f49b38 100644
> > > >>> --- a/include/uapi/linux/vhost_types.h
> > > >>> +++ b/include/uapi/linux/vhost_types.h
> > > >>> @@ -165,5 +165,7 @@ struct vhost_vdpa_iova_range {
> > > >>>   #define VHOST_BACKEND_F_SUSPEND  0x4
> > > >>>   /* Device can be resumed */
> > > >>>   #define VHOST_BACKEND_F_RESUME  0x5
> > > >>> +/* Device can enable virtqueues after DRIVER_OK */
> > > >>
> > > >> A bit more detail on what does this mean?
> > > >> It's normally driver that enables VQs not device itself ...
> > > >>
> > > >
> > > > I agree, it is not well explained.
> > > >
> > > > What about "Device supports the driver to enable virtqueues after DRIVER_OK"?
> > > >
> > > >>> +#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK  0x6
> > >
> > > Does this mean it is possible only after DRIVER_OK, or does it mean in
> > > addition to before DRIVER_OK?  It isn't clear to me.
> > >
> > > Maybe something like
> > > "Device supports virtqueue enable only after DRIVER_OK"
> > > or
> > > "Device supports virtqueue enable both before and after DRIVER_OK"
> > >
> >
> > I agree too,
> >
> > With the previous suggestion it would be:
> >
> > "Device supports the driver to enable virtqueues both before and after
> > DRIVER_OK"
>
> Btw, I think it might be worth clarifying whether or not this is
> supported by the current virtio spec. Spec seems to be unclear on
> this:
>
> 1) The driver MUST NOT write a 0 to queue_enable.
> 2) if reset is support, driver can wrote 1 to re-enable a virtqueue
>
> But it doesn't say if the driver can write 1 after DRIVER_OK without reset.
>

To double check, you mean to write 1 even if the queue is live?
"without reset *the virtqueue*"?

I'd add another combination that might be worth clarifying: ack
VIRTIO_F_RING_RESET, write 1 to queue_enable, then write 1 to
queue_reset. Set state DRIVER_OK, and then enable the queue
afterwards. Is this valid?

I guess it is not, but I don't see the standard forbidding it, isn't it?

Thanks!

> Thanks
>
>
> >
> > Does it look better?
> >
> > Thanks!
> >
> > > sln
> > >
> > >
> > > >>>
> > > >>>   #endif
> > > >>> --
> > > >>> 2.31.1
> > > >>
> > > >
> > >
> >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag
  2023-05-24 10:10             ` Michael S. Tsirkin
@ 2023-05-26  6:21               ` Jason Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2023-05-26  6:21 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Eugenio Perez Martin, Shannon Nelson, si-wei.liu, longpeng2,
	Lei Yang, Laurent Vivier, alvaro.karsz, Gautam Dawar, Cindy Lu,
	Zhu Lingshan, Liuxiangdong, Parav Pandit, Harpreet Singh Anand,
	Gonglei (Arei), Shannon Nelson, Stefano Garzarella,
	Dragos Tatulea, Virtio-Dev

On Wed, May 24, 2023 at 6:10 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Wed, May 24, 2023 at 12:06:47PM +0800, Jason Wang wrote:
> > On Tue, May 23, 2023 at 1:55 PM Eugenio Perez Martin
> > <eperezma@redhat.com> wrote:
> > >
> > > On Mon, May 22, 2023 at 11:22 PM Shannon Nelson <shannon.nelson@amd.com> wrote:
> > > >
> > > > On 5/22/23 1:07 PM, Eugenio Perez Martin wrote:
> > > > >
> > > > > On Mon, May 22, 2023 at 9:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > > > >>
> > > > >> On Mon, May 22, 2023 at 08:57:27PM +0200, Eugenio Pérez wrote:
> > > > >>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > > > >>> ---
> > > > >>>   include/uapi/linux/vhost_types.h | 2 ++
> > > > >>>   1 file changed, 2 insertions(+)
> > > > >>>
> > > > >>> diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
> > > > >>> index c5690a8992d8..a1b316f49b38 100644
> > > > >>> --- a/include/uapi/linux/vhost_types.h
> > > > >>> +++ b/include/uapi/linux/vhost_types.h
> > > > >>> @@ -165,5 +165,7 @@ struct vhost_vdpa_iova_range {
> > > > >>>   #define VHOST_BACKEND_F_SUSPEND  0x4
> > > > >>>   /* Device can be resumed */
> > > > >>>   #define VHOST_BACKEND_F_RESUME  0x5
> > > > >>> +/* Device can enable virtqueues after DRIVER_OK */
> > > > >>
> > > > >> A bit more detail on what does this mean?
> > > > >> It's normally driver that enables VQs not device itself ...
> > > > >>
> > > > >
> > > > > I agree, it is not well explained.
> > > > >
> > > > > What about "Device supports the driver to enable virtqueues after DRIVER_OK"?
> > > > >
> > > > >>> +#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK  0x6
> > > >
> > > > Does this mean it is possible only after DRIVER_OK, or does it mean in
> > > > addition to before DRIVER_OK?  It isn't clear to me.
> > > >
> > > > Maybe something like
> > > > "Device supports virtqueue enable only after DRIVER_OK"
> > > > or
> > > > "Device supports virtqueue enable both before and after DRIVER_OK"
> > > >
> > >
> > > I agree too,
> > >
> > > With the previous suggestion it would be:
> > >
> > > "Device supports the driver to enable virtqueues both before and after
> > > DRIVER_OK"
> >
> > Btw, I think it might be worth clarifying whether or not this is
> > supported by the current virtio spec. Spec seems to be unclear on
> > this:
> >
> > 1) The driver MUST NOT write a 0 to queue_enable.
> > 2) if reset is support, driver can wrote 1 to re-enable a virtqueue
> >
> > But it doesn't say if the driver can write 1 after DRIVER_OK without reset.
> >
> > Thanks
>
> I don't think it can. Do any drivers do this?

I don't know. But the spec is unclear in this. And Qemu seems to
support this which is probably a side effect since vq reset.

    case VIRTIO_PCI_COMMON_Q_ENABLE:
        if (val == 1) {
            virtio_queue_set_num(vdev, vdev->queue_sel,
                                 proxy->vqs[vdev->queue_sel].num);
            virtio_queue_set_rings(vdev, vdev->queue_sel,
                       ((uint64_t)proxy->vqs[vdev->queue_sel].desc[1]) << 32 |
                       proxy->vqs[vdev->queue_sel].desc[0],
                       ((uint64_t)proxy->vqs[vdev->queue_sel].avail[1]) << 32 |
                       proxy->vqs[vdev->queue_sel].avail[0],
                       ((uint64_t)proxy->vqs[vdev->queue_sel].used[1]) << 32 |
                       proxy->vqs[vdev->queue_sel].used[0]);
            proxy->vqs[vdev->queue_sel].enabled = 1;
            proxy->vqs[vdev->queue_sel].reset = 0;
            virtio_queue_enable(vdev, vdev->queue_sel);

We need either

1) relax the spec to allow this feature
2) or fix the qemu (not sure if it's too late to do this) and have a
new feature for queue_enable after DRIVER_OK

Thanks

>
>
> >
> > >
> > > Does it look better?
> > >
> > > Thanks!
> > >
> > > > sln
> > > >
> > > >
> > > > >>>
> > > > >>>   #endif
> > > > >>> --
> > > > >>> 2.31.1
> > > > >>
> > > > >
> > > >
> > >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag
  2023-05-24 16:25             ` Eugenio Perez Martin
@ 2023-05-26  6:25               ` Jason Wang
  2023-05-26  8:08                 ` Eugenio Perez Martin
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Wang @ 2023-05-26  6:25 UTC (permalink / raw)
  To: Eugenio Perez Martin
  Cc: Shannon Nelson, Michael S. Tsirkin, si-wei.liu, longpeng2,
	Lei Yang, Laurent Vivier, alvaro.karsz, Gautam Dawar, Cindy Lu,
	Zhu Lingshan, Liuxiangdong, Parav Pandit, Harpreet Singh Anand,
	Gonglei (Arei), Shannon Nelson, Stefano Garzarella,
	Dragos Tatulea, Virtio-Dev

On Thu, May 25, 2023 at 12:25 AM Eugenio Perez Martin
<eperezma@redhat.com> wrote:
>
> On Wed, May 24, 2023 at 6:07 AM Jason Wang <jasowang@redhat.com> wrote:
> >
> > On Tue, May 23, 2023 at 1:55 PM Eugenio Perez Martin
> > <eperezma@redhat.com> wrote:
> > >
> > > On Mon, May 22, 2023 at 11:22 PM Shannon Nelson <shannon.nelson@amd.com> wrote:
> > > >
> > > > On 5/22/23 1:07 PM, Eugenio Perez Martin wrote:
> > > > >
> > > > > On Mon, May 22, 2023 at 9:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > > > >>
> > > > >> On Mon, May 22, 2023 at 08:57:27PM +0200, Eugenio Pérez wrote:
> > > > >>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > > > >>> ---
> > > > >>>   include/uapi/linux/vhost_types.h | 2 ++
> > > > >>>   1 file changed, 2 insertions(+)
> > > > >>>
> > > > >>> diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
> > > > >>> index c5690a8992d8..a1b316f49b38 100644
> > > > >>> --- a/include/uapi/linux/vhost_types.h
> > > > >>> +++ b/include/uapi/linux/vhost_types.h
> > > > >>> @@ -165,5 +165,7 @@ struct vhost_vdpa_iova_range {
> > > > >>>   #define VHOST_BACKEND_F_SUSPEND  0x4
> > > > >>>   /* Device can be resumed */
> > > > >>>   #define VHOST_BACKEND_F_RESUME  0x5
> > > > >>> +/* Device can enable virtqueues after DRIVER_OK */
> > > > >>
> > > > >> A bit more detail on what does this mean?
> > > > >> It's normally driver that enables VQs not device itself ...
> > > > >>
> > > > >
> > > > > I agree, it is not well explained.
> > > > >
> > > > > What about "Device supports the driver to enable virtqueues after DRIVER_OK"?
> > > > >
> > > > >>> +#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK  0x6
> > > >
> > > > Does this mean it is possible only after DRIVER_OK, or does it mean in
> > > > addition to before DRIVER_OK?  It isn't clear to me.
> > > >
> > > > Maybe something like
> > > > "Device supports virtqueue enable only after DRIVER_OK"
> > > > or
> > > > "Device supports virtqueue enable both before and after DRIVER_OK"
> > > >
> > >
> > > I agree too,
> > >
> > > With the previous suggestion it would be:
> > >
> > > "Device supports the driver to enable virtqueues both before and after
> > > DRIVER_OK"
> >
> > Btw, I think it might be worth clarifying whether or not this is
> > supported by the current virtio spec. Spec seems to be unclear on
> > this:
> >
> > 1) The driver MUST NOT write a 0 to queue_enable.
> > 2) if reset is support, driver can wrote 1 to re-enable a virtqueue
> >
> > But it doesn't say if the driver can write 1 after DRIVER_OK without reset.
> >
>
> To double check, you mean to write 1 even if the queue is live?
> "without reset *the virtqueue*"?

No I mean something like this

1) write queue_enable to cvq
2) set DRIVER_OK
3) restore
4) write queue_enable to txq 0

>
> I'd add another combination that might be worth clarifying: ack
> VIRTIO_F_RING_RESET, write 1 to queue_enable, then write 1 to
> queue_reset. Set state DRIVER_OK, and then enable the queue
> afterwards. Is this valid?

Spec doesn't say it can't so it's implementation specific which is
probably suboptimal. But as replied in another thread this seems to be
supported by Qemu.

>
> I guess it is not, but I don't see the standard forbidding it, isn't it?

Yes, this needs to be fixed.

But one point here is that we should make svq work without RING_RESET
(or we can say if RING_REST implies the feature you proposed here)

Thanks

>
> Thanks!
>
> > Thanks
> >
> >
> > >
> > > Does it look better?
> > >
> > > Thanks!
> > >
> > > > sln
> > > >
> > > >
> > > > >>>
> > > > >>>   #endif
> > > > >>> --
> > > > >>> 2.31.1
> > > > >>
> > > > >
> > > >
> > >
> >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag
  2023-05-26  6:25               ` Jason Wang
@ 2023-05-26  8:08                 ` Eugenio Perez Martin
  0 siblings, 0 replies; 6+ messages in thread
From: Eugenio Perez Martin @ 2023-05-26  8:08 UTC (permalink / raw)
  To: Jason Wang
  Cc: Shannon Nelson, Michael S. Tsirkin, si-wei.liu, longpeng2,
	Lei Yang, Laurent Vivier, alvaro.karsz, Gautam Dawar, Cindy Lu,
	Zhu Lingshan, Liuxiangdong, Parav Pandit, Harpreet Singh Anand,
	Gonglei (Arei), Shannon Nelson, Stefano Garzarella,
	Dragos Tatulea, Virtio-Dev

On Fri, May 26, 2023 at 8:26 AM Jason Wang <jasowang@redhat.com> wrote:
>
> On Thu, May 25, 2023 at 12:25 AM Eugenio Perez Martin
> <eperezma@redhat.com> wrote:
> >
> > On Wed, May 24, 2023 at 6:07 AM Jason Wang <jasowang@redhat.com> wrote:
> > >
> > > On Tue, May 23, 2023 at 1:55 PM Eugenio Perez Martin
> > > <eperezma@redhat.com> wrote:
> > > >
> > > > On Mon, May 22, 2023 at 11:22 PM Shannon Nelson <shannon.nelson@amd.com> wrote:
> > > > >
> > > > > On 5/22/23 1:07 PM, Eugenio Perez Martin wrote:
> > > > > >
> > > > > > On Mon, May 22, 2023 at 9:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > > > > >>
> > > > > >> On Mon, May 22, 2023 at 08:57:27PM +0200, Eugenio Pérez wrote:
> > > > > >>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > > > > >>> ---
> > > > > >>>   include/uapi/linux/vhost_types.h | 2 ++
> > > > > >>>   1 file changed, 2 insertions(+)
> > > > > >>>
> > > > > >>> diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
> > > > > >>> index c5690a8992d8..a1b316f49b38 100644
> > > > > >>> --- a/include/uapi/linux/vhost_types.h
> > > > > >>> +++ b/include/uapi/linux/vhost_types.h
> > > > > >>> @@ -165,5 +165,7 @@ struct vhost_vdpa_iova_range {
> > > > > >>>   #define VHOST_BACKEND_F_SUSPEND  0x4
> > > > > >>>   /* Device can be resumed */
> > > > > >>>   #define VHOST_BACKEND_F_RESUME  0x5
> > > > > >>> +/* Device can enable virtqueues after DRIVER_OK */
> > > > > >>
> > > > > >> A bit more detail on what does this mean?
> > > > > >> It's normally driver that enables VQs not device itself ...
> > > > > >>
> > > > > >
> > > > > > I agree, it is not well explained.
> > > > > >
> > > > > > What about "Device supports the driver to enable virtqueues after DRIVER_OK"?
> > > > > >
> > > > > >>> +#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK  0x6
> > > > >
> > > > > Does this mean it is possible only after DRIVER_OK, or does it mean in
> > > > > addition to before DRIVER_OK?  It isn't clear to me.
> > > > >
> > > > > Maybe something like
> > > > > "Device supports virtqueue enable only after DRIVER_OK"
> > > > > or
> > > > > "Device supports virtqueue enable both before and after DRIVER_OK"
> > > > >
> > > >
> > > > I agree too,
> > > >
> > > > With the previous suggestion it would be:
> > > >
> > > > "Device supports the driver to enable virtqueues both before and after
> > > > DRIVER_OK"
> > >
> > > Btw, I think it might be worth clarifying whether or not this is
> > > supported by the current virtio spec. Spec seems to be unclear on
> > > this:
> > >
> > > 1) The driver MUST NOT write a 0 to queue_enable.
> > > 2) if reset is support, driver can wrote 1 to re-enable a virtqueue
> > >
> > > But it doesn't say if the driver can write 1 after DRIVER_OK without reset.
> > >
> >
> > To double check, you mean to write 1 even if the queue is live?
> > "without reset *the virtqueue*"?
>
> No I mean something like this
>
> 1) write queue_enable to cvq
> 2) set DRIVER_OK
> 3) restore
> 4) write queue_enable to txq 0
>
> >
> > I'd add another combination that might be worth clarifying: ack
> > VIRTIO_F_RING_RESET, write 1 to queue_enable, then write 1 to
> > queue_reset. Set state DRIVER_OK, and then enable the queue
> > afterwards. Is this valid?
>
> Spec doesn't say it can't so it's implementation specific which is
> probably suboptimal. But as replied in another thread this seems to be
> supported by Qemu.
>

Right, as long as the queue number is valid qemu allows it at this moment.

> >
> > I guess it is not, but I don't see the standard forbidding it, isn't it?
>
> Yes, this needs to be fixed.
>
> But one point here is that we should make svq work without RING_RESET
> (or we can say if RING_REST implies the feature you proposed here)
>

If RING_RESET implies that the driver can enable just CVQ and that it
can enable data vqs after DRIVER_OK and is easy to implement for hw
vendors, I think it is easier to reuse it, instead of creating a new
feature bit that overlaps so much with it.

Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-26  8:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230522185730.3233001-1-eperezma@redhat.com>
     [not found] ` <20230522185730.3233001-2-eperezma@redhat.com>
     [not found]   ` <20230522152226-mutt-send-email-mst@kernel.org>
     [not found]     ` <CAJaqyWfSzqdyPHogzccuYBeThJgcx-A_AfF8tmqLgxKNVczBWA@mail.gmail.com>
     [not found]       ` <1735e461-a858-5bf2-bf9f-d9418e281d0c@amd.com>
     [not found]         ` <CAJaqyWd632RiE9Zhc8OLsQbnaC42VG1FW97UMDHPQRofukYPrg@mail.gmail.com>
2023-05-24  4:06           ` [virtio-dev] Re: [RFC 1/4] vdpa: add VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK flag Jason Wang
2023-05-24 10:10             ` Michael S. Tsirkin
2023-05-26  6:21               ` Jason Wang
2023-05-24 16:25             ` Eugenio Perez Martin
2023-05-26  6:25               ` Jason Wang
2023-05-26  8:08                 ` Eugenio Perez Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox