Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp682502rdh; Wed, 7 Feb 2024 17:38:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkSkaM4M7qJVXw6TP+5OP03xI1L3EweP3tUxU53xUto6pGEryhwLO9PL8a9KUMwCR2Gxz/ X-Received: by 2002:ad4:5ca6:0:b0:68c:75e8:7d7d with SMTP id q6-20020ad45ca6000000b0068c75e87d7dmr8429182qvh.60.1707356285472; Wed, 07 Feb 2024 17:38:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707356285; cv=pass; d=google.com; s=arc-20160816; b=s0B9OgvE4sLL5TkkxU/bWfE/rwsdNEF6zBVoAfbouixIevpQQVLryVszBYT7MtE5AC yCPRmvHmVWmG/DIjReSCNhTwU9fG3BfgmAuLEQ+UdFpF4MckcJ8tGJflVDNnVQf0mUKQ CLBUU8YeKDY44ceb71WawaAQ5R7mTOFEqjadxIq3C92V4uyAtxO4kcNmGSSV6xbiHfSx Quz0SZvfDWhcZyAO1Q3AhRDOIrlrq1g52lN3SOGnotKRGgLVbAV3TzIakXxcPmvLME4i nu996DdYZ1Ah1ESod/mrlpr/0PWhNOhF5BZefvpMF9r7OXskquRyzmlK2DWGgxSKXcpO 6FlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=NYj4r732u+YZ2gV4jeGZnWnZHgh4HSkB9sn/FpxE0MY=; fh=TYmDa7PzK82vvA+10jmk+U9FpMllXVPFMuuZwHbIe1Q=; b=nOrByV7Ku7wOXOLcHFcFsY752CG+3dhGfOQIWZA+7g+Ik/5LX679Io0VdVDeSKrR3H 8JlPSM3YvC08aJFoyxukWDMTLR8beE7plkFD2YO96icqAs/tR6nB5Rk2OpHJqifDYGqm wbZUT8jGVYhpiMLG083W/TYp/4T/aWCekpveWtPlDmPJn+dTfBixXQLbqtJh6GjE+mON dCB+qztcUKWSeXvPzf67uya8NLXMAk8xoBG9c7yM8F2kML1AGo3nXNndKVTXLaGLashy UzaK1NBuyNahlXGyFz38s8THVic+N7u6R8oyxYkjwDA1OLKMcLhbTD3mkNk8C3dztN0G e2/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-57375-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57375-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCVyPvTnWhLIschjCD06eo4T5KlwcmK4ZDV6ceiHdj0WKN033AP7MwokMpCL2ffsmJmu0B7YJMAR+kCNg/bwCkzo37+YE7V59fDmfJ+RSQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f23-20020a05620a12f700b0078543d8bd4dsi2267620qkl.571.2024.02.07.17.38.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 17:38:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57375-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-57375-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57375-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2B6091C24045 for ; Thu, 8 Feb 2024 01:38:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C591514F61; Thu, 8 Feb 2024 01:37:57 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 695651E892 for ; Thu, 8 Feb 2024 01:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707356277; cv=none; b=tlwL9yBMLLGxQpg1DujceN1UAWgxpoEXsz3Bm1DVEA4OSbS2LMYQTKH17O+2qoeG599PyPwQzdSA4M6F/HOojlCvN/s84vmBPJyDl1+KGv/cBtGB4bLO4wFuWvbi+4H3XKe/2uG4Xn0XLIfR3BX+wnkA4jHup8zrjttaBev5SU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707356277; c=relaxed/simple; bh=lKskRSqdpwDtfSHdA8bWSaWTaPHpv0h2RtVrX+6X+B0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QDnxuhk37qDVQvuOPM2QbWBEf/trhWRIp3yWVpqMT7SJurGScZiDHgUHXxW+J5m32RpjANT3gBNf8awXmWXFEFujZEnf4Wn6GEWMX0FmcMOG2E0xKBX42LN1SJWDq3YqXLH3Ddv30PboXdULWaudbPp17YnF7Bnz7QkZcNqD3So= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D45371FB; Wed, 7 Feb 2024 17:38:36 -0800 (PST) Received: from [10.57.49.110] (unknown [10.57.49.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9EC6F3F762; Wed, 7 Feb 2024 17:37:53 -0800 (PST) Message-ID: Date: Thu, 8 Feb 2024 01:37:52 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/1] iommu: Avoid races around default domain allocations Content-Language: en-GB To: Jason Gunthorpe Cc: Nikhil V , Will Deacon , Joerg Roedel , Charan Teja Kalla , iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: <139a9abe-75d8-3bda-3ec9-a14a493eb2a9@quicinc.com> <20240201162317.GI50608@ziepe.ca> <9ba9c4fa-3fa9-c6c4-ce77-0c6cd5e23680@quicinc.com> <20240207145656.GJ31743@ziepe.ca> <37ab8689-5e0d-4166-bad6-84d3c51446ca@arm.com> <20240208011305.GM31743@ziepe.ca> From: Robin Murphy In-Reply-To: <20240208011305.GM31743@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-02-08 1:13 am, Jason Gunthorpe wrote: > On Thu, Feb 08, 2024 at 12:04:44AM +0000, Robin Murphy wrote: >>> Frankly, I'd suggest just proposing the necessary (and tested) >>> upstream patches to 6.1, however large they are, and see what Greg and >>> Sasha say. This is the usual working model they have, as I understand >>> it. >> >> To be blunt, hell no. Stable is far enough from its namesake already; the >> ongoing bordering-on-ridiculous brokenness of your mainline changes where > > What on earth are you even talking about? POWER? I mean you're literally getting bug reports for your fix for your fix for your grand idea, so what should we figure, that reality not aligning with your expectations is all reality's fault? >> That said, I also don't think there would be any harm in applying this to >> mainline as a belt-and-braces thing either, > > Really? "at 12:04:44AM +0000, Robin Murphy wrote:" It's late, I should have gone to bed hours ago, so I apologise for any lack of clarity; that was very much meant to be an implication of agreement with the overall approach, not the exact patch as is, which if you read the rest of my response you will see I still had questions about and did not formally ack or review. > Now that you've made me look, this patch breaks the > iommu_group_store_type() flow both on latest and on v6.1 from what I > can see. > > On v6.1: > > iommu_change_dev_def_domain(): > > prev_dom = group->default_domain; > if (!prev_dom) { > ret = -EINVAL; > goto out; > } > [..] > /* Sets group->default_domain to the newly allocated domain */ > ret = iommu_group_alloc_default_domain(dev->bus, group, type); > if (ret) > goto out; > > But this patch changes iommu_group_alloc_default_domain() to succeed > always without doing anythiing. > > So this patch needs some fixing. Hurrah! Please apply that kind of rigour to your own patches also. Thanks, Robin. [ you get two responses this week since I admit I ran out of patience and motivation to finish last week's on time ]