From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFA2FA053B for ; Fri, 17 Jul 2020 16:19:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C56471BEDC; Fri, 17 Jul 2020 16:19:47 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 8CC6C2C30; Fri, 17 Jul 2020 16:19:44 +0200 (CEST) IronPort-SDR: P1TayjllDGvTxEcvxHUREAjoXoDw7JOWTKAOk+cED0lLubC4EzZUoomrkC/mA4/Lqc/mHjahVN kLmjvLR9VMTA== X-IronPort-AV: E=McAfee;i="6000,8403,9684"; a="214307784" X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="214307784" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2020 07:19:43 -0700 IronPort-SDR: 0LeIMkHLVFh3Pyyog3mOFzBqMHMDIVl3wTtVy8Uf1aW9kESSOPdPYLXJex/GDIsP3jPbxbHjZT RQvaeXZv8Q+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="286825453" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.226.225]) ([10.213.226.225]) by orsmga006.jf.intel.com with ESMTP; 17 Jul 2020 07:19:41 -0700 To: wangyunjian , dev@dpdk.org, david.marchand@redhat.com Cc: jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org References: From: "Burakov, Anatoly" Message-ID: <70169443-f475-a632-c1f8-6e993bea726c@intel.com> Date: Fri, 17 Jul 2020 15:19:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 1/1] eal/linux: do not create user mem map repeatedly when it exists X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 16-Jul-20 2:38 PM, wangyunjian wrote: > From: Yunjian Wang > > Currently, we will create new user mem map entry for the same memory > segment, but in fact it has already been added to the user mem maps. > It's not necessary to create it twice. > > Fixes: 0cbce3a167f1 ("vfio: skip DMA map failure if already mapped") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > lib/librte_eal/linux/eal_vfio.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c > index abb12a354..d8a8c39ab 100644 > --- a/lib/librte_eal/linux/eal_vfio.c > +++ b/lib/librte_eal/linux/eal_vfio.c > @@ -1828,6 +1828,13 @@ container_dma_map(struct vfio_config *vfio_cfg, uint64_t vaddr, uint64_t iova, > ret = -1; > goto out; > } > + > + /* we don't need create new user mem map entry > + * for the same memory segment. > + */ > + if (errno == EBUSY || errno == EEXIST) > + goto out; > + I'm not sure i understand this patch. If we get errno, the call has failed, which means we're doing "goto out" from a few lines above. Am i missing something here? > /* create new user mem map entry */ > new_map = &user_mem_maps->maps[user_mem_maps->n_maps++]; > new_map->addr = vaddr; > -- Thanks, Anatoly