From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by dpdk.org (Postfix) with ESMTP id B2BF4B411 for ; Wed, 18 Feb 2015 11:33:07 +0100 (CET) Received: by wesw62 with SMTP id w62so214409wes.9 for ; Wed, 18 Feb 2015 02:33:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=EkAqhITrkSo3j4USC/xyZZGTiCWxFnameot6s6Xiya4=; b=kNwswWmQDL+mPpXc7F74BXSsaPBCIXGCDPCH/0PUeRb/Fk/p8UOobU94l+aC2LnGEQ /ZCeaVI5T9qG2P3IYzFB8x+/k1qvknM4uZ/SvsIbWgXVlmzggk32gyYrh3P7FM4iImOe 9uB6m+N38JDgwStS6OvePtcG74vBPffibCbNJMsXoGHWE18dSBZUR2SAso4UZCwvuBMY H8SlZWG3pFz51MPL62KZM4a7hEnNx6QKK/VVdAHsQ+QTmmYM7iW1WNeBfPZWT4gMgBTf b23oUlhALxDk6Hacy7PrAIzqgcLx3AGlHG4BG9EM2y6Xs37xIxMb93JDE+chk0gptnSj FUUQ== X-Gm-Message-State: ALoCoQn9Otr1MPTpD73ze2DarYcSwtCJJg38h9H1/CbH1UH2J/eygd94KLx21m5Wssf6RSCZAQ2q X-Received: by 10.180.212.8 with SMTP id ng8mr3610878wic.18.1424255587563; Wed, 18 Feb 2015 02:33:07 -0800 (PST) Received: from xps13.localnet (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id r3sm27614820wjw.7.2015.02.18.02.33.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Feb 2015 02:33:06 -0800 (PST) From: Thomas Monjalon To: "Iremonger, Bernard" Date: Wed, 18 Feb 2015 11:32:38 +0100 Message-ID: <2590241.Y3C96lux3o@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <8CEF83825BEC744B83065625E567D7C2049EAA9F@IRSMSX108.ger.corp.intel.com> References: <1423470639-15744-2-git-send-email-mukawa@igel.co.jp> <54E3F10A.4090303@igel.co.jp> <8CEF83825BEC744B83065625E567D7C2049EAA9F@IRSMSX108.ger.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v8 04/14] eal/pci: Consolidate pci address comparison APIs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2015 10:33:07 -0000 Hi Bernard, 2015-02-18 10:26, Iremonger, Bernard: > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tetsuya Mukawa > > On 2015/02/18 10:02, Thomas Monjalon wrote: > > > 2015-02-17 15:14, Tetsuya Mukawa: > > >> On 2015/02/17 9:44, Thomas Monjalon wrote: > > >>> 2015-02-16 13:14, Tetsuya Mukawa: > > >>>> @@ -356,13 +342,24 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) > > >>>> } > > >>>> else { > > >>>> struct rte_pci_device *dev2 = NULL; > > >>>> + int ret; > > >>>> > > >>>> TAILQ_FOREACH(dev2, &pci_device_list, next) { > > >>>> - if (pci_addr_comparison(&dev->addr, &dev2->addr)) > > >>>> + ret = eal_compare_pci_addr(&dev->addr, &dev2->addr); > > >>>> + if (ret > 0) > > >>>> continue; > > >>>> - else { > > >>>> + else if (ret < 0) { > > >>>> TAILQ_INSERT_BEFORE(dev2, dev, next); > > >>>> return 0; > > >>>> + } else { /* already registered */ > > >>>> + /* update pt_driver */ > > >>>> + dev2->pt_driver = dev->pt_driver; > > >>>> + dev2->max_vfs = dev->max_vfs; > > >>>> + memmove(dev2->mem_resource, > > >>>> + dev->mem_resource, > > >>>> + sizeof(dev->mem_resource)); > > >>>> + free(dev); > > >>>> + return 0; > > >>> Could you comment this "else part" please? > > >> PCI device list is allocated when rte_eal_init() is called. At the > > >> time, to fill pci device information, sysfs value is used. > > >> If sysfs values written by kernel device driver will not be changed > > >> by igb_uio, vfio or pci_uio_genereic, above code isn't needed. > > >> But actually above values are changed or added by them. > > >> > > >> Here is a step to cause issue. > > >> 1. Boot linux. > > >> 2. Start DPDK application without any physical NIC ports. > > >> - Here, some sysfs values are read, and store to pci device list. > > >> 3. igb_uio starts managing a port. > > >> - Here, some sysfs values are changed. > > >> 4. Add a NIC port to DPDK application using hotplug functions. > > >> - Here, we need to replace some values. > > > > > > I think that you are showing that something is wrongly designed in > > > these EAL structures. I suggest to try cleaning this mess instead of workarounding. > > Hi Tetsuya, Thomas, > I think that redesigning the EAL structures is beyond the scope of this patchset and should be undertaken as a separate task. I strongly disagrees this opinion. We should never workaround design problems and add more complex/weird code. I think that this kind of consideration is the heart of some design problems we have to face today. Please let's stop adding some code which just works without thinking the whole design. > I suspect there may be a problem in the original code when a device which was using a kernel driver is bound to igb_uio. The igb_uio driver adds /sys/bus/pci/devices/0000\:05\:00.0/max_vfs.