From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE0A3C3A589 for ; Tue, 20 Aug 2019 09:41:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90C4322DA7 for ; Tue, 20 Aug 2019 09:41:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jtXhyGX6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729590AbfHTJlv (ORCPT ); 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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.