From: Jason Wang <jasowang@redhat.com>
To: Gautam Dawar <gdawar@xilinx.com>,
"mst@redhat.com" <mst@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "qemu-stable@nongnu.org" <qemu-stable@nongnu.org>,
"lulu@redhat.com" <lulu@redhat.com>
Subject: Re: [PATCH 1/2] vhost-vdpa: don't initialize backend_features
Date: Tue, 8 Jun 2021 10:34:21 +0800 [thread overview]
Message-ID: <c1c417b9-097a-016a-f07d-0be1c3aae796@redhat.com> (raw)
In-Reply-To: <BY5PR02MB6980EE8C39C9369F5BD3CD0AB13B9@BY5PR02MB6980.namprd02.prod.outlook.com>
在 2021/6/4 下午5:10, Gautam Dawar 写道:
> Hi Jason,
>
> -----Original Message-----
> From: Jason Wang <jasowang@redhat.com>
> Sent: Wednesday, June 2, 2021 2:18 PM
> To: Gautam Dawar <gdawar@xilinx.com>; mst@redhat.com; qemu-devel@nongnu.org
> Cc: lulu@redhat.com; qemu-stable@nongnu.org
> Subject: Re: [PATCH 1/2] vhost-vdpa: don't initialize backend_features
>
> Hi Gautam:
>
> 在 2021/6/2 下午3:38, Gautam Dawar 写道:
>> Hi Jason,
>>
>> Pls see my comments inline marked by GD>>
>>
>> Regards,
>> Gautam
>>
>> -----Original Message-----
>> From: Jason Wang <jasowang@redhat.com>
>> Sent: Wednesday, June 2, 2021 9:01 AM
>> To: mst@redhat.com; qemu-devel@nongnu.org
>> Cc: Gautam Dawar <gdawar@xilinx.com>; lulu@redhat.com; Jason Wang
>> <jasowang@redhat.com>; qemu-stable@nongnu.org
>> Subject: [PATCH 1/2] vhost-vdpa: don't initialize backend_features
>>
>> We used to initialize backend_features during vhost_vdpa_init() regardless whether or not it was supported by vhost. This will lead the unsupported features like VIRTIO_F_IN_ORDER to be included and set to the vhost-vdpa during vhost_dev_start. Because the VIRTIO_F_IN_ORDER is not supported by vhost-vdpa so it won't be advertised to guest which will break the datapath.
>>
>> Fix this by not initializing the backend_features, so the acked_features could be built only from guest features via vhost_net_ack_features().
>>
>> Fixes: 108a64818e69b ("vhost-vdpa: introduce vhost-vdpa backend")
>> Cc: qemu-stable@nongnu.org
>> Cc: Gautam Dawar <gdawar@xilinx.com>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> hw/virtio/vhost-vdpa.c | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index
>> 01d2101d09..5fe43a4eb5 100644
>> --- a/hw/virtio/vhost-vdpa.c
>> +++ b/hw/virtio/vhost-vdpa.c
>> @@ -275,15 +275,12 @@ static void vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status) static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque) {
>> struct vhost_vdpa *v;
>> - uint64_t features;
>> assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_VDPA);
>> trace_vhost_vdpa_init(dev, opaque);
>>
>> v = opaque;
>> v->dev = dev;
>> dev->opaque = opaque ;
>> - vhost_vdpa_call(dev, VHOST_GET_FEATURES, &features);
>> - dev->backend_features = features;
>> [GD>>] Should this be initialized with 0 here? I am not sure if memory allocated for struct vhost_dev is initialized with 0.
>
> See vhost_net_init:
>
> struct vhost_net *net = g_new0(struct vhost_net, 1);
>
> vhost_dev is embedded in the vhost_net structure. So I think it should be zero.
>
> [GD>>] That's correct. The embedded vhost_dev structure is indeed getting cleared to 0 in vhost_net_init().
> Thanks
Ok, I've queued this patch.
Thanks
>
>
>> v->listener = vhost_vdpa_memory_listener;
>> v->msg_type = VHOST_IOTLB_MSG_V2;
>>
>> --
>> 2.25.1
>>
> [GD>>]
> Signed-off-by: Gautam Dawar <gdawar@xilinx.com>
> Acked-by: Gautam Dawar <gdawar@xilinx.com>
>
prev parent reply other threads:[~2021-06-08 2:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 3:31 [PATCH 1/2] vhost-vdpa: don't initialize backend_features Jason Wang
2021-06-02 3:31 ` [PATCH 2/2] vhost-vdpa: remove the unused vhost_vdpa_get_acked_features() Jason Wang
2021-06-05 17:19 ` Gautam Dawar
2021-06-08 2:36 ` Jason Wang
2021-06-02 7:38 ` [PATCH 1/2] vhost-vdpa: don't initialize backend_features Gautam Dawar
2021-06-02 8:48 ` Jason Wang
2021-06-04 9:10 ` Gautam Dawar
2021-06-08 2:34 ` Jason Wang [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=c1c417b9-097a-016a-f07d-0be1c3aae796@redhat.com \
--to=jasowang@redhat.com \
--cc=gdawar@xilinx.com \
--cc=lulu@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/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).