Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3816338ybl; Tue, 20 Aug 2019 02:43:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUxv4OkPhgPqbWI2hgV3tnfHDPkoxGQI9vpTISkxW3+Pp45cR3MAeFBCG/Ydh6uJLMYepz X-Received: by 2002:a63:e907:: with SMTP id i7mr23574155pgh.84.1566294195707; Tue, 20 Aug 2019 02:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566294195; cv=none; d=google.com; s=arc-20160816; b=IW4t2Irk2U5LygFhePT4i+N1hGwMuhOQcmtD4AmgOT41Kj4N6lH1u9xtLdHCQoBwZj 7lIiAEJ+rDK1Mxs8dYSGlH0V+MShDssJKc7cr3gCyir7ibxrCUeG63V38aDHjRoZFoEg 77+yOIOT5vWOAZvx37lVhrHoGpdZ57eBUyUh3AncPQMBoQk0/C2VED6DgNX/J/P4/QeB j4uTn5ijeIavpe113ka3N4uDaTV7MybHv+PXVMxSJpMC1neNw5H7lan4CmmGmmD2qkdL Gc7rsaMaMLpCPzyoeKO/gjrBfOeJQXdcPedayUmVYcDa27tgxP06XtQMJEfjVTdK2Q0Z fMUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tzn5bK3tbNsiWgQGYaxZl6ZSSnLs1CWcQlXNKSbagq0=; b=PgYdhdHMk4H8xBlEvV/qXxwQvGQ5zsKwQ3XGbMXHa0GRSAMVUc7HqRUbAjGs57NimE JeMHPMW3aDQsbQRXYGd0irnQH37QnMUXSHYd9kO1A2zd99uGBkokg580fyYHsMcgAzL/ bVwcP4TY+9jhzaagKVi5iQdfvUfEeEnjJCm4TtgyciVZwS9HP9kAD7hOZnDbHK3TvTiZ 4+3bDb/YZyL18BVgAvpvw6yVAYLgq0vJJiaBuQZhyIi4pxatav+i+/2g2uIasYbgrdL3 aWEF47pUdiCDgkHap/LsGndUJhwcaiNqBNKtU1la9FZWOfFWV//yEE47DWfdg21hNyP8 1Ddg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jtXhyGX6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x187si12858199pfd.200.2019.08.20.02.43.00; Tue, 20 Aug 2019 02:43:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jtXhyGX6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729619AbfHTJlv (ORCPT + 99 others); Tue, 20 Aug 2019 05:41:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34500 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729333AbfHTJlv (ORCPT ); Tue, 20 Aug 2019 05:41:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tzn5bK3tbNsiWgQGYaxZl6ZSSnLs1CWcQlXNKSbagq0=; b=jtXhyGX6RFLZEXfdyxYVaGpe7i I/AIX1W2McUPBTSwD0AEExmIXaKs7T/fIXSvjRG9kjWzst6hw31JyidJKj3OnAqbVy7OoQF/YNdLD QA34nygptFZu9wBF719DF7LO08ZjfsRjQyv6gnpDJAkmyvN5MXR+4+1Z/nZ/5gjL3bP8LD6tXWlC5 PQuG95sOBNDun+y68Cpf9cO5wVDzDh73H1dXlwirbKgiXPhdkErbRar31Yc7Pkg9mF/EgBGp+hSaD YbrMNB3jYijcgcG1q0gx5az//hgZ2bDfcUWSSp0lOzKaGK32UhjMRis8aNos8ZhcQbVF/K0oEtw2i HEJANvzg==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1i00e7-0008Ol-OL; Tue, 20 Aug 2019 09:41:43 +0000 Date: Tue, 20 Aug 2019 02:41:43 -0700 From: Christoph Hellwig 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 , Robin Murphy Subject: Re: [PATCH V5 1/5] iommu/amd: Remove unnecessary locking from AMD iommu driver 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190815110944.3579-2-murphyt7@tcd.ie> User-Agent: Mutt/1.11.4 (2019-03-13) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.