Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1406582pxb; Thu, 28 Jan 2021 16:08:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9HvyVSNC4XOeqssjM5/+Ma+FJsWfcjZGdUwxboSWUsL8y/M5kY+0/XEsAppwEjEvFbbKg X-Received: by 2002:a17:906:d7:: with SMTP id 23mr1980341eji.108.1611878936937; Thu, 28 Jan 2021 16:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611878936; cv=none; d=google.com; s=arc-20160816; b=r88Dve37cJ/BuzgNoOlTsJTmEI5EB27kXpkbrISwWB7iRlUdvX8/METzsGSnq21sKX SzTAJX5AA4muPszFqRcXAKzpgFsArk+OoPRZuAn6XY/60ix8CDbknDqM8Xxk9s2xm8ms UbBHp0VE1p2Y7QUBorZDFZGuVLb7/84Ar58c0W94rbnNEfHpdMhMB/trwNKlP4Zv6gOQ dRoLqYnapKZCYNROcAKP2XrreqNgHFz5nwOk6x9NNvXQjrKzNkBmbwE0ispma5OTiK1s 9BAoc/0d3plEYGIDeTFLZGbDau8NRmDIAL5+B+e/TOcR6rfR7Yfw+oG2j9TkiuMQNUvM EPKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=yl/imRdOZMdYx/XAZPfsWI+kzZAnvPMwmfpbpZBb+Sk=; b=X9LBE3Ppe0BArJiOsUhKrHXEeOSXkF6CQK5P/Ms37awh6dtY5PWWg40j5jiPwGZmtx 9eb63IKGpyfHDbR1UClEHEVGrNCHxoCXN5iz/JMWgJ3+lTUHmkadSA/XSmJaSEoB15Om 2P57/NCzeTO4z6gL8S+E1OauG9AtsLlJi4z9jd60Vn0rSCCxtA5j908GAuT/0gUUgRx4 /sEYE7e0g5+LJ5aYSmYNl1cxEE5jxAL6nkpvvAn0gwO2DYJfRAQsoAASlzdrAtM7XGlY qYBffISweZWVYAz9waue8Tgmr5ifMihRj/sstKWZFWvx5DdCxbWThbnk+Uh5s/ES02Mo gVHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si4150640edq.48.2021.01.28.16.08.25; Thu, 28 Jan 2021 16:08:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbhA2AEw (ORCPT + 99 others); Thu, 28 Jan 2021 19:04:52 -0500 Received: from foss.arm.com ([217.140.110.172]:40882 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbhA2AEv (ORCPT ); Thu, 28 Jan 2021 19:04:51 -0500 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 26F6413D5; Thu, 28 Jan 2021 16:04:02 -0800 (PST) Received: from [10.57.35.163] (unknown [10.57.35.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 686373F66E; Thu, 28 Jan 2021 16:03:59 -0800 (PST) Subject: Re: [PATCH v6 07/33] iommu: Avoid reallocate default domain for a group To: Will Deacon , Yong Wu Cc: Joerg Roedel , Rob Herring , Matthias Brugger , Krzysztof Kozlowski , Evan Green , Tomasz Figa , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, chao.hao@mediatek.com References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-8-yong.wu@mediatek.com> <20210126222305.GB30460@willie-the-truck> <1611740356.5302.14.camel@mhfsdcap03> <20210128211020.GA3531@willie-the-truck> <20210128211442.GB3531@willie-the-truck> From: Robin Murphy Message-ID: <654abe35-bc60-741b-1238-d9c585a45c06@arm.com> Date: Fri, 29 Jan 2021 00:03:57 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210128211442.GB3531@willie-the-truck> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-28 21:14, Will Deacon wrote: > On Thu, Jan 28, 2021 at 09:10:20PM +0000, Will Deacon wrote: >> On Wed, Jan 27, 2021 at 05:39:16PM +0800, Yong Wu wrote: >>> On Tue, 2021-01-26 at 22:23 +0000, Will Deacon wrote: >>>> On Mon, Jan 11, 2021 at 07:18:48PM +0800, Yong Wu wrote: >>>>> If group->default_domain exists, avoid reallocate it. >>>>> >>>>> In some iommu drivers, there may be several devices share a group. Avoid >>>>> realloc the default domain for this case. >>>>> >>>>> Signed-off-by: Yong Wu >>>>> --- >>>>> drivers/iommu/iommu.c | 3 ++- >>>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >>>>> index 3d099a31ddca..f4b87e6abe80 100644 >>>>> --- a/drivers/iommu/iommu.c >>>>> +++ b/drivers/iommu/iommu.c >>>>> @@ -266,7 +266,8 @@ int iommu_probe_device(struct device *dev) >>>>> * support default domains, so the return value is not yet >>>>> * checked. >>>>> */ >>>>> - iommu_alloc_default_domain(group, dev); >>>>> + if (!group->default_domain) >>>>> + iommu_alloc_default_domain(group, dev); >>>> >>>> I don't really get what this achieves, since iommu_alloc_default_domain() >>>> looks like this: >>>> >>>> static int iommu_alloc_default_domain(struct iommu_group *group, >>>> struct device *dev) >>>> { >>>> unsigned int type; >>>> >>>> if (group->default_domain) >>>> return 0; >>>> >>>> ... >>>> >>>> in which case, it should be fine? >>> >>> oh. sorry, I overlooked this. the current code is enough. >>> I will remove this patch. and send the next version in this week. >>> Thanks very much. >> >> Actually, looking at this again, if we're dropping this patch and patch 6 >> just needs the kfree() moving about, then there's no need to repost. The >> issue that Robin and Paul are discussing can be handled separately. FWIW patch #6 gets dropped as well now, since Rob has applied the standalone fix (89c7cb1608ac). Robin. > Argh, except that this version of the patches doesn't apply :) > > So after all that, please go ahead and post a v7 ASAP based on this branch: > > https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=for-joerg/mtk > > Will >