Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5041431rwb; Mon, 8 Aug 2022 11:04:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR6bGRWAR5e25I3IOTHjr4mxWk5ttkaGKzi4SETvn4Yt9xfCerfBGuC00iEBq0UHlpmGdFQd X-Received: by 2002:a17:90b:1b05:b0:1f7:3ac7:f044 with SMTP id nu5-20020a17090b1b0500b001f73ac7f044mr9569137pjb.214.1659981864195; Mon, 08 Aug 2022 11:04:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1659981864; cv=pass; d=google.com; s=arc-20160816; b=sPQlwT17vGWnUjM1DHXsVfboeQR7+j96Y+yczzuiK6lQ2RQT9szVvhdEalqswXm5kf Bclwl4SbPZMxI7vf2qDhN23EIIkB7nfR0pnQ9ufA9LEkYedMrpJGAJL1cQ3nhQ9yF67d x2iAtjFAWpFGp+fould6egrIpUpfiLNzh04+F+1oB/osZCg9xLGTJ3o08Pnksbjrj0uk NdudhJvt4eSufsPMm6g3fKjMArxSAxdyhLOBzo6XbhC30EupKW4JmHEF+IO3tbumJULl 7tEHXg8yc9fCYIiOmImItYl6fwaLMieiTGnzRHO9xrzjoM3fLO0DNzdmds0xpyZ4zwHq z63w== 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=LvTuLlqZpTdfz6++n2TgcdsYiuU98HQgWIMUUuCaa7I=; b=I4CIXDv9FNNlBgpOogaVbkgNV3EoMZOUfgEu+V0YGVK/+vb/agicQtr/prg4XzeKmU 0TqkgXGjoAnTn2z3wJzw9Xwyg/qX7JxIod8taqGXQoltLjHT3ydYoipk25u5PpIye11n WnY78MYXkOQjnf2VlJ+iS6l8h+FMXNl3/xKwfB5E5iUzmehxa1mOkxkh8PO5nH24lmsh bIC0kwnzoPssvYLoG4KH0wce0NDPEBU3+dR18jtkhSaJwbvIN/ivyIeXJvi+6tZObkYh hPzCwfGKoMwmoUi2q4A01YxzP2+9E1DHT4EpFSdOLv93FTkk04YmUFaiAvKN1ql8Ck4X deUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="g/hDSMpH"; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l5-20020a170903120500b0016d6b4c501csi12439503plh.571.2022.08.08.11.04.08; Mon, 08 Aug 2022 11:04:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="g/hDSMpH"; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243961AbiHHRze (ORCPT + 99 others); Mon, 8 Aug 2022 13:55:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238087AbiHHRzb (ORCPT ); Mon, 8 Aug 2022 13:55:31 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2073.outbound.protection.outlook.com [40.107.101.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C47D362F8 for ; Mon, 8 Aug 2022 10:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kql/kc3C/HIQAQjWGr+B5VsaUo4SsS6Yk+VMecbYb6/wVA5CGOqR4mJNBWdFW7jBskS1NJNb+9WgNRfUc4G0hG8SPd94YGwhtKfEm/ud6pMjJwV+t9bx7MCL0oa0N4gIUWv5ZvkPm889TspEm0dW4I7NF/8/kuQnwvCZtCe6+NuP4lmV4TRdArzSlhpwaSaLwtdv6syOVVf8+Kr6tMWX4wVTxrzvxlq/TK5Nmfae7xuo43CnRoS84B+y0D0RVTlTxbnalJGITUPjgi3RlDW2arNN9Qe1MpVDIYGBm7IMf/5MO1tPaq+KiSw0WwqfIsFnsTdJmdJYs0qF3HdfYs6wxA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LvTuLlqZpTdfz6++n2TgcdsYiuU98HQgWIMUUuCaa7I=; b=QrY+hvBRODRyxpBpBdUAZ1QQV6tGMq5TUwQkFGbUJRQGAzf4oPgzp2TMd0KA+fKLQQKNGSV9L8slXmMZfM3uOPOkeCTn92DQIQ8FSLyO5wc5kpwSCoVxvfqCEJvmRWF5Xd/YhCeuZxgy7BtwcpQFesjAA0LGEhyFHETYC6rrjotwuuEAv0tXcL26uuV74QroD+y+C1nxy/c212OYBiwEFR9xcO7VtFUiD8jqKKlYd+uvQ/GCPGobzNQbS0piH691Ld+82/7E9GfZ2/BvNOp6RIDLemI+9BSrj+lxB5HYDcT4zmRZa8EGMGOJiKb7DBijY5uCjI7sHSvDhIXRJpJZpw== 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=LvTuLlqZpTdfz6++n2TgcdsYiuU98HQgWIMUUuCaa7I=; b=g/hDSMpHqg5SpR82BHz4Wq83e39MVozIvKliMl5EKLZfMpTiIB5Df6Q9Hbyy31qG/Ag6oxqv3wCoRnATjwfWCtGkbmPAPbzNu1JQEGAE0uxMgOfOAgkgxxyr95phojW1YpnAPAFkcPgpeKvEBr9quFDrIRJZPfoica7vjpVm7zC2G7BWcT7qbP0/yQHC9G4xFdKoXrMMsKFdUNx5vq5Ng8Vlv2vTo1lwoOG8/yCQe/PG1azRhOT/jB5zd45Wk+FLiuFi3allyjaT6DMF0Qqs9zGq4B2K+7e4TEnYumZHq1DBh47YaVMt+og1+/TNrBmQYl3/JOW2YvOElKUKcLTFlA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) by DM5PR12MB4679.namprd12.prod.outlook.com (2603:10b6:4:a2::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.18; Mon, 8 Aug 2022 17:55:29 +0000 Received: from MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::1a7:7daa:9230:1372]) by MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::1a7:7daa:9230:1372%7]) with mapi id 15.20.5504.020; Mon, 8 Aug 2022 17:55:29 +0000 Date: Mon, 8 Aug 2022 14:55:28 -0300 From: Jason Gunthorpe To: Greg Kroah-Hartman Cc: Oded Gabbay , Dave Airlie , dri-devel , Yuji Ishikawa , Jiho Chu , Arnd Bergmann , "Linux-Kernel@Vger. Kernel. Org" Subject: Re: New subsystem for acceleration devices Message-ID: References: Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BL0PR02CA0024.namprd02.prod.outlook.com (2603:10b6:207:3c::37) To MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fbff7d45-2677-4b30-bcc7-08da79672e1e X-MS-TrafficTypeDiagnostic: DM5PR12MB4679:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xHFz3CrcWKal28yjZ1EdBGH8WAvF6g9SzYvSXOg58so23ZCZI1z4NvvgJE6RjqmzZWoaSrMzlENkTLiJYhhuMlgdLEUgzs+kN+vwlxuqZLyXEn8upXamy/BWI1xX/IIo8fxgR3zly+4EcBY7CnXbgx3D9nQXENhn/UrFz9m4GIR9LHCBQTmJnuRaGcf7UJAWBof9hZdmVoqZ8xW9vZtxOzV4PmCHj3/lJ1QwX+zA4POwf/sPrh0A7wG4BN82frKJwOsgqgIkKD8zc89li3F8XXnL+j4JUa8YLAXsPRxGpAU9z5zxxpckb9/+q8xKuLASJWLgE4kE3tbrPKswuAoiWm7FFUex/wQ5R7ZIOxDXqnoX/tsb1Zq8Hn7UJhBcyAxvLAO1bpqOYGPxjoeSbTxlOOaE/eUUwh101BHXNNIhV0SxJtSfTONekmCS0MpDN23+cDUAx3kdjZpkHN3nP6bDWMe8ajpupBJmMUCorsqs+CkBMfxHElJ9nc6zewn4AAc25dyuYFhiDmWIK+z6v1ba6PJIhvHVKNDhCQC0EqD0OFoBkxAKAAnK25Wa6mawSi0aoSuXPkOREMtVVcx8fdAet98MzlRhADcL93ZRGwtz+8UNzh37XTIwMmOWwywQMPpCweSkjKLqi444vJSN5vGEzd3HvK/X/oRJDZENd7+F0oZDFlZhAfmINBBDLCuMJvvW22ixRS+ibIHIFzdkalbmyYZcK1eK0OPrq8dcn/B+2Bg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4192.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(366004)(396003)(136003)(376002)(346002)(66556008)(5660300002)(66946007)(478600001)(66476007)(4326008)(316002)(54906003)(6916009)(8676002)(86362001)(36756003)(6486002)(8936002)(2906002)(83380400001)(38100700002)(6506007)(41300700001)(6512007)(26005)(186003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WNHAsvAbbO6AxzW6DGoDugeaqLsaLfHkhSELErAaLHg8xdAhx/CtID1HAvsG?= =?us-ascii?Q?oNrHhD0lSC+uMmUjh1qQS8shZackS2Sd9K/4lxCReRUpVWy7MZ7UlZU5Byqe?= =?us-ascii?Q?zP89Yq+qVH9KAxqK1cEVgzZbmoMhtRChi+FLTTBEYlyndgRZHK2YfArkFBy+?= =?us-ascii?Q?ZSTOapqr1Umi49lrt0O5gxch0UFqiCXBySY8R1cg8N05bm5XTDHEhGgjYx/r?= =?us-ascii?Q?6kN8HoccTUR6S9fWgJBzMtP+Bbeajy8ljWi52Rrhvj8qO63eRDv70STRSoPj?= =?us-ascii?Q?ydx3XIusr3x5ykUIFlNUWz/9wy92afUumlHQQmiyooQQefG8NDe5Wjda7sJZ?= =?us-ascii?Q?hxV0aCnQxIwyu+KQ//6Pw7h4zhcyX8KFT3ec/6kWBGYDXnbNmRFPSn8CLs5t?= =?us-ascii?Q?Vauczrif0jLsn5M7cRYK1702gONDXb8Dn2ZJhRxEgfCdz555xkGYyA+VgPA9?= =?us-ascii?Q?eQcyzX5XOijyW4o5B8IbtZwaxM7JT6wXFtOndgtbb6f7Um46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CokZZhHp9u3n/ckRCOoG7MR+jrhVyFJK8HeMnOLBHgdGo?= =?us-ascii?Q?bAdO71RM8m83ECSf/p4drZM2iW2V42xDik3SXv0XWKj8rrPeC9deMZB9L+o9?= =?us-ascii?Q?qq1rkPLEwtKUa0kg+F/aabhSv2+Pmq+ozBUwfPvljrJ6vuHt3fcPCee5NiRS?= =?us-ascii?Q?GOAtMasbm+tlv6ciOcnJ8lvP5Xb4Ly+IUH3b53bF?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fbff7d45-2677-4b30-bcc7-08da79672e1e X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 17:55:29.0267 (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: MQItklN0/FBhiIlAZlEfvBSAvW2taMqc3HeoEoco9ghUulvf/Shy9/wCQj09Fmmw X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB4679 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 08, 2022 at 08:10:22AM +0200, Greg Kroah-Hartman wrote: > On Sun, Aug 07, 2022 at 02:25:33PM +0300, Oded Gabbay wrote: > > 2. Common code to handle drivers that want to allow a single user at a > > time to run open the device char file. > > Note, that's an impossible request, and one that the kernel should never > worry about, so don't even try it. Think about userspace doing an call > to dup() on an open char file descriptor and then passing that off > somewhere else. Oded is talking about a model like VFIO has where the HW has a limited number of concurrent state registers - lets say in this case the ASID translation mapping the accelerator into DMA. Each 'struct file' that is created owns one of those HW state registers, and each struct file is completely isolated from all others. eg someone controlling the accelerator through struct file A cannot access memory mapped into the accelerator through struct file B. So, the number of struct files that can be created is capped at the number of HW state registers the device can support (eg one for Habana). This is different from the number of FDs pointing at the struct file. Userpsace can open a HW state and point a lot of FDs at it, that is userspace's problem. From a kernel view they all share one struct file and thus one HW state. Jason