From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH] bus/vdev: fix device argument corrupt after bus scan Date: Thu, 25 Oct 2018 11:51:18 +0200 Message-ID: <20181025095118.gnc75zvkuvfajtha@bidouze.vm.6wind.com> References: <20181025033036.23680-1-qi.z.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: thomas@monjalon.net, dev@dpdk.org, stable@dpdk.org To: Qi Zhang Return-path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id BA3E34C95 for ; Thu, 25 Oct 2018 11:51:38 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id u1-v6so8620994wrn.0 for ; Thu, 25 Oct 2018 02:51:38 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20181025033036.23680-1-qi.z.zhang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Oct 25, 2018 at 11:30:36AM +0800, Qi Zhang wrote: > It's not necessary to insert device argment to devargs_list > during bus scan, but this happens when we try to attach a > device on secondary process. The patch fix the issue. > > Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel") > Cc: stable@dpdk.org > > Signed-off-by: Qi Zhang > --- > drivers/bus/vdev/vdev.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c > index 688e31c21..818a2bfc2 100644 > --- a/drivers/bus/vdev/vdev.c > +++ b/drivers/bus/vdev/vdev.c > @@ -202,7 +202,9 @@ alloc_devargs(const char *name, const char *args) > } > > static int > -insert_vdev(const char *name, const char *args, struct rte_vdev_device **p_dev) > +insert_vdev(const char *name, const char *args, > + struct rte_vdev_device **p_dev, > + bool init) Why is vdev the only bus not using hotplug API itself and reimplementing it on its own? It should not have to insert devargs at all, not even in the primary process. If it called rte_dev_probe(), this would normally already be properly handled I think. > { > struct rte_vdev_device *dev; > struct rte_devargs *devargs; > @@ -237,7 +239,8 @@ insert_vdev(const char *name, const char *args, struct rte_vdev_device **p_dev) > } > > TAILQ_INSERT_TAIL(&vdev_device_list, dev, next); > - rte_devargs_insert(devargs); > + if (init) > + rte_devargs_insert(devargs); > > if (p_dev) > *p_dev = dev; > @@ -257,7 +260,7 @@ rte_vdev_init(const char *name, const char *args) > int ret; > > rte_spinlock_recursive_lock(&vdev_device_list_lock); > - ret = insert_vdev(name, args, &dev); > + ret = insert_vdev(name, args, &dev, true); > if (ret == 0) { > ret = vdev_probe_all_drivers(dev); > if (ret) { > @@ -383,7 +386,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer) > break; > case VDEV_SCAN_ONE: > VDEV_LOG(INFO, "receive vdev, %s", in->name); > - ret = insert_vdev(in->name, NULL, NULL); > + ret = insert_vdev(in->name, NULL, NULL, false); > if (ret == -EEXIST) > VDEV_LOG(DEBUG, "device already exist, %s", in->name); > else if (ret < 0) > -- > 2.13.6 > -- Gaëtan Rivet 6WIND