Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3678929pxj; Tue, 1 Jun 2021 10:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNxTjiT6BJpIgCvKVys3Ugd8a2deY1O13il+yn2wSlnOGbvqO2Ngfl1WBRWW72zuGltXfo X-Received: by 2002:a05:6402:430b:: with SMTP id m11mr33456584edc.31.1622569086059; Tue, 01 Jun 2021 10:38:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1622569086; cv=pass; d=google.com; s=arc-20160816; b=DL/BIgrvCj9Z+Uoq5aCFd8k9wf3EAocbiQJcdLPQ6nGjOme03oXNNE5GhG3V4yyLgh aHdHRgPbqy7EMBGL/oX58+1gej0sYbdnvNpRF8G/im4Iygbo6ytx3B+wdX+uLCzpTQMr 2F80fnQLQXuYzmoAG5ISPt8oMU56E08zkLy1Jno5yM8iMWNJWbbZbvDLzWSncJWmdwuc /CbSNWROkUPlGEWMkwDI/KmyPW72fZ9zRRy1PcSyI4Dafu+5xc4XSesNXnjEWq5b+RjR tHOeJs96YViPJoyYK4X61mJ9cf4vS/B5pea35jeQyyRD9MBt0aZAxOaOqEtcbd/VkLA6 sVNg== 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=9M0VCahuU0rRd1OozjLd7E9Vr7n2r0+Rw+efD6JCW8c=; b=GtVw8FQJpvd9ymJ5GqXkYv/MSU5M4iFhFRujENmKaZ7nonMaPuI4yralVI6Iialum0 iZKVc7hgrdK906pGcuHSijyXCiBtQ3XTqKKr42EQznwIWC47Y1Sf6pB27BJHnDDbQG1O lbPHAALVsfCwTCUgO9RA94MUdFA3+PTSCGZgJlUVaHWl+ibNDuGQH/fkLKdIvPNgGyhy gPy1NaN/tpEnNEJm2FYZdDF0HT7b6jA8PoesXGB0eZxZWrn+hPGz9F1Pkllm7e0d5DVL b1Aq5VjGzj5CvW2WrWjbsXFrYkfbfJQhojGTwVxUhfRxZEWb97nkbdhyZEhphHGaBUg9 ppcA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=MRPGnx9S; 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 i13si1949174edn.473.2021.06.01.10.37.42; Tue, 01 Jun 2021 10:38:06 -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=MRPGnx9S; 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 S233056AbhFARiT (ORCPT + 99 others); Tue, 1 Jun 2021 13:38:19 -0400 Received: from mail-dm6nam10on2073.outbound.protection.outlook.com ([40.107.93.73]:5472 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230289AbhFARiS (ORCPT ); Tue, 1 Jun 2021 13:38:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Iqjuax/6nTp2WJOPnCjYVlNI5VQVoe+r5l0LWifZPofL9EalWKixHbteWWD5KsMG0M7880bBprZGXtBr/hkMydaIUVV9OoDBs+kYw7qoPdXiXa5qsgnqm0vsHmwOeJ2ZWi0Uj6UJqXLJdOBsX6H2WTWyIASVRW/ssmuDrova7KGJ60e13UhREKHL1fbsalBaMupzo8dIHODPnjKL4VYz6gLvnoyS0JzTsyC2W+3Tx4j+EgU6f1AlRcGApSs5iqfNL0axTJz/ngiZdZEif26RSclBdXe+YLMK5OQ0zQyBr5/vlZVlItpuMYfQrc3Z7Wtjga08DjC6CsY9H7lgtMAEFQ== 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=9M0VCahuU0rRd1OozjLd7E9Vr7n2r0+Rw+efD6JCW8c=; b=BY+VN0pJPIiFfCgnTop4y8FzPkAtQ7GmR6MJuIRrdlSW8KszSAjVSBJUOHmPXhWlNqOooFKNFMirxYmU2SLB/aa/VBkj0C937mvwJmMGo85vPWvyIM/TqXxY//8VREFrI6K78cNUIiDtLcUb2kUang56U1bCIoIaJ3soZGm7ztw/NicEd29pO1+m3XywUnyS5Cy6n8fJVLvvj0WmuWZET8Zap2Cq2o28TEXzijsPdcYRq2rP4n6sD6UwYbMMgUBvZAiroMxdKSqlVLJyQftIiOdb/f4ygA6obulBstCxbKFwHM34bnFVtOmYCmH3efWn8f1gpqujJCp0Mu55kx4EpA== 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=9M0VCahuU0rRd1OozjLd7E9Vr7n2r0+Rw+efD6JCW8c=; b=MRPGnx9S4pznn77X+65+ZtQhSjW3CvMr/r53UmZgrUQS12HGuG9Bp5wbIluwYWnrdL+gsN45rAKFtP1Arcgj2lcrGyCQk50UZ7MCiQXsOyvA+sRXIpuKaTo6roS5XEOeFUL6WoJMvY8MxzxVHTHI8t3rN/ewtGlgGU1lloHm/XYDGotiMGVj+T47CgFlq0SioXkT2OQ1L6MBTDVouYc3tC/SRp+VDaw4vMNbETRVnnp796C4zvICypRjRBOgW6v2sotAlCJpjLhQOevThz/5jyrBJuCxogsSnSgDqVOKSAG4hqM8gYwm5JbFDie+vTA/P4Q7Umgd6whNYMZhvucwQQ== Authentication-Results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5377.namprd12.prod.outlook.com (2603:10b6:208:31f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.21; Tue, 1 Jun 2021 17:36:35 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e%7]) with mapi id 15.20.4173.030; Tue, 1 Jun 2021 17:36:34 +0000 Date: Tue, 1 Jun 2021 14:36:33 -0300 From: Jason Gunthorpe To: Parav Pandit Cc: "Tian, Kevin" , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "Alex Williamson (alex.williamson@redhat.com)" , Jason Wang , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Jean-Philippe Brucker , David Gibson , Kirti Wankhede , Robin Murphy Subject: Re: [RFC] /dev/ioasid uAPI proposal Message-ID: <20210601173633.GO1002214@nvidia.com> References: <20210531181243.GY1002214@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [47.55.113.94] X-ClientProxiedBy: MN2PR16CA0007.namprd16.prod.outlook.com (2603:10b6:208:134::20) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (47.55.113.94) by MN2PR16CA0007.namprd16.prod.outlook.com (2603:10b6:208:134::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20 via Frontend Transport; Tue, 1 Jun 2021 17:36:34 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lo8Jd-00HXib-QW; Tue, 01 Jun 2021 14:36:33 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46ba1881-6878-4eab-9a59-08d92523cd37 X-MS-TrafficTypeDiagnostic: BL1PR12MB5377: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: emOwnqPppflLBfrZrdWnADOCDuYbrLKzm2Q11vBgd0K1rWNGsF+Yd8dV0VJ9rnBQ7hX0wLuCdI/vtVH7gJNmKr5lk92ot4/WE/CmYKJ2ZM3OwCLbTzpcwuuIdPC6gNigcmXPktk6c7sjcvlahtUd5AkfY+2YE4XEyiDfsGpaMKbobY9J6EZZmePw/H1oCIz2WB1+IbfmuAiEkmdqDL5xeA9u5wdjqzMWGXDzOvxvYb4q+qKtnwuR4mH5zvwJFAtU9cqlwMcLHvbzptNqo2lcK2bAYc8MmZBVbWhejwT91lobnbeC+ngJ9Sk+WytvaV6zggVVW/bQdgk5XEQVTC+TwLTrOEm2F/FErKerukuycCq4+gNOHu0dL/oN4ZyCjWS+p6RE9YfZlHHRbrLX2mUevRbIqer9eUtxY7NmSDo/GjdY2D19B5hk8B94JO4a8uf96V6j8ccSSqNb6wtQ4aVX013n74LlxENI1WTQgcM/34pz3657FHZf8+vNIWaVQJfA+I9056tXC9Hqaj0uHuCeE+lgEQafGdglJWuWQCuBLm5lbNnTmGuZhFLDsTPVhPSNd9SLQpvvNucyREPCYUFbrI5y+xFFmRgXhvNYuUSJNao= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5506.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(346002)(376002)(39860400002)(136003)(396003)(6636002)(9786002)(5660300002)(186003)(33656002)(9746002)(4326008)(316002)(54906003)(37006003)(26005)(6862004)(7416002)(86362001)(83380400001)(2616005)(1076003)(426003)(66476007)(66946007)(66556008)(478600001)(2906002)(36756003)(38100700002)(8676002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?VumFSDISCm/yIvvKSvjRHM1pk85yDBemZTmH3tsfqbRj4M2P5LHJpOYl4u+N?= =?us-ascii?Q?B/pDFc24Iuo7VpRbEpOvg8Yahn+2OgNYO0exffWKZ6M1L5rmfo00T8ADJuQg?= =?us-ascii?Q?xytDaO5l6fADK1HNcP9X6Ju3717QfD2msLlUhyG+qDgEMEQeaYiNZP0oNn9v?= =?us-ascii?Q?9/RriwELQNVwzkSC5xfjgzw1nS+0IunKYi3/PDyLiPYe1PuljIm9AkfXUdkj?= =?us-ascii?Q?N2VBncfFTScFKLeuom0g7cBaHI5lzd+S72vLvXxLpprQRy7ZeqwsZ5+esbcj?= =?us-ascii?Q?vD0PQsx8LI6hxgT+NIDeDYahyKqaZdAuDT++4ZiJE4hSk9zJGoUH4GIertb6?= =?us-ascii?Q?YtaLHi9h6F3DvnYt7IuDlpPDdryvn9vKGGNbtBtQz1a8JaCn8gzySoW4ghad?= =?us-ascii?Q?zAABQoI1r8iKs6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5A?= =?us-ascii?Q?Q/LqIZusUKc7omS1HmODi/UO?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46ba1881-6878-4eab-9a59-08d92523cd37 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2021 17:36:34.8753 (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: keFu5SD0W1ZvhBD4Xt1vgLJanO/dOySO/R7pUB8ePCW5Q8Yr5WCYYncJrMBgZvFg X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5377 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 01, 2021 at 12:04:00PM +0000, Parav Pandit wrote: > > > > From: Jason Gunthorpe > > Sent: Monday, May 31, 2021 11:43 PM > > > > On Mon, May 31, 2021 at 05:37:35PM +0000, Parav Pandit wrote: > > > > > In that case, can it be a new system call? Why does it have to be under > > /dev/ioasid? > > > For example few years back such system call mpin() thought was proposed > > in [1]. > > > > Reference counting of the overall pins are required > > > > So when a pinned pages is incorporated into an IOASID page table in a later > > IOCTL it means it cannot be unpinned while the IOASID page table is using it. > Ok. but cant it use the same refcount of that mmu uses? Manipulating that refcount is part of the overhead that is trying to be avoided here, plus ensuring that the pinned pages accounting doesn't get out of sync with the actual account of pinned pages! > > Then the ioasid's interval tree would be mapped into a page table tree in HW > > format. > Does it mean in simple use case [1], second level page table copy is > maintained in the IOMMU side via map interface? I hope not. It > should use the same as what mmu uses, right? Not a full page by page copy, but some interval reference. Jason