Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1109713rwb; Thu, 4 Aug 2022 17:42:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6fh1JpZefAK3IL2z6EJZzLFQxicCXMd1tyBf5bDJJ7qr3aZLSKpE3Kb7JkXH7zrkYoJ5II X-Received: by 2002:a17:906:5d0d:b0:72f:4782:2219 with SMTP id g13-20020a1709065d0d00b0072f47822219mr3357855ejt.498.1659660149001; Thu, 04 Aug 2022 17:42:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1659660148; cv=pass; d=google.com; s=arc-20160816; b=NrFNzJ5CsSGu2rRvi7aGkBG0x8zn7b1Nq+e+19yVcsKQQdsIQqSYlmD6O5UMR4rbEz WmBiprRTJmpHmx8o37zxkI9wct8/ZtF8CrVQ6d0V2T3JI0kKeFjiXUXxyDYnMlXOClAj fidGSgarjhPkeftzRp4U8Cb41J57otnyXZqvvcW0C7jCI22A8QzzsCTnKfhRn577wM5W vIgoiWCH2XW04fJ2Zpl9r6eihiVFe728KGafnT0wsxcHujpyMs8joWkPeL5P/mPsk4UD LDlVecjENJ+Th6yCPnwBhUKN+Pzs3jT66P88S37Tf2JaPRn1Y14FgT5FrhPIRtA2wFXt tb2g== 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=dq5bimWXHnSLZtnbCx8CWExJL0yNdhVSji+5a9tBzgk=; b=iDbiRkBrm+5qr0SnDmdr9qXZ3wIvjAIJpfQo4JPhQ9qlRxR8aGdtBLiR+6jC1uTItg RbefW4EsllvuBeMd2ytI5zZar89XAv052tbSOc1YT01z8Jzr14fqzDPbJApX4xV/lxcW 9gINMd4tqP0FaXdvMwuCu/6kqZsTDr0Cvh7a41nDZ7u3jTSpMz2cE5ysvUMb6b88I8Ft ZJXtT6BkV2e8ARjRUBMHL23DYJv69/w1QUS+8XT7r9QUN3B54jOPky239n/XPsy+qAhA q5H7i9vBxiMospTSOwmh1x23wpcpuP7VR4SmL+RWzDh136lgilkIlTzKBoeq5gNjtuG9 nxFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="ik+Ek/pO"; 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 n8-20020a05640205c800b0043d4f544304si3073810edx.342.2022.08.04.17.41.58; Thu, 04 Aug 2022 17:42:28 -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="ik+Ek/pO"; 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 S240056AbiHEAXA (ORCPT + 99 others); Thu, 4 Aug 2022 20:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236642AbiHEAW5 (ORCPT ); Thu, 4 Aug 2022 20:22:57 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2088.outbound.protection.outlook.com [40.107.237.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53DE1C129 for ; Thu, 4 Aug 2022 17:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GfJXO9bWf/Oo8s4RwLgeEDq275r3dt//2YH331enNmvtAENXP5JuSSCzclcdNWS30zng1NBv6P1ExCTdzI7HofdO2K/DkPvmjXab4/D01f4KvvMmBTKKalP9S2KHSUiD2RFZoLjqd/oZIdwGVJmVcxXxIznvj0EJdR3c+tyuINyByc49vHrFYt1j1O1eIXJiImYRCnYkOmIZFwbO/f/MQYB3q505mAaanworJ0fZ60WrtY60H6nzg8rus2ntqryhGMOjMKzg5uJ0xZ9fH47/47dkSZ3k04Acbpx4S+9V0U0j0Ziqijv7UFhqlBixDLiwxJkNIjTS0XfPf7N1EisU8g== 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=dq5bimWXHnSLZtnbCx8CWExJL0yNdhVSji+5a9tBzgk=; b=YujW+xBhocfSJGTZXLtGC17CYkaNO/cuK4+18hs1OV2EJJ4NaOSM+RbMKxS3WCq9MEPhYL71mepEnNgU0cCeGN9rVje1hUaQmH9BEAZV2zH0u075lyegBx/BEj4BeRRnDGkg3wC7hjACEOlAORkb71XbpfAcL7amkpUqBkI402FPqLB8navUZg4v2bwp1wZZJ34XfudDIjeqFmGuMME6pqrh1N30tLyMXWFLB9X8XIDsPZmnYpnJ4K+SeF3oqpJTm4yHSwKEKmUobwNgV1GLuYstYfTjI5JAFE+e7IoMUMUvo6QSr+qbSrkyCvtGR5jkKtp7TSRGUw8Vvncuyg6pTw== 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=dq5bimWXHnSLZtnbCx8CWExJL0yNdhVSji+5a9tBzgk=; b=ik+Ek/pOeAizHkYhvIrxiudhhI4pjOlA6zrwwTXLC5w4MQ7OSoQekTnF2uM2SiMuekXKYtxcca9JuESw2wCST8Z4y37+JuDENwHs4EYLpsdZBUrigceH5gtq3CIGB4FyNcTuFgvcN1YiOMghUw3kMmZCpc4XRYSr+f1Ujv3eOO4Vqi1lgvi+5zLkrSMeX6a+4JzWgfI2sstdIB3toTF48koGQqTge/l9SwBMv9hy8eLSU6D59+eegpQ9Fr2hplxCZHoR9XIBGVleI6sKM0uevTmacbolR1IYjPPWgFB2NYxaZzHmuuvR5pqCvsh3hbuVlt5mIagt4r3LqP+Od4Rakw== 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 BYAPR12MB2984.namprd12.prod.outlook.com (2603:10b6:a03:da::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.14; Fri, 5 Aug 2022 00:22:53 +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.014; Fri, 5 Aug 2022 00:22:46 +0000 Date: Thu, 4 Aug 2022 21:22:45 -0300 From: Jason Gunthorpe To: Oded Gabbay Cc: Dave Airlie , dri-devel , Greg Kroah-Hartman , 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: BLAPR03CA0115.namprd03.prod.outlook.com (2603:10b6:208:32a::30) 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: 634d7023-764a-46e2-79b1-08da76789f3d X-MS-TrafficTypeDiagnostic: BYAPR12MB2984:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Ex0IzZax+xVsG6uegiunWs65osYtlqx1jJJgXqWfXu2GyVTDjDqPVb4hRA8AMrrDXhofg+YO+OGE2uM8tYQR5tK5TBya/+TX3OfSJE0JIiv+8Mko8rDY9d1GwsLN4kXpk4cQYZn80WGMKOq52jDH5UZbbOZTHcySXvuNo3sCe2mcsgEEHdtx+uAharUn9C3J/5SD9huq8FQP6RIXMjlNvx9CWeHxytWiROcrChe/eGXc2wLMmLLfusBhjPXu8sttMHwn4flvqbbhe4LTjL1/5T0vkk6Mo9yJbNLcU78nzvR0kZ0vxL+ySjO5I8LPaKhg0KsrAcpU7GF6gJtkpqxNV1PsxKrR+v3aONJTC/Wmn4E4Kp8xlEJ5zk/si6XPyX3tjbPkxWsFaxcl3GtCAuWuYtdapn/xFRvCurFs7g5DPiIJ2bipQdp/gHIGXZxDUvCj6mhmA3vwc2XgmM/I1CPN5pn/KgkutgmslYLJOqGR7iZ6y8h0CmxxJTvoJ9xVhNG9LIR4Xn3wzJ+8G24Nbv+quwJ6DXXlpt+ioriQSYk/dds7fNWjIrBtlLcScJ/WOsLVkoDsi9C916m2OPgWA5Ve8eK7zy/oTHG0253CUeWKEk3KoTdBkJpsKeHQ6e3o0OunretJthNDaCapWWJO6r1JJe6AeELBN0sDBPV1S+2Mu8riM5R3IkWZdxlmd82FQIk21wD5VGu6DCHzpGKY6I4PSOmKNkCC4rG+0BXsCufk5RZJYcTGzAe46TnBt+NFUx1aRKqv/ZGP1nMqtMFrMzJPvZyjXjs3wI3P2wEH9Nd2mo= 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)(376002)(396003)(346002)(39860400002)(136003)(366004)(66946007)(316002)(8936002)(66476007)(4326008)(8676002)(66556008)(186003)(478600001)(6486002)(86362001)(6512007)(2616005)(38100700002)(54906003)(6916009)(83380400001)(41300700001)(5660300002)(2906002)(36756003)(6506007)(26005)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ehes2N/DVptHE6h4LODgNiFRunGzUy+lyh18yYXcxtoONm045QwPXdn8EH+l?= =?us-ascii?Q?cLItybDSLcQILkBCYPfuAZ2+rIAbPBxoYF9XIl0JWUbo47Lm+YBavyjtaGkf?= =?us-ascii?Q?Dm5kQQZcllfqE79kcL3ugxIoaWXTFG9xF+F7dBTduyfKQlNy0wvJXqOg/Lvy?= =?us-ascii?Q?95kbFfiKp+9NgyHdubteoAC4hj6r6PDTiTXcBcPNjJouEwtgmrpv/HSFpYax?= =?us-ascii?Q?Jc8EIyqvA4ilauhaO8v71mh3OzewQsdn+hv6ZKV2Yuv7ZNsCjY0EzYFCWvAU?= =?us-ascii?Q?sid+h/8iYoN5OQSbw9bma056J979/Y2n4JBl1M3Gz/J5h6D/PpSRseoeHIxz?= =?us-ascii?Q?5nMd3r3PTNSr1Eb+W6Hp1loqrKvG/1Qk5wk/wOEp/EpBcC5yn+qX1/NT7eXG?= =?us-ascii?Q?6MAzKj0wXJncue1hQqB60IstYaXX06Oad4PIOQPhvu++EHzVAJiI63OMg/gf?= =?us-ascii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xpGelvrLi1HCGcAIAncOeevdF?= =?us-ascii?Q?FDqcx1Iq3CSyX64MgN+u6fhqGS7TM3UxVgX9oVUhUSmQat5ZZ49APBF6iupm?= =?us-ascii?Q?z6cXz3Gzv9dS7kScYMA1XMzGVEgI1vohjpdRMZIvTXaqjLP/WuYhc2kn6N+X?= =?us-ascii?Q?n2op3Og27MPptfVAzcmzWRrHEdMz7CNE3wPOn1RHEQgtGl3a380xTuvPRag7?= =?us-ascii?Q?VdTRAoZw4xOvBnEUMHR+7tmqz7LQV9TQbIrktNV9?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 634d7023-764a-46e2-79b1-08da76789f3d X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2022 00:22:46.7511 (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: u0k2saZFq41mOieeBylY592NMA2/OpFI0zVFbvdiMvKVh55NlBCig3s8nJuZr6Uu X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2984 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 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 Thu, Aug 04, 2022 at 08:48:28PM +0300, Oded Gabbay wrote: > > The flip is true of DRM - DRM is pretty general. I bet I could > > implement an RDMA device under DRM - but that doesn't mean it should > > be done. > > > > My biggest concern is that this subsystem not turn into a back door > > for a bunch of abuse of kernel APIs going forward. Though things > > are > > How do you suggest to make sure it won't happen ? Well, if you launch the subsystem then it is your job to make sure it doesn't happen - or endure the complaints :) Accelerators have this nasty tendancy to become co-designed with their SOCs in nasty intricate ways and then there is a desire to punch through all the inconvenient layers to make it go faster. > > better now, we still see this in DRM where expediency or performance > > justifies hacky shortcuts instead of good in-kernel architecture. At > > least DRM has reliable and experienced review these days. > Definitely. DRM has some parts that are really well written. For > example, the whole char device handling with sysfs/debugfs and managed > resources code. Arguably this should all be common code in the driver core/etc - what value is a subsystem adding beyond that besides using it properly? It would be nice to at least identify something that could obviously be common, like some kind of enumeration and metadata kind of stuff (think like ethtool, devlink, rdma tool, nvemctl etc) > I think that it is clear from my previous email what I intended to > provide. A clean, simple framework for devices to register with, get > services for the most basic stuff such as device char handling, > sysfs/debugfs. This should all be trivially done by any driver using the core codes, if you see gaps I'd ask why not improve the core code? > Later on, add more simple stuff such as memory manager > and uapi for memory handling. I guess someone can say all that exists > in drm, but like I said it exists in other subsystems as well. This makes sense to me, all accelerators need a way to set a memory map, but on the other hand we are doing some very nifty stuff in this area with iommufd and it might be very interesting to just have the accelerator driver link to that API instead of building yet another copy of pin_user_pages() code.. Especially with PASID likely becoming part of any accelerator toolkit. > I want to be perfectly honest and say there is nothing special here > for AI. It's actually the opposite, it is a generic framework for > compute only. Think of it as an easier path to upstream if you just > want to do compute acceleration. Maybe in the future it will be more, > but I can't predict the future. I can't either, and to be clear I'm only questioning the merit of a "subsystem" eg with a struct class, rigerous uAPI, etc. The idea that these kinds of accel drivers deserve specialized review makes sense to me, even if they remain as unorganized char devices. Just understand that is what you are signing up for :) Jason