Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp547298pxf; Wed, 24 Mar 2021 10:07:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4tJx1F5Bv4AirDxF5ljgr2LyGpImhsZ0/f7w2PJaB5AnC0Pj5Seea865aOF5ICti1WIDO X-Received: by 2002:aa7:cd6a:: with SMTP id ca10mr4536629edb.7.1616605667413; Wed, 24 Mar 2021 10:07:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1616605667; cv=pass; d=google.com; s=arc-20160816; b=PPhh2WCfZks6qJbJ2DxGmsuSXKNshG6QDOsWnx21Nz/yEuOkFYaq/dftHwvGEkQMTD lgjv8giUhCJMz+yZALyGe8f9FQIdDSE4xZqSiASD9GrDgMi0sNSVhQdRn8z7Hvz6+hC0 46gkUVzsXgsfHJO5bTkxpcxrnu1CfsSS1kktAVyWSSHWPhtjHFtit8Wot/hYfwGRp0Iu sCi2nWVmqYyVYh/WD7Lm9KPEUia2nVIcbJm2v5rlH1aAVVJ331DMocEPX8RSv717+Fff dfLirYjabc3rcRpx1kuqw11guS+lL/4yI9oCtkdmt4+G893MtCaLcrG+8Hbk2EqaQMRN M6aw== 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=Uzr+K3BRDxSN1riRVVfJ2WL/Ho0CU52QiKj0ERMcv9w=; b=zrH6mDgKvDHXwKHoJCsa/9KYj1wQiPaH5o+bL/n5EovdX0VGSn82imXbrD11Z8vvwd 2JpLDnF7pi4THWCBvdOfJJSpkIuJrFBV2ADkYo6VF/vOy9uVBPuQiul94A2aBH2JnTC6 6JfT1saVcUUYqL9neH2yz62UWrWZbCKhkAcnCLE6/cB4XKXH5myL6N+emi8A4YAuavrc fL4KUMJ1kFtgZbQbLbeXCWNsEVF0WXhaArK7LCaPy1UTgC/MQMcQjumAEZKkz87rWm89 xLCVY5X7ZbgvgXrCChxPl9/BahcNM+bsoQ5TkW0097D4DoSyU4qk37QvM2ivbf4KiPkk NvJQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=sDdOckxw; 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 w24si2202641eds.559.2021.03.24.10.07.22; Wed, 24 Mar 2021 10:07:47 -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=sDdOckxw; 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 S236825AbhCXRDr (ORCPT + 99 others); Wed, 24 Mar 2021 13:03:47 -0400 Received: from mail-mw2nam12on2067.outbound.protection.outlook.com ([40.107.244.67]:46092 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236257AbhCXRDm (ORCPT ); Wed, 24 Mar 2021 13:03:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C2nTVZFzGpXDYpLVEq4bo9vjptZBad6SW3kBxFag8WiS2sT1cOnrWw9xEf6wtBzSGNJzC+ZQsC+QGboLhQbPVXWjlzk3eNqL7SZfCSEdE2v9izDQ6T/rUn2+HV5D7zl2q/VI+2QOeic9Trg7i+ykMQedBg43oDbriRinEqE8WP2PPp3tsp/iien9f1vtRSD8hQTo/3sS/lBoQNbNDFLS9D3i7U1OZZFgE1xRCCxxuvQuu0u0acFOwP3nRe/zajpApuTJmpy7wtN2ftyuGpk0+Yn0/Y8G9QiavdQzGX5xyAyp6QKD5oQLDtpzQcjLf2Lxo1iErulKbnz4wkHEu1K70Q== 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=Uzr+K3BRDxSN1riRVVfJ2WL/Ho0CU52QiKj0ERMcv9w=; b=IcdlC0aeNmSwYczrTN9ocxYnVy6NQI85m63r0JOzpOoDb5TES9wDcyeO1TlDhQyamhhjSYp5k/i8Xb6xs330XeBQlw/wsGqXL/sONkLQ4j8o3Jp12TM2FBHhIeqUyD+tLYraRkmryh0o9HlzAym4QCmVnqI8t4bLnCEsb5tp131amv1L7XpE/thyCLEZxZuEzcvm84x1sSiAJu+59As+16Yt9c8XKoIYQhUTwZzMcNJ4F2MxhCSqGovQNWBub+keBVGhp4B7l0zRODBo31hAzXZQjRCV+Vtsj3n1zOk0xex1VmmpimITG5WZnV54Ts3Q0HNxGa/RxGOjScYN3Sb0nQ== 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=Uzr+K3BRDxSN1riRVVfJ2WL/Ho0CU52QiKj0ERMcv9w=; b=sDdOckxwkgSHEz6mRMpkT1XRJw4UZByb2yMGmmn4/mUdLEWzt6FfXd/XnRtMqUtkaTLKPdUxTlqu6yB2a/aYctAamkuBn6JUwz9E9YTzmKN2go+YJ/0aZ+qNjPn1rI79l+w3U4BMQlnyK4SmTj8991e0N/PdYMNS0eofgfhUlyGlqOc+2D6fvTZDl2rm2HhjPkLFrLteNnUAakll6PnhqQxKbVNViHJW8rybDLjmcFSSrcoSOt83o74J5iHWrYM2kwYprSKLW73S3bkkatns53VHK3X2JkoiYknLpFQ7oT0SNYkDCFq6XzfuFBge9O0FxhxN7TaZWHVMEf3xaHtT0g== 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 DM6PR12MB4810.namprd12.prod.outlook.com (2603:10b6:5:1f7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Wed, 24 Mar 2021 17:03:41 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87%6]) with mapi id 15.20.3955.027; Wed, 24 Mar 2021 17:03:41 +0000 Date: Wed, 24 Mar 2021 14:03:38 -0300 From: Jason Gunthorpe To: Jacob Pan Cc: 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 , Alex Williamson , Eric Auger , Jonathan Corbet , Raj Ashok , "Tian, Kevin" , Yi Liu , Wu Hao , Dave Jiang Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: <20210324170338.GM2356281@nvidia.com> References: <1614463286-97618-1-git-send-email-jacob.jun.pan@linux.intel.com> <1614463286-97618-6-git-send-email-jacob.jun.pan@linux.intel.com> <20210318172234.3e8c34f7@jacob-builder> <20210319124645.GP2356281@nvidia.com> <20210319135432.GT2356281@nvidia.com> <20210319112221.5123b984@jacob-builder> <20210324100246.4e6b8aa1@jacob-builder> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210324100246.4e6b8aa1@jacob-builder> X-Originating-IP: [206.223.160.26] X-ClientProxiedBy: YT1PR01CA0087.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2d::26) 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 (206.223.160.26) by YT1PR01CA0087.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.24 via Frontend Transport; Wed, 24 Mar 2021 17:03:40 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lP6uw-00257V-F6; Wed, 24 Mar 2021 14:03:38 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a4038da-8c20-459f-2356-08d8eee6c63e X-MS-TrafficTypeDiagnostic: DM6PR12MB4810: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FIjY2HL58TrYFhGy6Gov0cEmLIuon7XC4/aa1+9tcMvuo55O4WoVU6Lwgil6enWrJDv2x+A8J5bClHp3eEBsPmlR+Q6BNBhb2jcVndKyG4uXOcAAH5JodXGPevKxz0BTXF+MXet07nxd6Ez70VUnw4roTJDE7VJh60jB0jcsVsQ2x6wPFYZuwW/gp6PQ9rrFRO34B/l7Bl+BAUbXzoG8mi036qI8Gc7+fIZR8ZwfTJsZoz+976U77GcK7ZOSXVXaqJOqYNTEvpkTcCt3hRBu40cih1xjy/+cLnOCXcSlg1r8NcsqjNc13+smVzplY7t/un7vNv2xX3K7WWyPaqLdrZRAGvKkWCilohN8z3ikHFduLvC0tN/XuzZ+ZXgGPHI0EOLfORq88X/RgZJWT/pIwOh0SQdpNH5Kpg09ezRBYJ3nPidMotD8tVIXUwyPxPO5EiwhqFOmr5uKtdBbYSGhfVrEayfV+Z1MOcpRG/uUTCHJbQxpIPdJIegEHTDS7KDPDGFocEDfMB9QkTlAQTL/JuHRHgCdU05iqJhoC0/C1IhNhprVBaO/7Z/aSlx6xZ99bOM2vkVF3Wm4PWa/WR8+ac6lDFVZxh69Z+OOMx30jGbYEf3ZCm+I3VuxLRSB5+QGan84eztV68YH+ylOwz0zXLWlL/Tc7DPDSz/05hVQAgo= 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)(39860400002)(346002)(396003)(366004)(136003)(4326008)(7416002)(5660300002)(6916009)(54906003)(8676002)(186003)(26005)(8936002)(2616005)(316002)(1076003)(9786002)(36756003)(66946007)(33656002)(2906002)(83380400001)(66476007)(66556008)(86362001)(9746002)(426003)(38100700001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?vAtRwbinABwNOKNJMZQOaqV/hbG4QbbZUU2Hu4k9B/fsnZViP8rTU5BewDdu?= =?us-ascii?Q?eKPZSvwQbPUs1qIBLcnp5ctjeW8ykaArS+LpOHmfNjeDKz+RHArse5tBtJAI?= =?us-ascii?Q?G9M2I3VnuHN6BjNU41kinl2FRjN+bp4sx5eAAcrLVKILEXwjTVySnXwC4lFM?= =?us-ascii?Q?d+rpeEi2CbVY7B1l5o15OCPlWjxJzcwBCnnLeJje3N+UYdqYPuKyTBMUixCA?= =?us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0SjLDfBEUn1SZtY/p4nWu7t4f?= =?us-ascii?Q?8K7x5K6ak8A2dy6M73cuSNxLxQmyNuNhQ7azRBSgY7lco2TjvwLzCAdTDyS5?= =?us-ascii?Q?j3CoQQ/KBoNf4gZQ4c9Zi40I6syDZ2Zc/S5EKRAxEbmBaHxT2gBf4saQbNyg?= =?us-ascii?Q?vESEJNJv266CIwQPNt6JBREniYWsRzvAFPaCBRKBmIH9nZEWQNcLGiACLFVd?= =?us-ascii?Q?FS4nwMMm43HnH+W5mLunIY4s?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a4038da-8c20-459f-2356-08d8eee6c63e X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2021 17:03:41.1433 (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: s7P3+7kjQ79bxO/F3WqJA3zWpNtU31C0pyC0hMBMbK9qkGZCqGe8P+7cFVtzxbX4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4810 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 10:02:46AM -0700, Jacob Pan wrote: > > Also wondering about device driver allocating auxiliary domains for their > > private use, to do iommu_map/unmap on private PASIDs (a clean replacement > > to super SVA, for example). Would that go through the same path as > > /dev/ioasid and use the cgroup of current task? > > For the in-kernel private use, I don't think we should restrict based on > cgroup, since there is no affinity to user processes. I also think the > PASID allocation should just use kernel API instead of /dev/ioasid. Why > would user space need to know the actual PASID # for device private domains? > Maybe I missed your idea? There is not much in the kernel that isn't triggered by a process, I would be careful about the idea that there is a class of users that can consume a cgroup controlled resource without being inside the cgroup. We've got into trouble before overlooking this and with something greenfield like PASID it would be best built in to the API to prevent a mistake. eg accepting a cgroup or process input to the allocator. Jason