Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp4047832pxy; Tue, 4 May 2021 16:43:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwknD+8l0dKAijE8uOsPE8JRrncFuCWXGD/fRDMSP1yRJDoe1mZ6jcY3l14WNDsw+JK1exu X-Received: by 2002:a17:906:1617:: with SMTP id m23mr25363001ejd.352.1620171781032; Tue, 04 May 2021 16:43:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620171781; cv=pass; d=google.com; s=arc-20160816; b=myaCOSjDKNBrHkSgWxLfWnt3USc7m4wRZ7aJE9RZEC8n5UJvMcaFzAaUJ1SqrI/6zT EjYDbZ2qIfsfoXHLhQtlAAhQc9DMuDMQnDgxQ1cNmINWrvlGqJhaTp2ws5hPaEfXBcWO RU+Jgoa3dzqTFAFIsyQh63WEGnpkReloxDXsxbHoDky+CTG4cBX05OVYmJdtieBEAsb+ kaniyG9D984jVH9ClMEVjLA+OqgNPDORSSGat5U+TZNHxr2BjG/AuAi5faZUEvheKHKg SzqhTmrKABCDd2Tzt12oJ6lF2XtZZlWjEy1+ITbTmiFEkG+SmZDI2NP6lExNWETQVSgk wcwQ== 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=cLArOltAOURLFEyuzKk6PJmJ0pfXnOd1SuIahF/sRjY=; b=bJSR/nCKrSe/srt2dtSyODF4xVwFpgo0objlazlRlEIL1MjLIcIPRGaOERWSw9qGjZ iiV3qGETTF3+CZr8Q3W4zR84k+5hhrQSiAYZAWDjhEOnI3Hy5Oip+dW7AnaB87dGItlv /3xNxmZByfEOLnixZFb63YAFKTkcRJ0tCRiYQ3EvdEgN0vuyPESMWBQqGTSmgn5wU9Y9 yxqtemp9CzO3j8EI5epUPoKPoXL6g017aXe8vkTSXbJE+j9guJ4thHS/nWMIC7cBBDA+ CqTnw/4EAmsYDXhSijdI6OmBH2ey1OSWImZN88pxuckaMpf6H7fdvuOGI0q5MoAgqhUn IFRA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=GxRbyVPg; 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 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si12688589edr.132.2021.05.04.16.42.32; Tue, 04 May 2021 16:43:01 -0700 (PDT) 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=@Nvidia.com header.s=selector2 header.b=GxRbyVPg; 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 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231166AbhEDXQa (ORCPT + 99 others); Tue, 4 May 2021 19:16:30 -0400 Received: from mail-bn7nam10on2080.outbound.protection.outlook.com ([40.107.92.80]:47729 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229960AbhEDXQ3 (ORCPT ); Tue, 4 May 2021 19:16:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OTQ5huxp3RslomJF2vwxlX0isdo5+QebggGZH3NzdpI1tbqX++WcrRlxwTpT/9j71F1NIYRsdVNaZFfPYUWsipmYA4r/n0UQhYvy8ueNG/CIWtYH1ST3d/EMny1+SowK4c1S6RdXJb0tq9w4dm79vv7unYtYHvlHjQLLH48rgBQMUAJQeF3Q6DvdmsliEDDuoIE9y98a2IUl3pUXXS+3IUh0xNHQfW10uXgHjCTkykDXgW623Z3gGHhWLMFc2EHy9baWEC+ekjXpX+Xjgw2U6VuHXRQESepVOhohxTI8TS4OMTBgZknDT3pGnss4AUkSgYatd/ykPkqvZK9Xum7Drw== 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-SenderADCheck; bh=cLArOltAOURLFEyuzKk6PJmJ0pfXnOd1SuIahF/sRjY=; b=nUeI0tknk7LkUAmXGrnMqd8uNkKwLgzS2fsS+eVFOJ7EB/on8W1v0ANAHmkcuTT9saRar0LXjAg4N/S55PuBwhhNKJlC+ss7ENXn8osseAxyQh+MP+JDKjY1/xmlhheYJk3eMeObXhPDmL2eEPJFbwGZjUZFxm2tRdXuL2ZzoLYK329vz2qXaijg3kDpkgsw7TTMH/wJL5zlixj+ISQNepfHDXyDV5paZOZTDRYeEwTS9iRkqs53jQGe0fSNj9a19tKOW7UaMooLq9WyEK2g05NSfmjre1JSf2BGZDmBJNAf30vc/Npe0Y0MNnAQBlROzCRPiUTYA9qyTGBpLW59JA== 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=cLArOltAOURLFEyuzKk6PJmJ0pfXnOd1SuIahF/sRjY=; b=GxRbyVPgdwFtFgyoa4wQA4EGmiWBYPbCwRFPeyYyDyHnYYs/0SoQNe05NHcqaTQdCwt0MNwkNwSz+3DA00sgo2LL0XQRYLm/IMfzyp47L8kdCzbr9GOr5uncuADU3gd8QRy8ms1qHi0OWFPw9L/QyLZL1FGNJykfnzUnHjgjHQR5Crsi/G2a1pH7Qm+I3XhlTdJHHbwuqNQyDSlxmlqSzVk4h7gSXu+1gADhLaXgcFLtO74je+YNnHdnvsZGARjWvCxdxwJFW4gVkIAg36d6rqPXkokwhyZJdKHWkerXxPDDPsDszRX8hkW3qJeR5JvnOa3L1vc0r4xk/RL4YNAmCw== Authentication-Results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM5PR12MB1658.namprd12.prod.outlook.com (2603:10b6:4:5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.44; Tue, 4 May 2021 23:15:32 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::ddb4:2cbb:4589:f039]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::ddb4:2cbb:4589:f039%4]) with mapi id 15.20.4108.025; Tue, 4 May 2021 23:15:32 +0000 Date: Tue, 4 May 2021 20:15:30 -0300 From: Jason Gunthorpe To: Jacob Pan Cc: "Tian, Kevin" , Alex Williamson , "Liu, Yi L" , Auger Eric , Jean-Philippe Brucker , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Li Zefan , Johannes Weiner , Jean-Philippe Brucker , Jonathan Corbet , "Raj, Ashok" , "Wu, Hao" , "Jiang, Dave" Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: <20210504231530.GE1370958@nvidia.com> References: <20210422121020.GT1370958@nvidia.com> <20210423114944.GF1370958@nvidia.com> <20210426123817.GQ1370958@nvidia.com> <20210504084148.4f61d0b5@jacob-builder> <20210504180050.GB1370958@nvidia.com> <20210504151154.02908c63@jacob-builder> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210504151154.02908c63@jacob-builder> X-Originating-IP: [47.55.113.94] X-ClientProxiedBy: BL0PR0102CA0054.prod.exchangelabs.com (2603:10b6:208:25::31) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (47.55.113.94) by BL0PR0102CA0054.prod.exchangelabs.com (2603:10b6:208:25::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.39 via Frontend Transport; Tue, 4 May 2021 23:15:32 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1le4GI-000qOA-6e; Tue, 04 May 2021 20:15:30 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d9d8e17-2f0a-4243-25f3-08d90f5283d0 X-MS-TrafficTypeDiagnostic: DM5PR12MB1658: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /CHyb4m2Q3REo1YpRVmj6fweVXDWgszW+hYPZ1sZyVC6aXSPKiMnIZkjGAotSaQ/E9awLZX5agP318Ir6KHkOkKdW3CmLpw0/1HpeVPtfcyEHLW3v6ui59gjwmxaGmc673qRPwB00ZCS6AhxHM7+6zPzZpZEQ2MGwWnX1zJPdXIKFiex7vekOBMr4hEAxja4POEHLHxsf/suZNaTkRjzVzaXs/USIj6lBWk3gHInDA7B3IUywwwG3zVWkpHlkDuCVy4iFeOU6AfWESt01+O/YkLfDx4dupsS75InWkac2qy+QxW2jO6m3ddtWGa33CgToIQUcRbnzqloEpAoicc8rpA3eYonsrtq8nmaTPsHL9pmQUBXiEw6UneWnyH/PqBcujq5RiYIUUksHMRQtaIDAiwGybeWO6z3gYJjeVZ5Va7iKJMVSXTuqxG2k9EC62lvop6ktU/eE3MG6L42J1+LOAHQvUdbUPNb4FVtpRb/IFZcHHg0ulkgbvYpSNgnH890S67bKYDbMjMOSCOARSJI4iqvHJSOl5VIkX35zOkFVjCyjPicy6lGWNpENdp2wEm18sd6jtCrce9x5C8bQiQbs2t73CnkvU+PWGz13Zjo6Is= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3834.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(39860400002)(366004)(136003)(396003)(38100700002)(83380400001)(26005)(9786002)(36756003)(9746002)(2906002)(33656002)(7416002)(66946007)(186003)(8676002)(4326008)(86362001)(478600001)(66476007)(2616005)(5660300002)(66556008)(6916009)(426003)(8936002)(1076003)(316002)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?mxm2q07Ue/iHOJ9eWwwdEFtTo32MOQjPguDAhqEIV9RA79x8P+Vp1rNGN1Y2?= =?us-ascii?Q?RmUen59DvqV9zRpoIn1uFzjY1xgXLYy8cvv/z2547MlKUvLlhtyz8armXGhA?= =?us-ascii?Q?DqRrWj0NVXQXvE9s6YeHzu8XDZHhPj0EgxEoC/Rhm4TCs8lCZLB4FNeuSJWn?= =?us-ascii?Q?hfGS6LegTCtFVhlyVbdLxnp8z2XtPyTxqC0ZSxsHAD5Dd32VGAy9TEpvbd1K?= =?us-ascii?Q?aPFk6g+nJYeLAxtH4lV2NTqbeSimeQjdKnLbNo7rgciZBzK1Sq9rL0+9gpH5?= =?us-ascii?Q?ZSSjM2nlwkfU1KWjCsH4Q5shFyrSwHhZcd3EqW07cLKnFlhMZj1t5MOlrP3H?= =?us-ascii?Q?69+Z9q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k?= =?us-ascii?Q?RwGWiKrb5IcvuVDEftr1sKU5rYFYTNuwruTzb85RNoQxXEir3axchL9NzSuZ?= =?us-ascii?Q?Dk3+0Ab9x+SLjjTahshwtNaA?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d9d8e17-2f0a-4243-25f3-08d90f5283d0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 23:15:32.6205 (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: YnHsjKekZ+EfgtzIHRMdn+L8MgkcUU7p6blpRW7fBAVg8Xct2NqqK9q9456CGJ6w X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1658 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 04, 2021 at 03:11:54PM -0700, Jacob Pan wrote: > > It is a weird way to use xarray to have a structure which > > itself is just a wrapper around another RCU protected structure. > > > > Make the caller supply the ioasid_data memory, embedded in its own > > element, get rid of the void * and rely on XA_ZERO_ENTRY to hold > > allocated but not active entries. > > > Let me try to paraphrase to make sure I understand. Currently > struct ioasid_data is private to the iasid core, its memory is allocated by > the ioasid core. > > You are suggesting the following: > 1. make struct ioasid_data public > 2. caller allocates memory for ioasid_data, initialize it then pass it to > ioasid_alloc to store in the xarray > 3. caller will be responsible for setting private data inside ioasid_data > and do call_rcu after update if needed. Basically, but you probably won't need a "private data" once the caller has this struct as it can just embed it in whatever larger struct makes sense for it and use container_of/etc I didn't look too closely at the whole thing though. Honestly I'm a bit puzzled why we need a pluggable global allocator framework.. The whole framework went to some trouble to isolate everything into iommu drivers then that whole design is disturbed by this global thing. Jason