From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id A032B108F for ; Wed, 25 Jan 2017 12:17:00 +0100 (CET) Received: by mail-wm0-f41.google.com with SMTP id r126so21679279wmr.0 for ; Wed, 25 Jan 2017 03:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=r2EEjfWOCH+yTdkuBh09a1pi+oENYLm8YN78FpHtuBU=; b=rryhnu/o2neRqah0YDLUDbvOqNmh/6p+FwES5YTvNfQPioCGAp/mMcS9FqWBXJRi3p GHmqmyhYoVc10KeRRiv/H7MJuTX5lbcI58lCqKiRBihntMpP46w6yz303lPSfCkMLQoz nEOYr225c4nGTktn7SZjWE/5jsrQdreBUiqi/tx9iyqLzQJJ3DNCJQV9T15r+czfxinz Ul99kbsS5vhKeH0Ouadc6dgdAUuCMh4dQzaLlUs6L4B0Z1P7ZBiFA9JkFCO8OiCeyktr cbGHJNIjI8lhVMQnCnKcjWRPSfFgmpZTW16ouMfDTMlfWvG3Vj9Giho3PDhFg+ot6SNH KShQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=r2EEjfWOCH+yTdkuBh09a1pi+oENYLm8YN78FpHtuBU=; b=pbkEW82fSk85CJKo32doNB3epRp/1r54dtLxajFfiBPd37ftEuOJ5M442CKziz0Vvc HaHgLJokZBbWfF8bOVLUBBuFL8nxqZauFAd68BQz33hYSPDn2X5xKKfh/Znz2O0hl5XT XAZBy6hUrhfJEWYwuI2HO8RUB4u5Mz4WeNXs8W6278Djfk/HnT9o+WcCvKmq6cm/tXXp oRZE18AUiBRdwIlnPfWC3+xVdwjvknRXx46NKVD3i0Vbtpuq6p3n083KFmCj3zQSd+gU iTGos77inqkd0DCVLJgKJR7WnmsSjZrQetyShqc5Q8BGlsw/nyTeB+dOWqSlqGM+vqCd uB/w== X-Gm-Message-State: AIkVDXL4gzNCXwJ9Dhb2GPRaHuF8tvA8PWEkcsZxokwoln8e7NLbInEw1wBN2q+zfLbZ3Yok X-Received: by 10.223.164.151 with SMTP id g23mr33475181wrb.86.1485343020085; Wed, 25 Jan 2017 03:17:00 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id w70sm24383989wrc.47.2017.01.25.03.16.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2017 03:16:59 -0800 (PST) From: Thomas Monjalon To: "Ananyev, Konstantin" Cc: Yuanhan Liu , "Yigit, Ferruh" , dev@dpdk.org, "Horton, Remy" Date: Wed, 25 Jan 2017 12:16:58 +0100 Message-ID: <2493743.8AWo4SqSMn@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <2601191342CEEE43887BDE71AB9772583F10A841@irsmsx105.ger.corp.intel.com> References: <4d897cf9-f1f4-d924-10cd-63e95b12b411@intel.com> <20170123125256.GH10293@yliu-dev.sh.intel.com> <2601191342CEEE43887BDE71AB9772583F10A841@irsmsx105.ger.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] ethdev: fix wrong memset 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: Wed, 25 Jan 2017 11:17:00 -0000 2017-01-23 13:06, Ananyev, Konstantin: > > > -----Original Message----- > > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > > Sent: Monday, January 23, 2017 12:53 PM > > To: Ananyev, Konstantin > > Cc: Yigit, Ferruh ; dev@dpdk.org; Thomas Monjalon ; Horton, Remy > > > > Subject: Re: [dpdk-dev] [PATCH] ethdev: fix wrong memset > > > > On Mon, Jan 23, 2017 at 12:44:11PM +0000, Ananyev, Konstantin wrote: > > > > On Mon, Jan 23, 2017 at 07:40:50PM +0800, Yuanhan Liu wrote: > > > > > On Mon, Jan 23, 2017 at 11:32:23AM +0000, Ferruh Yigit wrote: > > > > > > On 1/23/2017 11:24 AM, Yuanhan Liu wrote: > > > > > > > On Mon, Jan 23, 2017 at 11:05:25AM +0000, Ferruh Yigit wrote: > > > > > > >>>>>>>> lib/librte_ether/rte_ethdev.c | 2 +- > > > > > > >>>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > >>>>>>>> > > > > > > >>>>>>>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > > > > > > >>>>>>>> index 4790faf..61f44e2 100644 > > > > > > >>>>>>>> --- a/lib/librte_ether/rte_ethdev.c > > > > > > >>>>>>>> +++ b/lib/librte_ether/rte_ethdev.c > > > > > > >>>>>>>> @@ -225,7 +225,7 @@ struct rte_eth_dev * > > > > > > >>>>>>>> return NULL; > > > > > > >>>>>>>> } > > > > > > >>>>>>>> > > > > > > >>>>>>>> - memset(&rte_eth_devices[port_id], 0, sizeof(*eth_dev->data)); > > > > > > >>>>>>>> + memset(&rte_eth_dev_data[port_id], 0, sizeof(struct rte_eth_dev_data)); > > > > > > >>>>>>> > > > > > > >>>>>>> Not directly related to the this issue, but, after fix, this may have > > > > > > >>>>>>> issues with secondary process. > > > > > > >>>>>>> > > > > > > >>>>>>> There were patches sent to fix this. > > > > > > >>>>>> > > > > > > >>>>>> I mean this one: > > > > > > >>>>>> http://dpdk.org/ml/archives/dev/2017-January/054422.html > > > > > > >>>>> > > > > > > >>>>> d948f596fee2 ("ethdev: fix port data mismatched in multiple process > > > > > > >>>>> model") should have fixed it. > > > > > > >>>> > > > > > > >>>> Think about case, where secondary process uses a virtual PMD, which does > > > > > > >>>> a rte_eth_dev_allocate() call, shouldn't this corrupt primary process > > > > > > >>>> device data? > > > > > > >>> > > > > > > >>> Yes, it may. However, I doubt that's the typical usage. > > > > > > >> > > > > > > >> But this is a use case, and broken now, > > > > > > > > > > > > > > I thought it was broken since the beginning? > > > > > > > > > > > > No, memset(&rte_eth_dev_data[port_id], ...) breaks it. > > > > > > > > > > Oh, you were talking about that particular case Remy's patch meant to > > > > > fix. > > > > > > > > > > > >> and fix is known. > > > > > > > > > > > > > > And there is already a fix? > > > > > > > > > > > > http://dpdk.org/ml/archives/dev/2017-January/054422.html > > > > > > > > > > Yes, it should fix that issue. > > > > > > > > Well, few more thoughts: it may fix the crash issue Remy saw, but it > > > > looks like more a workaround to me. Basically, if primary and secondary > > > > shares a same port id, they should point to same device. Otherwise, > > > > primary process may use eth_dev->data for a device A, while the > > > > secondary process may use it for another device, as you said, it > > > > could be a vdev. > > > > > > > > In such case, there is no way we could continue safely. That said, > > > > the given patch avoids the total reset of eth_dev->data, while it > > > > continues reset the eth_dev->data->name, which is wrong. > > > > > > > > So it's not a proper fix. > > > > > > > > Again, I think it's more about the usage. If primary starts with > > > > a nic device A, while the secondary starts with a nic device B, > > > > there is no way they could work well (unless they use different > > > > port id). > > > > > > Why not? > > > I think this is possible. > > > > Yes, it's possible: find another port id if that one is already taken > > by primary process (or even by secondary process: think that primary > > process might attatch a port later). > > > > > They just need to be initialized properly, > > > so each rte_eth_devices[port_id]->data, etc. point to the right place. > > > > My understanding is, as far as they use different port_id, it might > > be fine. Just not sure it's enough or not. > > As I understand, the main problem is that rte_eth_devices[] is local, > while rte_eth_dev_data points to the shared memory array. > And rte_eth_dev_allocate() assumes that if rte_eth_devices[x] is free, > then rte_eth_dev_data[port_id] is also free. > Which is wrong in case when primary/secondary processes have different devices attached. > Another problem is that inside rte_ethdev.c we manipulate rte_eth_dev_data[] > contents without grabbing any lock. Yes there are a lot of problems with the multiproc mode because it has been implemented as a hack. We are fixing some cases without figuring the whole picture. I'll apply the patch from Remy which fixes a case where process creates vdev (local data) and, hopefully, primary does no hotplug of PCI dev. I'll restart this discussion with a bigger picture of what multiproc is, and what are the issues.