From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B01872BB1; Thu, 25 Oct 2018 05:29:30 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 20:29:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,422,1534834800"; d="scan'208";a="83969530" Received: from dpdk51.sh.intel.com ([10.67.110.190]) by orsmga007.jf.intel.com with ESMTP; 24 Oct 2018 20:29:28 -0700 From: Qi Zhang To: thomas@monjalon.net, gaetan.rivet@6wind.com Cc: dev@dpdk.org, Qi Zhang , stable@dpdk.org Date: Thu, 25 Oct 2018 11:30:36 +0800 Message-Id: <20181025033036.23680-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] bus/vdev: fix device argument corrupt after bus scan X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2018 03:29:31 -0000 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) { 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