From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH V5 1/5] iommu/amd: Remove unnecessary locking from AMD iommu driver Date: Tue, 20 Aug 2019 02:41:43 -0700 Message-ID: <20190820094143.GA24154@infradead.org> References: <20190815110944.3579-1-murphyt7@tcd.ie> <20190815110944.3579-2-murphyt7@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Content-Disposition: inline In-Reply-To: <20190815110944.3579-2-murphyt7@tcd.ie> Sender: linux-kernel-owner@vger.kernel.org To: Tom Murphy Cc: iommu@lists.linux-foundation.org, Heiko Stuebner , virtualization@lists.linux-foundation.org, linux-tegra@vger.kernel.org, Thierry Reding , Will Deacon , Jean-Philippe Brucker , linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski , Jonathan Hunter , linux-rockchip@lists.infradead.org, Andy Gross , Gerald Schaefer , linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, David Woodhouse , linux-kernel@vger.kernel.org, Kukjin Kim List-Id: linux-mediatek@lists.infradead.org On Thu, Aug 15, 2019 at 12:09:39PM +0100, Tom Murphy wrote: > We can remove the mutex lock from amd_iommu_map and amd_iommu_unmap. > iommu_map doesn’t lock while mapping and so no two calls should touch > the same iova range. The AMD driver already handles the page table page > allocations without locks so we can safely remove the locks. I've been looking over the code and trying to understand how the synchronization works. I gues we the cmpxchg64 in free_clear_pte is the important point here? I have to admit I don't fully understand the concurrency issues here, but neither do I understand what the mutex you removed might have helped to start with.