From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id ABC564C74 for ; Mon, 5 Nov 2018 15:10:54 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id x12-v6so9668834wrw.8 for ; Mon, 05 Nov 2018 06:10:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=X5HKe5bS7T2O1mnTD6UnNC2TSp1vNDo5XmksdyZ3IZQ=; b=DO+lr2gCv64f3yP9U7aY5EGVWhX+MzQfv0g52rnrJx5rVFFQbaS+2cL34WHhlI2g7M TOLGeThhEQ8ZqCIeDkCWMZn3L06CEQMLnjEyMrmEZQlyqGmuRIwcgBkMYh5Oh0E7c3B4 NsI4Uk06RmqEmDTq9sFLWH9KaqMdw5ggHtUh3XYj5evaIc55OUIj6RCqRWnWAk33fSBz tgDB7HGULg4VMmXY77SayO5mrnRyXAd48HbePbq1x09g9cHwAmy74DrSFvOeuq1P7guf aAY4lnY5z0G4u8mt2M+i086ARBFrLW9E5MeJRho24vV6dlFWXa08EjbpJNuB/kom3i+K J7vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=X5HKe5bS7T2O1mnTD6UnNC2TSp1vNDo5XmksdyZ3IZQ=; b=FLqPCJeZqQioVC5TtgQ9cWa9oRRfjWRfbumKXzKEP9RKCRRPYF+tZIFcP7LXQOXn6R CnvuQrtZX0H9NfwOrz8TXVez8kd4oQvmVtpGMKcNfdWBLDtjuXZLdBLjAWM9MzGCwnRN hjwvIoMQFUh75pPN3K3BV04+kvVXroPUwcGtwHXiKbS115umSiwCVaxnC3XkdSGwH2yA mVz2rEThWewRGASXETqxNcUaBkBvry4ecMwoGEeLdEikbD218eznZw8Rr1nOdENVEpsX BK6ZwlMFU6eTyICxmOkoOZ4EKxBpYPltVQu4o8upUrh4J13FCSI2A4QVG6192JUFzzpA yMew== X-Gm-Message-State: AGRZ1gJW2+IlxuDeqAkBetb2EtpWFofcQaWfdZdXUSN/llpkX+vIIj54 6McQKy/1eFBv154Eu0Rh1lXPHQIAIIU= X-Google-Smtp-Source: AJdET5cuCWZCdnZNxxOKHii9sVuf4zJu1Nvv54aMHZXAZWbTEJPZYLDPzSW0JaiffUrgwdfTS3KLFQ== X-Received: by 2002:a05:6000:1283:: with SMTP id f3mr19048714wrx.140.1541427053832; Mon, 05 Nov 2018 06:10:53 -0800 (PST) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id u2-v6sm10334694wme.4.2018.11.05.06.10.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 06:10:52 -0800 (PST) Date: Mon, 5 Nov 2018 15:10:33 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Darek Stojaczyk Cc: dev@dpdk.org, thomas@monjalon.net, qi.z.zhang@intel.com Message-ID: <20181105141033.z3i3qfjoh6z26f4v@bidouze.vm.6wind.com> References: <20181105070447.67700-1-dariusz.stojaczyk@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181105070447.67700-1-dariusz.stojaczyk@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 1/3] bus/pci: update device devargs on each rescan 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: Mon, 05 Nov 2018 14:10:54 -0000 Hi Darek, On Mon, Nov 05, 2018 at 08:04:45AM +0100, Darek Stojaczyk wrote: > Bus rescan is done e.g. during the device hotplug, > where devargs are re-allocated. By not updating the > rte_device->devargs pointer we potentially make it > a dangling one, as previous devargs could have been > (or will be soon) freed. > > Fixes: 55e411b301c3 ("bus/pci: fix resource mapping override") > Cc: qi.z.zhang@intel.com > > Signed-off-by: Darek Stojaczyk > --- > drivers/bus/pci/linux/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c > index f87533c5c..f3172960e 100644 > --- a/drivers/bus/pci/linux/pci.c > +++ b/drivers/bus/pci/linux/pci.c > @@ -349,10 +349,10 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) > if (ret < 0) { > rte_pci_insert_device(dev2, dev); > } else { /* already registered */ > + pci_name_set(dev2); This is rather unfortunate to call pci_name_set() to trigger the mapping devargs <-> devices. pci_devargs_lookup could be made non-static instead, if that's sufficient. Given that the PCI id matches because the device is a duplicate (already registered), then the name itself probably does not need to be updated. > if (!rte_dev_is_probed(&dev2->device)) { > dev2->kdrv = dev->kdrv; > dev2->max_vfs = dev->max_vfs; > - pci_name_set(dev2); > memmove(dev2->mem_resource, > dev->mem_resource, > sizeof(dev->mem_resource)); > -- > 2.17.1 > -- Gaëtan Rivet 6WIND