DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Tiwei Bie <tiwei.bie@intel.com>, oda@valinux.co.jp
Cc: dev@dpdk.org, yinan.wang@intel.com, amorenoz@redhat.com,
	david.marchand@redhat.com
Subject: Re: [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig
Date: Wed, 19 Feb 2020 09:17:41 +0100	[thread overview]
Message-ID: <65a4582d-14f6-9833-0d15-b91052972e09@redhat.com> (raw)
In-Reply-To: <20200219034357.GA975055@___>

Hi Tiwei,

On 2/19/20 4:44 AM, Tiwei Bie wrote:
> On Tue, Feb 18, 2020 at 06:22:40PM +0100, Maxime Coquelin wrote:
>> Ethdev's .dev_configure callback can be called multiple
>> time during a device life-time, but Vhost makes the
>> wrong assumption that it is not the case and try to
>> setup again the device on reconfiguration.
>>
>> This patch ensures the device hasn't been already setup
>> before proceeding.
>>
>> Fixes: 3d01b759d267 ("net/vhost: delay driver setup")
>>
>> Reported-by: Yinan Wang <yinan.wang@intel.com>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Tested-by: Yinan Wang <yinan.wang@intel.com>
>> Reviewed-by: David Marchand <david.marchand@redhat.com>
>> ---
>>  drivers/net/vhost/rte_eth_vhost.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
>> index 4a7b1b608c..458ed58f5f 100644
>> --- a/drivers/net/vhost/rte_eth_vhost.c
>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>> @@ -876,6 +876,11 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
>>  	unsigned int numa_node = eth_dev->device->numa_node;
>>  	const char *name = eth_dev->device->name;
>>  
>> +	/* Don't try to setup again if it has already been done. */
>> +	list = find_internal_resource(internal->iface_name);
>> +	if (list)
>> +		return 0;
>> +
>>  	list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
>>  	if (list == NULL)
>>  		return -1;
>> -- 
>> 2.24.1
> 
> Thanks Maxime for the fix!
> 
> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
> 
> Not related to this fix, it seems there is a potential leak after
> delaying the driver setup to _configure, as the list won't be
> registered until users configure the device. So internal->iface_name
> allocated in _create will leak if the device is released without
> doing _configure first.
> 
> https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1058
> https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1075
> 
> It's not a common case and it's quite late in this release,
> probably it's fine to fix it later.

That's a valid point, and I also agree there is no urgency for v20.02.
Itsuro, would you take care of fixing it for v20.05?

Thanks,
Maxime
> Thanks,
> Tiwei
> 


  reply	other threads:[~2020-02-19  8:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
2020-02-18 17:22 ` [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path Maxime Coquelin
2020-02-19  3:05   ` Tiwei Bie
2020-02-18 17:22 ` [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig Maxime Coquelin
2020-02-19  3:44   ` Tiwei Bie
2020-02-19  8:17     ` Maxime Coquelin [this message]
2020-02-19 22:17       ` Itsuro ODA
2020-02-18 17:25 ` [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
2020-02-18 22:37 ` Itsuro ODA
2020-02-19 10:16   ` Maxime Coquelin
2020-02-19 10:18 ` Maxime Coquelin
2020-02-19 11:17   ` Kevin Traynor
2020-02-19 10:23 ` Maxime Coquelin
  -- strict thread matches above, loose matches on Subject: below --
2020-02-18 14:35 Maxime Coquelin
2020-02-18 14:35 ` [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig Maxime Coquelin
2020-02-18 15:26   ` Maxime Coquelin
2020-02-18 15:27   ` Wang, Yinan
2020-02-18 16:16   ` David Marchand

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=65a4582d-14f6-9833-0d15-b91052972e09@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=oda@valinux.co.jp \
    --cc=tiwei.bie@intel.com \
    --cc=yinan.wang@intel.com \
    /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).