Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1316491pxb; Thu, 28 Jan 2021 13:17:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZAtSMMJ+27yIzxEUhJgBACKWZFrTFhn4wuMRPE2JOcnmC/iLkKTm82sbHBwOKUu0gFfGR X-Received: by 2002:a50:fd84:: with SMTP id o4mr1756211edt.340.1611868621134; Thu, 28 Jan 2021 13:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611868621; cv=none; d=google.com; s=arc-20160816; b=r56/Yo+g/VuUmb0yQL8i8zc/3/44haAyPJAQb42X3BCiMJss5EHnVr/XbLHP+ORlDj ChqyO4yJKiTFfQNY1rZnVHnqQLRgixCw7DFVUSnZDbkfMmkaDPdPU7XvjVV5iRgj22OT 2VDMZ52AUqgm2TWJYsQ2CUT/ykfMc26zXiyQNOIEPGKMn/w2uLQqpkmcy+9xm7aF21KD 3sBCJqmLhh1hFSAtyas7l++LPWbY2luyvNBaFYDO4m1bsTJYbm6rbvy5w9CH2V8hE86B mb2Za0Kism2/pw8gHGFdxrerkmo1StDcrUCnEKaeU9TwEXQk87qQ5vSp5cCn0fASRhrw Iz7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=16exK7mQfWvr/pl2Ct3DTD3UbaV3gl4QSeeT6I38zCA=; b=UA7OHBK5Jv2fShEPdCYgVumYMHLoMJshjaD/hGfM/LvnUtvSjVZOF81pnittTA3Fl7 5daIiKDa6glbx6gdINAUFXrscHCqKuHn9TZVnqprbdt/hEpKAC1TZN0jGKz6A6hUJIna 31CU1/OVZM8MC64k6sfJjPI1Gjv17sfspi7vsOyR1K5w0IvQrMRejcOQBlseWKKBBYQx a78LvIbmTxOQLZA6YBrZGDZXdDWyJpwuJ82+1uoMCZm3UTPwUOQ7v42lXTLbRp0yLacM X8e6ial9h/tQtggY/Z4HRP9DH9HXN3iNb3iZCE3LClslK0Ui7lwZLqayFZYnBKZ0zWR1 MOFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LziO4BAX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e17si3743234eds.259.2021.01.28.13.16.33; Thu, 28 Jan 2021 13:17:01 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LziO4BAX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbhA1VPh (ORCPT + 99 others); Thu, 28 Jan 2021 16:15:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:59432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbhA1VPg (ORCPT ); Thu, 28 Jan 2021 16:15:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85E5F64DE8; Thu, 28 Jan 2021 21:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611868495; bh=XgWvSGSpVv18LahQizgkshnTyUbmYEWq3r/XkahHRII=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LziO4BAXRIFn2iS8fwmhSyVoCaoZPy2kSoOBMhp5cYxstDcu5D/J9i7i79+DGGP5o 48GGfpcm8R9i6X1zxfcGxMKA8ANVE7WymoLs4PDD9xxSjJzrh4Tl6jDYc+QC0UfKqd SecnHXT0DqaP6PwKB0nUcfE9nowxuUNBCNX4389tC4oSZJu3YOdXbEUQSK16fYPCqJ FyFomm+RDf3zpSa0Ik7u1XjSL0Tl0dWI5kdEww1S8bOgAn6WhrSgw8LpIIRLdIHmq9 dSGyqCjORMZ4heDOlrzHyC30DWFM06QEs2JGhtUf3gm9jWn+cWeCSrk2tYTjd1Mqmu k2mSU9CnqXFpw== Date: Thu, 28 Jan 2021 21:14:42 +0000 From: Will Deacon To: Yong Wu Cc: Joerg Roedel , Rob Herring , Matthias Brugger , Robin Murphy , 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 Subject: Re: [PATCH v6 07/33] iommu: Avoid reallocate default domain for a group Message-ID: <20210128211442.GB3531@willie-the-truck> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210128211020.GA3531@willie-the-truck> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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