From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 4B781A046B for ; Wed, 26 Jun 2019 11:43:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E63C20BD; Wed, 26 Jun 2019 11:43:57 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id B2CCB1E25 for ; Wed, 26 Jun 2019 11:43:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2019 02:43:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,419,1557212400"; d="scan'208";a="337152150" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.101]) ([10.237.220.101]) by orsmga005.jf.intel.com with ESMTP; 26 Jun 2019 02:43:51 -0700 To: "Mo, YufengX" , dev@dpdk.org Cc: drc@ibm.com, pradeep@us.ibm.com, Takeshi Yoshimura References: <20190613022239.6946-1-tyos@jp.ibm.com> From: "Burakov, Anatoly" Message-ID: <4b10a275-10b4-9806-997f-7241a9e5cfed@intel.com> Date: Wed, 26 Jun 2019 10:43:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190613022239.6946-1-tyos@jp.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] vfio: fix expanding DMA area in ppc64le 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 18-Jun-19 3:37 AM, Mo, YufengX wrote: > From: Takeshi Yoshimura > > In ppc64le, expanding DMA areas always fail because we cannot remove > a DMA window. As a result, we cannot allocate more than one memseg in > ppc64le. This is because vfio_spapr_dma_mem_map() doesn't unmap all > the mapped DMA before removing the window. This patch fixes this > incorrect behavior. > > I added a global variable to track current window size since we do > not have better ways to get exact size of it than doing so. sPAPR > IOMMU seems not to provide any ways to get window size with ioctl > interfaces. rte_memseg_walk*() is currently used to calculate window > size, but it walks memsegs that are marked as used, not mapped. So, > we need to determine if a given memseg is mapped or not, otherwise > the ioctl reports errors due to attempting to unregister memory > addresses that are not registered. The global variable is excluded > in non-ppc64le binaries. > > Similar problems happen in user maps. We need to avoid attempting to > unmap the address that is given as the function's parameter. The > compaction of user maps prevents us from passing correct length for > unmapping DMA at the window recreation. So, I removed it in ppc64le. > > I also fixed the order of ioctl for unregister and unmap. The ioctl > for unregister sometimes report device busy errors due to the > existence of mapped area. > > Signed-off-by: Takeshi Yoshimura > --- OK there are three patches, and two v1's with two different authors in reply to the same original patch. There's too much going on here, i can't review this. Needs splitting. Also, #ifdef-ing out the map merging seems highly suspect. With regards to "walking used memsegs, not mapped", unless i'm misunderstanding something, these are the same - whenever a segment is mapped, it is marked as used, and whenever it is unmapped, it is marked as free. Could you please explain what is the difference and why is this needed? Is the point of contention here being the fact that whenever the unmap callback arrives, the segments still appear used when iterating over the map? If that's the case, then i think it would be OK to mark them as unused *before* triggering callbacks, and chances are some of this code wouldn't be needed. That would require a deprecation notice though, because the API behavior will change (even if this fact is not documented properly). -- Thanks, Anatoly