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=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 CA1A6C48BE0 for ; Fri, 11 Jun 2021 10:47:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BA51613EA for ; Fri, 11 Jun 2021 10:47:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BA51613EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tNp1o8MV0HvS3NJvTWpZsO6VHI6Hp01+R++iN4ku/YU=; b=4grpXO7oPwl9pC 44vENWUIvwtfU3H2saUqsGRrO0SlPsPEw8hYoQqL0yP68pXnGTKsRqqfZxajV4T6XSLUts3/YPYj0 NYSveOOF7vaMpeeDJA7L1YDBTPA9A5EFK6QlQmzfVmROXsHjcEX3+J1i+kUreT3RfJ5tCtnT+1gfl BowQIO02znyhvUV7zC9apluw5y2W+QnrRqMJyVn9GGDlLIVy0t/AIWOYDsB8Yl7XvhzHJbod+7IRW I/Y1NYxuVOxZBUnraT6iB7WCb9xMpYmsRJblV+/9YwC1lYEi2HVzvXGTBqlBQXKMFSGffxU0eMcDm gbhph2hP9as/cjNDznrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrefN-004nAU-B1; Fri, 11 Jun 2021 10:45:33 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrefJ-004nA5-G1 for linux-arm-kernel@lists.infradead.org; Fri, 11 Jun 2021 10:45:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF60C613F1; Fri, 11 Jun 2021 10:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623408329; bh=H7N82STuZf67I/B25zQwHnR1wGeHBVcwA153V8xgMsI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WBZx9meYLkVr5ydc7IymbBE1oQiQ1bbdKUe3MI5cqxiyStn7E8h3540mPdeFhQkWM AhitpJZgHzGLqcW6alsccgNdUuLlKD2G9xyUu13i9BSwVCAtH3eu0s/FsX5iCfUbT1 rnmwpY/lYAajYmvDqpnZf9+gYo+kHeebSoN6RdYch7hQYHe700m95FmwO0HnN+yWWb IOZ1p/8/glLiUmlga1DXEVLyS3s64ns/3mTh2uwmYBte0T7WtphOj/x+uo4Q5HPdEI GA1BVDFmQzC/LCLmCGfZGPgu2Snd3vCaJ2HQ2ic1h44pLduLScxNFpcbBVm3+NjTkN 6P+smXdy03jRw== Date: Fri, 11 Jun 2021 11:45:24 +0100 From: Will Deacon To: Ashish Mhetre Subject: Re: [PATCH 1/2] iommu: Fix race condition during default domain allocation Message-ID: <20210611104524.GD15274@willie-the-truck> References: <1623298614-31755-1-git-send-email-amhetre@nvidia.com> <1623298614-31755-2-git-send-email-amhetre@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1623298614-31755-2-git-send-email-amhetre@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210611_034529_575182_72CFBFC2 X-CRM114-Status: GOOD ( 14.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: joro@8bytes.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jun 10, 2021 at 09:46:53AM +0530, Ashish Mhetre wrote: > Domain is getting created more than once during asynchronous multiple > display heads(devices) probe. All the display heads share same SID and > are expected to be in same domain. As iommu_alloc_default_domain() call > is not protected, the group->default_domain and group->domain are ending > up with different domains and leading to subsequent IOMMU faults. > Fix this by protecting iommu_alloc_default_domain() call with group->mutex. Can you provide some more information about exactly what the h/w configuration is, and the callstack which exhibits the race, please? > Signed-off-by: Ashish Mhetre > --- > drivers/iommu/iommu.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 808ab70..2700500 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -273,7 +273,9 @@ int iommu_probe_device(struct device *dev) > * support default domains, so the return value is not yet > * checked. > */ > + mutex_lock(&group->mutex); > iommu_alloc_default_domain(group, dev); > + mutex_unlock(&group->mutex); It feels wrong to serialise this for everybody just to cater for systems with aliasing SIDs between devices. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel