From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Tiwei Bie <tiwei.bie@intel.com>
Cc: dev@dpdk.org, yliu@fridaylinux.org, jianfeng.tan@intel.com,
lprosek@redhat.com, lersek@redhat.com
Subject: Re: [dpdk-dev] [PATCH v3 1/4] vhost: prevent features to be changed while device is running
Date: Thu, 7 Dec 2017 09:39:06 +0100 [thread overview]
Message-ID: <041f54c0-4222-eedc-615d-4aa6c2503438@redhat.com> (raw)
In-Reply-To: <20171207080820.jkzcam47deipsqcv@debian-xvivbkq>
On 12/07/2017 09:08 AM, Tiwei Bie wrote:
> On Wed, Dec 06, 2017 at 10:20:45AM +0100, Maxime Coquelin wrote:
>> As section 2.2 of the Virtio spec states about features
>> negotiation:
>> "During device initialization, the driver reads this and tells
>> the device the subset that it accepts. The only way to
>> renegotiate is to reset the device."
>>
>> This patch implements a check to prevent illegal features change
>> while the device is running.
>>
>> One exception is the VHOST_F_LOG_ALL feature bit, which is enabled
>> when live-migration is initiated. But this feature is not negotiated
>> with the Virtio driver, but directly with the Vhost master.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>> lib/librte_vhost/vhost_user.c | 17 ++++++++++++++++-
>> 1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
>> index f4c7ce462..2d86c0ca8 100644
>> --- a/lib/librte_vhost/vhost_user.c
>> +++ b/lib/librte_vhost/vhost_user.c
>> @@ -183,7 +183,22 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features)
>> return -1;
>> }
>>
>> - if ((dev->flags & VIRTIO_DEV_RUNNING) && dev->features != features) {
>> + if (dev->features == features)
>> + return 0;
>> +
>
> We couldn't return directly when dev->features == features.
> Otherwise, if the features provided by virtio driver is 0,
> dev->vhost_hlen won't get a chance to be initialized.
Good catch.
Either we do :
if ((dev->features == features) && dev->vhost_len)
return 0;
Or we could initialize dev->vhost_len to sizeof(struct virtio_net_hdr)
at alloc time.
I prefer the former, what do you think?
Thanks,
Maxime
> Best regards,
> Tiwei Bie
>
next prev parent reply other threads:[~2017-12-07 8:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 9:20 [dpdk-dev] [PATCH v3 0/4] Vhost: fix mq=on but VIRTIO_NET_F_MQ not negotiated Maxime Coquelin
2017-12-06 9:20 ` [dpdk-dev] [PATCH v3 1/4] vhost: prevent features to be changed while device is running Maxime Coquelin
2017-12-07 8:08 ` Tiwei Bie
2017-12-07 8:39 ` Maxime Coquelin [this message]
2017-12-07 10:29 ` Tiwei Bie
2017-12-06 9:20 ` [dpdk-dev] [PATCH v3 2/4] vhost: propagate VHOST_USER_SET_FEATURES handling error Maxime Coquelin
2017-12-06 9:20 ` [dpdk-dev] [PATCH v3 3/4] vhost: extract virtqueue cleaning and freeing functions Maxime Coquelin
2017-12-06 9:20 ` [dpdk-dev] [PATCH v3 4/4] vhost: destroy unused virtqueues when multiqueue not negotiated Maxime Coquelin
2017-12-06 11:40 ` [dpdk-dev] [PATCH v3 0/4] Vhost: fix mq=on but VIRTIO_NET_F_MQ " Laszlo Ersek
2017-12-06 12:25 ` Ladi Prosek
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=041f54c0-4222-eedc-615d-4aa6c2503438@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@intel.com \
--cc=lersek@redhat.com \
--cc=lprosek@redhat.com \
--cc=tiwei.bie@intel.com \
--cc=yliu@fridaylinux.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).