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=-8.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 2AAB3C4338F for ; Mon, 9 Aug 2021 14:54:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CD3B6101D for ; Mon, 9 Aug 2021 14:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234339AbhHIOyr (ORCPT ); Mon, 9 Aug 2021 10:54:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:42788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231478AbhHIOyp (ORCPT ); Mon, 9 Aug 2021 10:54:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1060361019; Mon, 9 Aug 2021 14:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628520865; bh=bmXVwPlv6jk+hRMVAM5D4Cs70KB/HmWxl8NzlqT1h3Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V7uTiTy2Kf1c07ZG3hdoJ0Z0CAd7XAPl8BYfYNci13TAph9dskWb7jRojZJIntqy0 Z5TLF+8ycGekFWW2v+N94vRD3YKFQkQAWZc9PsE2q4D+uJsXpTQL6LQk1iS+yn2U6p 8awKSOLddbyn7XQ3tCY5bqnVPkJIdkv7DE97jO1qJP/EY6E8rEyWfLhp+k9B6cgdQ4 mgvkx/fnD/U32LrnmYk6XDiYt6z5v7N/Qzkp3hBvMw0+m4LZ9uEGD9Ypj553UiVlU+ xY1Ik/3nNsdT7bs14C5m1wF3tXjF3bCgTpB/4hnVAEg3TXDHF4aMEKzroKESa84wSz LoNspFqPTrubw== Date: Mon, 9 Aug 2021 15:54:20 +0100 From: Will Deacon To: Robin Murphy Cc: Ashish Mhetre , vdumpa@nvidia.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [Patch V2 0/2] iommu/arm-smmu: Fix races in iommu domain/group creation Message-ID: <20210809145420.GB1458@willie-the-truck> References: <1623961837-12540-1-git-send-email-amhetre@nvidia.com> <20210802151607.GF28735@willie-the-truck> <9c38c53c-c145-097a-4c7e-40f1c06a1f01@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9c38c53c-c145-097a-4c7e-40f1c06a1f01@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 02, 2021 at 04:46:37PM +0100, Robin Murphy wrote: > On 2021-08-02 16:16, Will Deacon wrote: > > On Fri, Jun 18, 2021 at 02:00:35AM +0530, Ashish Mhetre wrote: > > > Multiple iommu domains and iommu groups are getting created for the devices > > > sharing same SID. It is expected for devices sharing same SID to be in same > > > iommu group and same iommu domain. > > > This is leading to context faults when one device is accessing IOVA from > > > other device which shouldn't be the case for devices sharing same SID. > > > Fix this by protecting iommu domain and iommu group creation with mutexes. > > > > Robin -- any chance you could take a look at these, please? You had some > > comments on the first version which convinced me that they are needed, > > but I couldn't tell whether you wanted to solve this a different way or not. > > Sorry, I was lamenting that this came to light due to the > of_iommu_configure() flow being yucky, but that wasn't meant to imply that > there aren't - or couldn't be in future - better reasons for > iommu_probe_device() to be robust against concurrency anyway. I do think > these are legitimate fixes to make in their own right, even if the current > need might get swept back under the rug in future. > > I would say, however, that the commit messages seem to focus too much on the > wrong details and aren't overly useful, and patch #2 is missing Ashish's > sign-off. Ashish -- please can you send a v3 fixing these issues? Will 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=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 70F8DC4320A for ; Mon, 9 Aug 2021 14:54:29 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 1D85060C41 for ; Mon, 9 Aug 2021 14:54:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1D85060C41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D48F5401BF; Mon, 9 Aug 2021 14:54:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jd8veOPxQBip; Mon, 9 Aug 2021 14:54:28 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id C816C40181; Mon, 9 Aug 2021 14:54:27 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A658FC0010; Mon, 9 Aug 2021 14:54:27 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2131EC000E for ; Mon, 9 Aug 2021 14:54:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 10BF26058B for ; Mon, 9 Aug 2021 14:54:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HtcLFYnjhIVj for ; Mon, 9 Aug 2021 14:54:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8DEC6600CC for ; Mon, 9 Aug 2021 14:54:25 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1060361019; Mon, 9 Aug 2021 14:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628520865; bh=bmXVwPlv6jk+hRMVAM5D4Cs70KB/HmWxl8NzlqT1h3Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V7uTiTy2Kf1c07ZG3hdoJ0Z0CAd7XAPl8BYfYNci13TAph9dskWb7jRojZJIntqy0 Z5TLF+8ycGekFWW2v+N94vRD3YKFQkQAWZc9PsE2q4D+uJsXpTQL6LQk1iS+yn2U6p 8awKSOLddbyn7XQ3tCY5bqnVPkJIdkv7DE97jO1qJP/EY6E8rEyWfLhp+k9B6cgdQ4 mgvkx/fnD/U32LrnmYk6XDiYt6z5v7N/Qzkp3hBvMw0+m4LZ9uEGD9Ypj553UiVlU+ xY1Ik/3nNsdT7bs14C5m1wF3tXjF3bCgTpB/4hnVAEg3TXDHF4aMEKzroKESa84wSz LoNspFqPTrubw== Date: Mon, 9 Aug 2021 15:54:20 +0100 From: Will Deacon To: Robin Murphy Subject: Re: [Patch V2 0/2] iommu/arm-smmu: Fix races in iommu domain/group creation Message-ID: <20210809145420.GB1458@willie-the-truck> References: <1623961837-12540-1-git-send-email-amhetre@nvidia.com> <20210802151607.GF28735@willie-the-truck> <9c38c53c-c145-097a-4c7e-40f1c06a1f01@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9c38c53c-c145-097a-4c7e-40f1c06a1f01@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Ashish Mhetre , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Mon, Aug 02, 2021 at 04:46:37PM +0100, Robin Murphy wrote: > On 2021-08-02 16:16, Will Deacon wrote: > > On Fri, Jun 18, 2021 at 02:00:35AM +0530, Ashish Mhetre wrote: > > > Multiple iommu domains and iommu groups are getting created for the devices > > > sharing same SID. It is expected for devices sharing same SID to be in same > > > iommu group and same iommu domain. > > > This is leading to context faults when one device is accessing IOVA from > > > other device which shouldn't be the case for devices sharing same SID. > > > Fix this by protecting iommu domain and iommu group creation with mutexes. > > > > Robin -- any chance you could take a look at these, please? You had some > > comments on the first version which convinced me that they are needed, > > but I couldn't tell whether you wanted to solve this a different way or not. > > Sorry, I was lamenting that this came to light due to the > of_iommu_configure() flow being yucky, but that wasn't meant to imply that > there aren't - or couldn't be in future - better reasons for > iommu_probe_device() to be robust against concurrency anyway. I do think > these are legitimate fixes to make in their own right, even if the current > need might get swept back under the rug in future. > > I would say, however, that the commit messages seem to focus too much on the > wrong details and aren't overly useful, and patch #2 is missing Ashish's > sign-off. Ashish -- please can you send a v3 fixing these issues? Will _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 A4A01C4338F for ; Mon, 9 Aug 2021 14:57:13 +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 6316060E97 for ; Mon, 9 Aug 2021 14:57:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6316060E97 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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=w2SYOgIzL6unKQHrvATcgFubzdnbwWm6fSCYZG4roVs=; b=NEuaYgHDNvivrj 6QoyyI40pqyxAAYwmuy3CgNm+8J2zohaFqicYPRnbC4i1XKP07rlEk8Qzb3Co5uoLBptTULXQIrem M8UQU3FPNi2KMalO9gNon/a2OmOpcwbFBPaaN6UyEa7HF1MzKLD1oH7Q4cY4yxiv72X1TQLOFQ0oi vwNzi6CtlefLg0Ljj52yy9ev7sRd+OgqRTaxxgxhAKkygVFp/KagUxKFeHkpqTUS6T+oWByK3Lzhg kfh2nDQlvEiNjR9LP1Oy4khMg2fnG7fQHzeDY94AYF1NxpYu6CiniYJrR8m+iN0iMawOoxNCHEqiF ZFhO6mKECsecOyAb9LNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD6fd-000z7H-Rn; Mon, 09 Aug 2021 14:54:30 +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 1mD6fZ-000z6A-La for linux-arm-kernel@lists.infradead.org; Mon, 09 Aug 2021 14:54:26 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1060361019; Mon, 9 Aug 2021 14:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628520865; bh=bmXVwPlv6jk+hRMVAM5D4Cs70KB/HmWxl8NzlqT1h3Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V7uTiTy2Kf1c07ZG3hdoJ0Z0CAd7XAPl8BYfYNci13TAph9dskWb7jRojZJIntqy0 Z5TLF+8ycGekFWW2v+N94vRD3YKFQkQAWZc9PsE2q4D+uJsXpTQL6LQk1iS+yn2U6p 8awKSOLddbyn7XQ3tCY5bqnVPkJIdkv7DE97jO1qJP/EY6E8rEyWfLhp+k9B6cgdQ4 mgvkx/fnD/U32LrnmYk6XDiYt6z5v7N/Qzkp3hBvMw0+m4LZ9uEGD9Ypj553UiVlU+ xY1Ik/3nNsdT7bs14C5m1wF3tXjF3bCgTpB/4hnVAEg3TXDHF4aMEKzroKESa84wSz LoNspFqPTrubw== Date: Mon, 9 Aug 2021 15:54:20 +0100 From: Will Deacon To: Robin Murphy Subject: Re: [Patch V2 0/2] iommu/arm-smmu: Fix races in iommu domain/group creation Message-ID: <20210809145420.GB1458@willie-the-truck> References: <1623961837-12540-1-git-send-email-amhetre@nvidia.com> <20210802151607.GF28735@willie-the-truck> <9c38c53c-c145-097a-4c7e-40f1c06a1f01@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9c38c53c-c145-097a-4c7e-40f1c06a1f01@arm.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-20210809_075425_772774_1EAECC8E X-CRM114-Status: GOOD ( 22.13 ) 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: Ashish Mhetre , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.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 Mon, Aug 02, 2021 at 04:46:37PM +0100, Robin Murphy wrote: > On 2021-08-02 16:16, Will Deacon wrote: > > On Fri, Jun 18, 2021 at 02:00:35AM +0530, Ashish Mhetre wrote: > > > Multiple iommu domains and iommu groups are getting created for the devices > > > sharing same SID. It is expected for devices sharing same SID to be in same > > > iommu group and same iommu domain. > > > This is leading to context faults when one device is accessing IOVA from > > > other device which shouldn't be the case for devices sharing same SID. > > > Fix this by protecting iommu domain and iommu group creation with mutexes. > > > > Robin -- any chance you could take a look at these, please? You had some > > comments on the first version which convinced me that they are needed, > > but I couldn't tell whether you wanted to solve this a different way or not. > > Sorry, I was lamenting that this came to light due to the > of_iommu_configure() flow being yucky, but that wasn't meant to imply that > there aren't - or couldn't be in future - better reasons for > iommu_probe_device() to be robust against concurrency anyway. I do think > these are legitimate fixes to make in their own right, even if the current > need might get swept back under the rug in future. > > I would say, however, that the commit messages seem to focus too much on the > wrong details and aren't overly useful, and patch #2 is missing Ashish's > sign-off. Ashish -- please can you send a v3 fixing these issues? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel