Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2742320pxj; Mon, 10 May 2021 09:42:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+hSnVHvtnku1lBUMJnjSwGmyi9SNzjbv2BCy2tS0AScLhReKBUS3HEHH+LIu3jI5i8vDH X-Received: by 2002:aa7:c896:: with SMTP id p22mr30550584eds.225.1620664968993; Mon, 10 May 2021 09:42:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620664968; cv=pass; d=google.com; s=arc-20160816; b=A+gF+ORYt3x4ZxovhRuUPR77dcPzhdNprHpviCDyC5KrBDCrLqj1mcHMRYlf90cbWK b95OcWJMeLrgg1tna/5kD4NNvZq+BWWr1e4EifENftEcYOALhtPvrxGaqmZagLxU0N2Q AU5CWMwdVjGDjbXKjz+k3bmX1PCBKcoLT6ZOJT44kOP7SnkC8Q0q74NunGMFfTC491HP LzyjKzrr2cD/UnK8SDYMEc8ip7hxA7nVDuF9T0uEbJMCqO9gNe4+y4Ok2FYyH3g1H/wK T6j+PYgYKNLZyO+u0R0z/Nnrnmw3ONfj23IG+kp8gv3BNxMtMZ4lcLKKuG6GzY9BGpMJ PLcA== 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=aamh5W010c99pQ7W0CL0uGNQYPJkJSYQhWeISNlUlrs=; b=1JXFBY89NKNqK4iLVbFRew2YpOLNDz2EVSr5eQ5BRuH8aIx1TJH+F4j928TqTx513z Yl6c4uvnOKkHgNcQdxznPe5kwouTmqD69MDHUIYrgRydfJcKcY2c3rYBZoRHWPprZrCG xViYrgUxvgqqTAE1j3r8+ONzv2Gnrb9za6QlX1YOIBRuiBXDZeZEbN642HpGP1a+4PQl NXLxfzy/9Dy3wHNJDKUTjAbZYFN75FSua1xL8vuz7pFOBcDrq+aoGPSYSWPszrXKmtiG SsQVALKjNzM24c2MkRfoYe752hx1/7axTn9jnKRq2P/Zy5Ug3PMR26nzi/FXZfQAIV+p Uz5g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="XxNzY7/9"; 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 cw16si14234478ejb.337.2021.05.10.09.42.25; Mon, 10 May 2021 09:42:48 -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="XxNzY7/9"; 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 S232057AbhEJQlp (ORCPT + 99 others); Mon, 10 May 2021 12:41:45 -0400 Received: from mail-mw2nam10on2082.outbound.protection.outlook.com ([40.107.94.82]:27531 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232107AbhEJQlE (ORCPT ); Mon, 10 May 2021 12:41:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AmioHs3IgmS2vIbDXGS10leCYUGRH+Kgj/wv1WZ8pM5Buasdv35MKUNiCgK4S7WhsRt3PecixTSHPNB9Xk8ce8gyC9wKfUAWLIp8oamG5wwUhCgUu7AH95NbBgNTt9SmLHNZ3CooqKFm60zQ2DZToi6bokyJrKcHhIIskTDVSbKHzVNdbANiJDGyh7tg/9Nto5ikwPSkCAvNj6dO+qANZew0a2PJD7S7oKkzD3iE4kM3bOWEgKI/UKzayIc93iaAZ61udsn7cM/0k4pMIIIYhldI2irTp6mwRM9W1BaWRq7ZBmPUWGkmdYsUx2vK/M7Bvy6++wb/rcmnDGnn5qE63Q== 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=aamh5W010c99pQ7W0CL0uGNQYPJkJSYQhWeISNlUlrs=; b=EWFehVXM/ZLdGl5hZMxwvViZ8+zDwPCxPvZHSdwRXdJLjd4002f7x/X9Aq1vONsO8ftpBuknUAJX4Y4SKngcu8E8F8DceFlsL83rHtVyqUEq6Yc6GZ/XDTiDteT6sJpcH9iksmwCNrLbfCVO84A/eNGA6sw2lOqks8Ro2mN0DBcyLJ2VA8DWkQhg7lNihmhnJ9JjHBFHCEw1ImvZb/PdELFk+8HwaEU5909GI7GQiNYPBfnSrapARK6zRFtEpjibLrTw/HF+ybnWyzTVWLDP/Tda6/vvU3DTeFWd3khyGjGulgPmAmfK7pdS73OxAA9CHxHXTk4xZis1sawtoWjLDQ== 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=aamh5W010c99pQ7W0CL0uGNQYPJkJSYQhWeISNlUlrs=; b=XxNzY7/9N5ELx34GFE8E+TpvXWkGDVvKYRwIkv/H0wEl32DxSZR2zPN+Hh3dv2w4sKal5p02VsUSTievXnIKp5bqfTU6EYQ/e3Zh4flVk8+syjdsiOyXUt/+s5OcJSj9rqQSWmhDO0LZuXsf7UA8SrwZTLCRyK/rVwBMK4d+Xht/kH7c0oxoJJZPpBpt+FA3oA/o118Kc2v9kkCLT23lPf3ZKAn+1wkE8DSs48mX/iOPewS6oLggHjMoOyCb9wWWSyqDtdH/BxwB3PJgg8+iknzazbZZusvSZau8YFxAqCY2djkYGo+2ceBzdVTvS35Q6enxL4BH9udSXgEOop4OtQ== Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM6PR12MB4265.namprd12.prod.outlook.com (2603:10b6:5:211::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Mon, 10 May 2021 16:39:57 +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.031; Mon, 10 May 2021 16:39:57 +0000 Date: Mon, 10 May 2021 13:39:56 -0300 From: Jason Gunthorpe To: "Raj, Ashok" Cc: "Tian, Kevin" , Jean-Philippe Brucker , Jacob Pan , Alex Williamson , "Liu, Yi L" , Auger Eric , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Johannes Weiner , Jean-Philippe Brucker , Jonathan Corbet , "Wu, Hao" , "Jiang, Dave" Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: <20210510163956.GD1002214@nvidia.com> References: <20210505180023.GJ1370958@nvidia.com> <20210505130446.3ee2fccd@jacob-builder> <20210506122730.GQ1370958@nvidia.com> <20210506163240.GA9058@otc-nc-03> <20210510123729.GA1002214@nvidia.com> <20210510152502.GA90095@otc-nc-03> <20210510153111.GB1002214@nvidia.com> <20210510162212.GB90095@otc-nc-03> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210510162212.GB90095@otc-nc-03> X-Originating-IP: [47.55.113.94] X-ClientProxiedBy: MN2PR01CA0003.prod.exchangelabs.com (2603:10b6:208:10c::16) 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 MN2PR01CA0003.prod.exchangelabs.com (2603:10b6:208:10c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Mon, 10 May 2021 16:39:57 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lg8wm-004cE1-4S; Mon, 10 May 2021 13:39:56 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0107b155-b884-4ed9-fe7d-08d913d23f27 X-MS-TrafficTypeDiagnostic: DM6PR12MB4265: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MYEyVuQUkNwQ/2mXGXlp/C9VFMxmarNSuakArYYwtoC5+9+wCgyA99mBABmSiBp36d+UCTDAmApy+l6qcN+GMkSAQPZorSecgANkaXOKkNyDUhxfd0HZ+97UV49QEqYXCJcJYQuslJxVlPiNxlqgoocYNr/AVw9KyUfWwPyBtB6kRHwWtJg6+zcjLZjkC15OG7njxKfweZ4dAPrvHnJ1BQ7eOFJTKzkzk1xAHWFbk/z8zV0DCbDUv9HldL+fvPi3/7j2nhkyhfSqRlf+LBHXS+1nGahEFtYt0NTIj0O8QO39TRV3kdDkGzlsoqmhS9yBEPXa92PTIcMWwgsJiBwpIagWvEFcF3N42ii5oauH8LobInKCuipPAcYGJTChJ/gBFwBANnTmQfbrK7YXCINTtNvCF+gapIsh0YyupKZKQIPagdWjWipcApde+gcgx22eU03O0VutytJvjrIq+/jSChcQ3PL56yFEDF+6x4vX6x7faTnnTfS9RAqoEW6ZKilovqFswvE5+thPtaGqiIn7j+xIEDkgE6qwYMd1QRdsiK26hUnZbuC6KYnIreFxfgI6zxB00XSUxyoHE9lNa97tjdZibip2wp6qMP+UruGjBts= 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)(366004)(39860400002)(136003)(396003)(346002)(376002)(4326008)(2906002)(8936002)(7416002)(66476007)(478600001)(316002)(426003)(33656002)(2616005)(186003)(9786002)(8676002)(66946007)(54906003)(5660300002)(66556008)(86362001)(9746002)(38100700002)(26005)(1076003)(36756003)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?1NuXN0GZYIM2zK5Rys4YHSNpPeDE9QMK741jEWWgZjTnV7nSs3T7+HCKbdFO?= =?us-ascii?Q?Ld3i8rlhlgYPXzu5ppFuyDv20GJ1JTlIndINsTX6LdxiPbpBWR64KMbIAxw4?= =?us-ascii?Q?YB1kfqX0DGlUXbOzcypHyh0cN+eEgbmBzVsB/SEQjHBs6hRqY5F2eDR6vIsL?= =?us-ascii?Q?G7Zpm9pEd2Z42USvN0YFvZWz91G9xP/DWzSM62MnKj9IM5HnOdH7Cogw+3tr?= =?us-ascii?Q?36kIXrEDbmVKYZQIu37KaAggLoYK7dwy86NxGdbz9o+U8QSQ/JERF2NrtvE+?= =?us-ascii?Q?DqcSPiM1wNG2Lm3uxbuHMVA8pLq6LiUEPnZFYw80hgdZLCjIe34bOOD0oAgW?= =?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33Gk5DR0Gf1R+F4BYj4O9MzIjY6J0ubP0REbhW?= =?us-ascii?Q?WtQeI86Yx3lAp13iEemLoHCTLxlEnrKOwLQ850I2DnmgltwRNFvbXZwbfsYF?= =?us-ascii?Q?2b7oysCCz8OVTb8WX/49+Sya?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0107b155-b884-4ed9-fe7d-08d913d23f27 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:39:57.6959 (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: Rh96MM3F4as38GjrCbuDGzyuD6tUU1Fy8UYd1uWBJCCDa+hMbowVv0XWSEEEmHvP X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4265 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021 at 09:22:12AM -0700, Raj, Ashok wrote: > Those vIOMMU's will have a capability that it supports PASID allocation > interface. When you allocate you can say what type of PASID you need > (shared vs local) and Qemu will obtain either within the local range, or in > the shared range. Isn't this what I've been saying? This all has to be explicit, and it is all local to the iommu driver. At worst we'd have some single global API 'get me a global PASID' which co-ordinates with all the iommu drivers to actually implement it. > > > When we have both SRIOV and shared WQ exposed to the same guest, we > > > do have an issue. The simplest way that I thought was to have a guest > > > and host PASID separation. Where the guest has its own PASID space > > > and host has its own carved out. Guest can do what ever it wants within > > > that allocated space without fear of any collition with any other device. > > > > And how do you reliably migrate if the target kernel has a PASID > > already allocated in that range? > > For any shared range, remember there is a mapping table. And since those > ranges are always reserved in the new host it isn't a problem. It is a smaller problem - all the ranges still need to match between hosts and so forth. It is tractable but this all needs to be API'd properly and nothing can be implicit, including the global/local range split. Basically all this needs to come through in your /dev/ioasid API RFC proposal that I hope is being worked on. I still think it is smarter to push a group of RID's into a global allocation group and accept there are potential downsides with that than to try to force a global allocation group on every RID and then try to fix the mess that makes for non-ENQCMD devices. Jason