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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AC7C2D17122 for ; Mon, 21 Oct 2024 18:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:CC:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/hwGpcslCzp3Ko8IDqz7DUZCh65HadM1eUm5bwt/ai8=; b=2kFATGiL/WT16QdjyP+OS56rwC akObi7gefhiuJVFv24QWoL62ojcbtwVT6IvsLh3mecd6QOqzGPttQulspIhZQj5WUd6Il+z6w9BY9 2QsaGtbESw8Q3J0mhRplY5N1hH++FvUSK/lFsBOierz1G+pNMZBCGO2RujS6BXD++PPH1bgdMsFqV jkgdAo7oycoDoTcYGDYJn2T8yXBMMQfLYWXnc2JnhjYN+x3Wih7XnMh8QeA9RA3R66jlz8SL9UJm1 OKvGFH8GJ1hpSUZTIFDH9zCR3w/BfZNaajds7fkF2SIJZYp8KXjjba5rhY90amHiY80et4a+A9br1 PmpsBZaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2x3j-00000008IDy-2Cf0; Mon, 21 Oct 2024 18:23:15 +0000 Received: from mail-bn1nam02on2060f.outbound.protection.outlook.com ([2a01:111:f403:2407::60f] helo=NAM02-BN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2x2E-00000008I48-33ys for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 18:21:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iWDgfq1Pk5jXZBaAvEmL3ASgXok+6L1h/S5DJewuVkciV6PZhGiofVQgGFyXqqfc9X8QiFKb4RgI8WmknFS+thylb1pVYglcjBQx9YZjGLgOoV87pMMrNjn5jofLBSL5WJ56rzQZ2sidHnRZr0RIlkpw3qmucGgF9Int+5H13DQ7F5446j8Lj1gtTny+tnopABWzvcDRoQHHOML3Se9hOci2hHexiSTZT/C+FGo6SZP2X5/nG589sctPUtpwNQgCMVSeshrXNYJR18QFB6mcI2ynLzhE0Z3Kd+PAX5EC9WbjhVJlxRQbm912i8eWuI/rPAy09eCqx4UQBj5mg/XhPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/hwGpcslCzp3Ko8IDqz7DUZCh65HadM1eUm5bwt/ai8=; b=zEEvbZUxYGb0hFITn5ZnEtDDgNcAcTSrugQ1afwSsbWhqeLd2/GFzIg//Aa8fDfM+lFXEc2zTkpbU3tX7aZEZE5k4Her+ZOjRILCoYH/6qlr/ezoqeTrTRIDgfAjvaQBimFVyZV1kzebI+6MNzbB40CNGYngAdck85aMBzja7dRCAgvOPkkuKjwdkmzcWvZP+tYU4aZZ+126VVlIz3bVUKgmurWJJ++6x+x2hYlK+FE8UL6LVMBR8SOSBtx+g/00hPw3dedF0AxRl1kuTS0du6m0IL8klgPXOcAksLzd9dz7BT/bMnlPZoo2vVACqWvElRjkZUlblDuSROq9kK0jdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=amd.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=/hwGpcslCzp3Ko8IDqz7DUZCh65HadM1eUm5bwt/ai8=; b=sJpyo5zk2dOlIgUe2oI4W2aUy6po9uuObL0Zar6quQB1ViHvGRlHLMFy/fE2idh+WxBkc2+nNh/ST6rtjaDU7Oe5H4Sq1cRzDbiST4CJPvS/7mKzhFffxD52A4VDZCmnrVy3EmqTR9BMvs419q3MKxytzAMMYwKcRKLUSMTyvc+WbNmBDOOWlCvMfVGGchWpdtZqM87yzTj2Sy1YERakltWPQivbaTEqV+kkMKiKn2qvz+nfPPAYVL44X07VgJt4zF2D85jbV7u4xdYchxT9E+BQQN1zep5isq/DoO+wrS5JROebOslkz/eCCOXro3SbL8jKK+J46QMIzMQAGtYs7Q== Received: from CH0PR04CA0004.namprd04.prod.outlook.com (2603:10b6:610:76::9) by DM6PR12MB4483.namprd12.prod.outlook.com (2603:10b6:5:2a2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29; Mon, 21 Oct 2024 18:21:37 +0000 Received: from CH1PEPF0000A34A.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::93) by CH0PR04CA0004.outlook.office365.com (2603:10b6:610:76::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 18:21:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000A34A.mail.protection.outlook.com (10.167.244.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:21:36 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 21 Oct 2024 11:21:18 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 21 Oct 2024 11:21:18 -0700 Received: from Asurada-Nvidia (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Mon, 21 Oct 2024 11:21:17 -0700 Date: Mon, 21 Oct 2024 11:21:15 -0700 From: Nicolin Chen To: Alexey Kardashevskiy CC: Jason Gunthorpe , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v3 02/11] iommufd: Rename _iommufd_object_alloc to iommufd_object_alloc_elm Message-ID: References: <20241017141416.GZ3559746@nvidia.com> <20241017153749.GA3559746@nvidia.com> <7c5fc87d-0025-4770-86f6-8b48ebfd817e@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <7c5fc87d-0025-4770-86f6-8b48ebfd817e@amd.com> X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34A:EE_|DM6PR12MB4483:EE_ X-MS-Office365-Filtering-Correlation-Id: cb531dab-0dd7-45b4-5b20-08dcf1fd3354 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|7416014|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?76Y5EmuUWFwOOW5qAWG9c6lcl8YNAI1v31ztrfolTAC38FY0nkzfUmyORI7a?= =?us-ascii?Q?w7Wfd5zZy4gdSdxPrCR9KJw74LWToMWE87S7a2z+bLU4YIPX+F8VR7sjHkkX?= =?us-ascii?Q?hEVo+kFTJd0Y8ukXB5baSjt6OLQQ14Azh38mTbtgzG4vluMu3CfbHPUOaiFx?= =?us-ascii?Q?q99/oTxxTzrUUPPQ0jTqTJ5UTuitPq3C3rE7AowqhHBR5zD1bRM430Hq5PVR?= =?us-ascii?Q?egm6u0oWuxADkrX9X7q4VK05/bLFjrpmeZKSwrrxayjiVS6JJktYzUM5ME5g?= =?us-ascii?Q?JMe+SWVUZE5SFVNK6xcXOj4zGyOfWE2b+uclT/cuA1OYrp7FTr69aWB1Y0L5?= =?us-ascii?Q?hXioU5bWMhms5jvg7pntPFy8bvEdXIpwSmURLfOwGQcC8C17oYquW5oW/UsN?= =?us-ascii?Q?ZLeLDeK/uBn7OcuByW3dkgXmyvupM6vU0Xx5+VMV9Ogi59Yszl3FxmYzwAdl?= =?us-ascii?Q?LVplCOpCPNIlDGjPIFiy0k5AeT9W+6ZbuW7qNB1c5EFkAQVpxvczjxNX3ylU?= =?us-ascii?Q?khfn65nM75hB9a3EROVHg+IslwheA6xXcmSsORbZ+X0zXD2jg6AEp035WJTd?= =?us-ascii?Q?RYlR+dgolZd/Xe6zYRFFcfx8FfAOUu/Mqa5ZgdD/HUsNSnjsPL6+rKV6wpBc?= =?us-ascii?Q?JqRhiMfEMoMSGqJlMrB7yZfLtt2ebG6f8BRHea7VB4ozVkm7D/phOCDZYfOE?= =?us-ascii?Q?jYvv68zbpUakFOWvXjLzolBYf5zbGWchC1uk1DKnVvkeV1cM424dNM7o2MxO?= =?us-ascii?Q?NJ5bCp8lkcKnPcio96EDUNCVTD0V9S2kv4AYvZOIX4C7q2VmPQUyOoLQnmRK?= =?us-ascii?Q?5boPkVqld5o3NkRBNlPYrRlhCSjdId7mSl8B/CaWXqCQbd0uozbB6OsAD61q?= =?us-ascii?Q?Waqdgum6UzJWeClDuS4x/p990akzzNUjlCvJSGzyF7mJhs5UcQOwOHxW8dyf?= =?us-ascii?Q?4CzuAyr9rjo6Lqwgvel5IAKY/sjr1YO20jLRtIQY00PZCz/FsYn7R0+Ma/Tm?= =?us-ascii?Q?/RRuPabCQ7xBY/YkGPPJMYwqcx3EKqLvGNVtIwkSSaUndk17cowFfUbXF8Af?= =?us-ascii?Q?vH/cuJEYawWcvGPaiIEIivyP3EUN0p1SyTfIkrGismVLI8oAZvHa+4vB2qX+?= =?us-ascii?Q?D6wFAS2u5wlzKIgr0Dmv6IRPBegxYoNnJb+HC4jc3KGo+sPnThH18/gczj2D?= =?us-ascii?Q?tuZeOMN2wJF+tXrGD3mDDYOz1fVqeQnKvOZWmRmV1nf931LAmCL+4LNsCR3P?= =?us-ascii?Q?Ng2LUlJrHPiyxBUrvIw/1CmikSEqvydVwSMoKm8S3rSGKzmrtNEwnPJhGZp5?= =?us-ascii?Q?IrhGujdGQsvc6s0bGc0O+RAT4PmuUQY0qLivkcjduAPGFOBEgiLyw10fEYfK?= =?us-ascii?Q?rmEGNaVUeAmvH2uR1/OliqdJaY+YuinfiYdnrk+FA73TfoLp/Q=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(7416014)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:21:36.8391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb531dab-0dd7-45b4-5b20-08dcf1fd3354 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000A34A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4483 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_112142_797947_ED4BDF30 X-CRM114-Status: GOOD ( 21.60 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 21, 2024 at 12:26:54PM +1100, Alexey Kardashevskiy wrote: > On 18/10/24 02:37, Jason Gunthorpe wrote: > > On Thu, Oct 17, 2024 at 11:14:16AM -0300, Jason Gunthorpe wrote: > > > On Wed, Oct 09, 2024 at 09:38:02AM -0700, Nicolin Chen wrote: > > > > > > > @@ -217,12 +217,12 @@ iommufd_object_put_and_try_destroy(struct iommufd_ctx *ictx, > > > > iommufd_object_remove(ictx, obj, obj->id, 0); > > > > } > > > > > > > > -struct iommufd_object *_iommufd_object_alloc(struct iommufd_ctx *ictx, > > > > - size_t size, > > > > - enum iommufd_object_type type); > > > > +struct iommufd_object *iommufd_object_alloc_elm(struct iommufd_ctx *ictx, > > > > + size_t size, > > > > + enum iommufd_object_type type); > > > > > > Maybe call it raw instead of elm? elm suggests it is an item in an > > > array or likewise > > > > Or keep this as the __ and rename > > > > #define __iommufd_object_alloc(ictx, ptr, type, obj) \ > > > > That one to _elm like this: > > > > #define iommufd_object_alloc_elm(ictx, ptr, type, elm) \ > > container_of(_iommufd_object_alloc( \ > > ictx, \ > > sizeof(*(ptr)) + BUILD_BUG_ON_ZERO( \ > > offsetof(typeof(*(ptr)), \ > > obj) != 0), \ > > type), \ > > typeof(*(ptr)), elm) > > > > #define iommufd_object_alloc(ictx, ptr, type) \ > > iommufd_object_alloc_elm(ictx, ptr, type, obj) > > > Bikeshedding, yay :) > > After starring at it for 10min - honestly - ditch > iommufd_object_alloc_elm() and just pass "obj" (or "common.obj" in that > single other occasion) to iommufd_object_alloc(). > > __iommufd_object_alloc() - a function - will the actual alloc, > iommufd_object_alloc() - a macro - will do the types + call the __ > variant, simple and no naming issues. All three-level helpers have callers. So that would be a bigger patch than I expected to include in this series. Maybe I should just drop this patch, since it's not functionally necessary. If we want to clean the whole thing, can do with a separate series. > And it would be real nice if it was "iobj" not this "obj" which is way > too generic. Thanks, Again, the renaming would be across the whole folder, not only here. So, I think it could be a separate cleanup series later. Thanks Nicolin