Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp480706rwe; Fri, 26 Aug 2022 08:27:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VjiXj3HJIR2PKbGW/xo7CbTeZ8cEC7xrUdrD9CRJZo1HZiIUNfJhrx3/8uQKym+brt9dN X-Received: by 2002:a17:907:1b03:b0:6ff:78d4:c140 with SMTP id mp3-20020a1709071b0300b006ff78d4c140mr5788792ejc.554.1661527676288; Fri, 26 Aug 2022 08:27:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661527676; cv=pass; d=google.com; s=arc-20160816; b=IlsSk9hOziU8OrjmApR5v8NUJcf7UUPpDiZ91OqhJ6X6REeyKXx3BDtJLGjXeQUGJo SKL3cF8LR0Rq+uJV8jf43jW6p1/54YEctQg2AdHSdjqqzmNyHn44dhGrAn4BzGo+oEUw Y7Y887w4zlLCDZyA53L6fKUFLYvVb0DwfyczW7bgOuLSOvnTApzrG92sO8FwrI3PqNsr kxoesIoGqlULYpcOzB9JDdySKV9MEKD8VdK0zPYEMsX82dyiZMUOQ5aGQuxx49NiqRXn vmkabf2vkpD0btuQ9nIlMbqCowJ9zOWgizoLHs0+4gG56fYBdsIfezzcwvfyNqcpjp8d VMAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0Vvqi0Rtz1nOxu5LGJUVmUezMCYClXzNaoUNFk5g2NY=; b=tCs5th7UcbDI3ZJa0B6IN9Z9k977ZnDo0aj/d+IMxg/ZyFXfHgmdnEYjR8eO6emKU7 aS3W48BQFajitllR51MAGax7ACRUL6zyFvwDnwL2wxzR/AoU0SOn6tgl264o45poQoWS HlSRBQCKCVgnHgFJUNGoa8SeLRPbALtJHedEIah01QW2JpR5xEdqZO39N4/WAyI5DzTi TqZoZS8PHM1H9Bq7TGwkIM3J1JFLG82oXS+U51lywHORAAVu2RhBgeLNCZ+vhS8TO9Dm nPIVXh0jDAQVZRP0MQP/agY50qLwmW71C6NKgxpBW/s2hQxPQCl+YakKTYKmIsuEC8Y+ t/DA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Y9O5FeWO; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a1709062c4300b0073d567769a9si1221258ejh.437.2022.08.26.08.27.30; Fri, 26 Aug 2022 08:27:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Y9O5FeWO; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232289AbiHZOxV (ORCPT + 99 others); Fri, 26 Aug 2022 10:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbiHZOxU (ORCPT ); Fri, 26 Aug 2022 10:53:20 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2062.outbound.protection.outlook.com [40.107.212.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BF3BD8B3E; Fri, 26 Aug 2022 07:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ib0z0ENvbdLgOIyW3iHtzWk2JrhsIVq5CGZLwk1+u+r+5GXrPNv9SLmFF6RdWG+z1Dj1COb1ihEDPagCyAl4YWqt7n5qvnMxTRRZ5CNDx44LSGOR0dbcd0wUggm3W5jThQWd1xRMNfD24SEpziMrJjMYnPp9pTZzMcdRSXgvwpwnhzQ9DyMjxI/1maY0zFRMJHcpowPyihSy0r3M5Wu9ce9S32NFSJZayPuS0om1XYLVg7CinpNQwDoVUWyUi2KFxxWRizMiZrh3FBjC9joe7A5nBa+9b5mAtlxmsFbtdnapT8ySfHeGWVHKX09BBJJxq0lVc1sARw+Ztxp8jKKySw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0Vvqi0Rtz1nOxu5LGJUVmUezMCYClXzNaoUNFk5g2NY=; b=PrMHu/EO+Qu2E0mulXBO6fZxSjLmamX5Fr9qSgtl2vMxXwgQnt976/ATD2PTXE7nV3ovVEtGtGeAGxiPl8njNbLC5Vg32cQOxRVXLGqsEkCKDpkncgD8gRo7YssnU/nEEQfxdcgbjTZhnF8BzTqRrHQiCOfeEk7WaWMv2Gzebtr0zoGo3Z81keUUGUwhVZ3aKZbuh5t8kjYaCPHHMOkELD00/MLF0PLVhE4+I8JIMDX2AUfUkWh3sreAIvBe14MAfqVAzwdHhg1JRFDZiT4uy4sMKCwg9G+UNsaTOq751/V7JI3a4BicNpHtySzRSLplSIoj1p9CgODKlRODxNcPKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Vvqi0Rtz1nOxu5LGJUVmUezMCYClXzNaoUNFk5g2NY=; b=Y9O5FeWOM1tBA9icmb7bA3fVaBxjYJM5DBP5Up6QqoyyFuRJ2y5/r/jszvP/pKX4W34jFplZY2lWiFzaLVZJYED72ruB7fNRO7s/eTfitK/m3jHYA+YGb17k2mRzy7YHtXt2/efq9OasbF+zPYH6li6FKvjyjQiTjPE29JrnqWV2Ej7zdiO+a3F+t3TlKu4IcYwlbI0XjAaw3laHpUPtc55dvah2B7w3wFeU2ZVvcj2FlHRbXHd2T3wEW4EXttLPgof+vVsgh08XnApnXQYdXQJthKt6N95ZKdZsqpQJ+MwWCyl0002tigxPsOGrNKqHiqETb5bdef1KYXHNiHrKNw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) by SA1PR12MB6797.namprd12.prod.outlook.com (2603:10b6:806:259::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Fri, 26 Aug 2022 14:53:17 +0000 Received: from MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::462:7fe:f04f:d0d5]) by MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::462:7fe:f04f:d0d5%8]) with mapi id 15.20.5566.016; Fri, 26 Aug 2022 14:53:17 +0000 Date: Fri, 26 Aug 2022 11:53:15 -0300 From: Jason Gunthorpe To: Lu Baolu Cc: Joerg Roedel , Christoph Hellwig , Bjorn Helgaas , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Dave Jiang , Fenghua Yu , Vinod Koul , Eric Auger , Liu Yi L , Jacob jun Pan , Zhangfei Gao , Zhu Tony , iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 08/17] iommu: Make free of iommu_domain_ops optional Message-ID: References: <20220826121141.50743-1-baolu.lu@linux.intel.com> <20220826121141.50743-9-baolu.lu@linux.intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220826121141.50743-9-baolu.lu@linux.intel.com> X-ClientProxiedBy: BLAPR05CA0031.namprd05.prod.outlook.com (2603:10b6:208:335::12) To MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5eec7a03-10d2-48b1-cdda-08da8772b5b0 X-MS-TrafficTypeDiagnostic: SA1PR12MB6797:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FDKljWMct+1Qe2THzWx7UFKAPRie8fUe11boAZogrwG3yNv57ktos9WI3u4Mfqr7hY6dWGIBc8m8pMqcCf/mg5eu0DfU/Ff9veFqUKQJi++xr1HLtW7xg86Hp0jyCflonucwRugPjZG/I+PWQQ1+1Q+8hn48SQDYDVAOutLaDYvcEfGmByApSSmk2K1TI09dbvbrPF0RlKMAY610B2h7ULJhF6rK1LdmzT3LiBjnSoyGwHrLbjCrtODht10qLdUj01uKxVUoLt85L4yJ9beQokFcG8IFqXzK4Pwf1LjNkuebF6xo6J6igegFbNsi4xtIO2yVI+ls+S8eEuJUZGlcMQ7Cfe7vKFbE6SP/nJyduVG5Tj52zlQt/JLzxeERa7ntlFzj6X998KeY2Z7WzKYf6/Svk8nAEXASt+WudmBiF0b8Ri+WdLDDK//Y5t3y/gfuXYVi6l6lbykDtYpwHT+DQGFk7AYkHwk6G7A23gqfqVlXdjWlfgq5XNrWsqGdfs8Z4VpVGAjktpEkqqp1hJtaToHrnwnIyCu8+91GSONMlrZFtM5dQnYkLw++BG+/s4R+gF1RTsILtUco2hxuRIMBMP/kwtlqMtoGxmYlkWYVNKaHAGBp/Y3384gNJO8t6vBGWI4xD+lIZCdwPEGV7oznwK0N6ChJLTt2MJRF43YB1VKMLUfoO3+G7IzDrsEtPX7KSx6zdlFdtXHHZvWhbTWk0MgYB/Chd3OArA00NnhTKb8+65r2KpB8eLHTBNVvuIzj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4192.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(136003)(346002)(376002)(396003)(366004)(39860400002)(8676002)(38100700002)(2616005)(186003)(83380400001)(66946007)(8936002)(7416002)(66556008)(5660300002)(66476007)(6486002)(4326008)(6512007)(2906002)(41300700001)(6506007)(478600001)(26005)(86362001)(54906003)(6916009)(36756003)(316002)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Tpsp76ggvKreP/Z01GV6fjfNNUe2uLiQZNytQwGGes2xyh7l5HypnFP87e2o?= =?us-ascii?Q?stWQZpNIv343wwGfs38vX2KaF4idSiROBPrUS3cwI87sKF0x4ctg98K8m5tN?= =?us-ascii?Q?yGO4AhpnqV/E6SW2h0Q6DKm1iBdlccAyQqyKB03DWyqtNrVczZE49mo1y8sw?= =?us-ascii?Q?ItpDuc55CxaRsFRNX92+alkuTVBiDVdkX2uHC+f49OXGvTPjOv7LhIoSKnr3?= =?us-ascii?Q?rLqRNwwL2SSPVV7Xp/i6AQYrdm+RhTBwS7kVdcDN9bC4rD6FGdBLJHfCo+ft?= =?us-ascii?Q?Yc+eaBYV1AQwMBnYWMp3kjgw3r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INeXUtM?= =?us-ascii?Q?92T6JC5CcCrKO86YAt3TFk0glK8E/c0DIh86Up26Y23IOlH4l8ycWclmAOTu?= =?us-ascii?Q?b5MC/IDm2vOO5JVCMre+xVuuRBD3/KPSzYKbR2LobG/80tSXCj4GnnIQKCyV?= =?us-ascii?Q?z6IF1qG1QuxezdfmAFMFImTsWRqJiX2Ju30R/wCUqcR8riP/1nFpMCSzC+KY?= =?us-ascii?Q?7dRSdzM5JvRurCgFmrOZ/I6V7c1D9jubn0mLIHvRplr1fSdZ0z8NWEHeKD6j?= =?us-ascii?Q?5YMcAg8TGZVK8Z7MfQVHQuo1aVnoBpPTh9kKUxxt/ybxFs4CVHJffOunjJlG?= =?us-ascii?Q?zR4zGvOIL6fR2Ef9POU3Z1fn9KPMUyQ6Ys2rguo8TEUjUCVhkXQIS15oQzb6?= =?us-ascii?Q?8FmkD8MLxdLBZKzv9HMyl4Yp8v1TYeG426USN43M?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5eec7a03-10d2-48b1-cdda-08da8772b5b0 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2022 14:53:17.2676 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Mrv5mYH7BIdlEthzJ/28sWa33/uQd36mNw3vajIWRyMfn+3efpKm6UFCup7n5mSf X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6797 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 26, 2022 at 08:11:32PM +0800, Lu Baolu wrote: > So that the drivers are able to implement static singleton instance for > some special domains. The blocking domain is an example. The driver has > no need to allocate different memory for each blocking domain allocation > request. Hence, no need for a free callback. > > Signed-off-by: Lu Baolu > Tested-by: Zhangfei Gao > Tested-by: Tony Zhu > --- > 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 e985f4d5895f..630e1b64ed89 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1972,7 +1972,8 @@ void iommu_domain_free(struct iommu_domain *domain) > if (domain->type == IOMMU_DOMAIN_SVA) > mmdrop(domain->mm); > iommu_put_dma_cookie(domain); > - domain->ops->free(domain); > + if (domain->ops->free) > + domain->ops->free(domain); > } > EXPORT_SYMBOL_GPL(iommu_domain_free); This patch is in the wrong order, it needs to be before the ARM patch implementing the blocking domain But looks OK Reviewed-by: Jason Gunthorpe Jason