qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: qemu-devel@nongnu.org, Liuxiangdong <liuxiangdong5@huawei.com>,
	Gautam Dawar <gdawar@xilinx.com>,
	alvaro.karsz@solid-run.com,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	Lei Yang <leiyang@redhat.com>,
	si-wei.liu@oracle.com, Eli Cohen <eli@mellanox.com>,
	Shannon Nelson <snelson@pensando.io>,
	Laurent Vivier <lvivier@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Parav Pandit <parav@mellanox.com>,
	Zhu Lingshan <lingshan.zhu@intel.com>, Cindy Lu <lulu@redhat.com>,
	longpeng2@huawei.com, Harpreet Singh Anand <hanand@xilinx.com>
Subject: Re: [PATCH for 8.1 v2 5/6] vdpa: move CVQ isolation check to net_init_vhost_vdpa
Date: Fri, 31 Mar 2023 16:00:35 +0800	[thread overview]
Message-ID: <0cc19893-f832-f03a-cbb0-19f053ff8aa7@redhat.com> (raw)
In-Reply-To: <CAJaqyWeUxm9=Hup58gsBypQXJbeW2BTu3YpV7VDVOA2rXbtPWg@mail.gmail.com>


在 2023/3/30 18:42, Eugenio Perez Martin 写道:
> On Thu, Mar 30, 2023 at 8:23 AM Jason Wang <jasowang@redhat.com> wrote:
>> On Thu, Mar 30, 2023 at 2:20 PM Jason Wang <jasowang@redhat.com> wrote:
>>> On Fri, Mar 24, 2023 at 3:54 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>>>> Evaluating it at start time instead of initialization time may make the
>>>> guest capable of dynamically adding or removing migration blockers.
>>>>
>>>> Also, moving to initialization reduces the number of ioctls in the
>>>> migration, reducing failure possibilities.
>>>>
>>>> As a drawback we need to check for CVQ isolation twice: one time with no
>>>> MQ negotiated and another one acking it, as long as the device supports
>>>> it.  This is because Vring ASID / group management is based on vq
>>>> indexes, but we don't know the index of CVQ before negotiating MQ.
>>> We need to fail if we see a device that can isolate cvq without MQ but
>>> not with MQ.
>>>
>>>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>>>> ---
>>>> v2: Take out the reset of the device from vhost_vdpa_cvq_is_isolated
>>>> ---
>>>>   net/vhost-vdpa.c | 194 ++++++++++++++++++++++++++++++++++++-----------
>>>>   1 file changed, 151 insertions(+), 43 deletions(-)
>>>>
>>>> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
>>>> index 4397c0d4b3..db2c9afcb3 100644
>>>> --- a/net/vhost-vdpa.c
>>>> +++ b/net/vhost-vdpa.c
>>>> @@ -43,6 +43,13 @@ typedef struct VhostVDPAState {
>>>>
>>>>       /* The device always have SVQ enabled */
>>>>       bool always_svq;
>>>> +
>>>> +    /* The device can isolate CVQ in its own ASID if MQ is negotiated */
>>>> +    bool cvq_isolated_mq;
>>>> +
>>>> +    /* The device can isolate CVQ in its own ASID if MQ is not negotiated */
>>>> +    bool cvq_isolated;
>>> As stated above, if we need a device that cvq_isolated_mq^cvq_isolated
>>> == true, we need to fail. This may reduce the complexity of the code?
>>>
>>> Thanks
>> Since we are the mediation layer, Qemu can alway choose to negotiate
>> MQ regardless whether or not it is supported by the guest. In this
>> way, we can have a stable virtqueue index for cvq.
>>
> I think it is a great idea and it simplifies this patch somehow.
> However, we need something like the queue mapping [1] to do so :).
>
> To double confirm:
> * If the device supports MQ, only probe MQ. If not, only probe !MQ.
> * Only store cvq_isolated in VhostVDPAState.
>
> Now, if the device does not negotiate MQ but the device supports MQ:


I'm not sure I understand here, if device supports MQ it should accepts 
MQ or we can fail the initialization here.


> * All the requests to queue 3 must be redirected to the last queue in
> the device. That includes set_vq_address, notifiers regions, etc.


This also means we will only mediate the case:

1) Qemu emulated virtio-net has 1 queue but device support multiple queue

but not

2) Qemu emulated virtio-net has M queue but device support N queue (N>M)


>
> I'm totally ok to go this route but it's not immediate.


Yes but I mean, we can start from failing the device if 
cvq_isolated_mq^cvq_isolated == true (or I wonder if we can meet this 
condition for any existing parents).

Thanks


>
> Thanks!
>
> [1] https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg07157.html
>



  reply	other threads:[~2023-03-31  8:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 19:53 [PATCH for 8.1 v2 0/6] Move ASID test to vhost-vdpa net initialization Eugenio Pérez
2023-03-23 19:53 ` [PATCH for 8.1 v2 1/6] vdpa: Remove status in reset tracing Eugenio Pérez
2023-03-27  9:33   ` Stefano Garzarella
2023-03-28  6:45   ` Jason Wang
2023-03-23 19:54 ` [PATCH for 8.1 v2 2/6] vdpa: add vhost_vdpa_reset_status_fd Eugenio Pérez
2023-03-27  9:34   ` Stefano Garzarella
2023-03-28  6:53   ` Jason Wang
2023-03-28  7:37     ` Eugenio Perez Martin
2023-04-21  7:45       ` Michael S. Tsirkin
2023-03-23 19:54 ` [PATCH for 8.1 v2 3/6] vdpa: add vhost_vdpa_set_dev_features_fd Eugenio Pérez
2023-03-30  6:15   ` Jason Wang
2023-03-23 19:54 ` [PATCH for 8.1 v2 4/6] vdpa: return errno in vhost_vdpa_get_vring_group error Eugenio Pérez
2023-03-27  9:34   ` Stefano Garzarella
2023-03-30  6:15   ` Jason Wang
2023-03-23 19:54 ` [PATCH for 8.1 v2 5/6] vdpa: move CVQ isolation check to net_init_vhost_vdpa Eugenio Pérez
2023-03-27  9:36   ` Stefano Garzarella
2023-03-30  6:20   ` Jason Wang
2023-03-30  6:23     ` Jason Wang
2023-03-30 10:42       ` Eugenio Perez Martin
2023-03-31  8:00         ` Jason Wang [this message]
2023-03-31 10:11           ` Eugenio Perez Martin
2023-04-03  5:32             ` Jason Wang
2023-04-03 17:21               ` Eugenio Perez Martin
2023-03-23 19:54 ` [PATCH for 8.1 v2 6/6] vdpa: Cache cvq group in VhostVDPAState Eugenio Pérez

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=0cc19893-f832-f03a-cbb0-19f053ff8aa7@redhat.com \
    --to=jasowang@redhat.com \
    --cc=alvaro.karsz@solid-run.com \
    --cc=arei.gonglei@huawei.com \
    --cc=eli@mellanox.com \
    --cc=eperezma@redhat.com \
    --cc=gdawar@xilinx.com \
    --cc=hanand@xilinx.com \
    --cc=leiyang@redhat.com \
    --cc=lingshan.zhu@intel.com \
    --cc=liuxiangdong5@huawei.com \
    --cc=longpeng2@huawei.com \
    --cc=lulu@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=si-wei.liu@oracle.com \
    --cc=snelson@pensando.io \
    /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).