Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5669398rwb; Tue, 9 Aug 2022 01:56:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ZNEaXzTrSIAHB/XQT1QTvaRuwHltWtNDNdjhvdlFvi+DSCI2GMguCxch3+sCuWyHB/YyX X-Received: by 2002:a05:6402:f17:b0:43e:4700:f63e with SMTP id i23-20020a0564020f1700b0043e4700f63emr20876407eda.190.1660035381754; Tue, 09 Aug 2022 01:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660035381; cv=none; d=google.com; s=arc-20160816; b=T/2MBFi95EBKYWinzii3JVz9Z1VWwfU9qUO3c/ImyGotddDNd5F7yBExluvDgg579E MZAS4MEQzVAGEqZqsMkDQImrgH8dpAAhYR6N3x6yDKCMXcdlr+B7GBoaApe4Mu2Tinfb vjombXM0ZROC7h4p6Na8sTPi1SUrQwO3eLZTqtcu8cnPnvCZG9QdYjtx2EWjS2dQllPb j8n+/u867I7RIkDvsr1WalY47yoNDdMfpzCArNecX7KMh1GD/oSgP4bx/nEUVP7o4kDO UP3XL9NnDe/f5FKPPA/yEfbCXLgPs59yWPUDQMV4USNiG8a/WsdzOWhWUtMIZKuoLAUD BJiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=EV9ZsngUmLSRRA6b9AWUm/e9SoV7Hr+9LHqOscNyr6w=; b=QJxNmFxRrarVcMaFnA4B9o9HxZuVwH25xRbvtdHLRLYuv2ludpThKWd8dUbzzKerhh mvRxoC8L9LyEenbngajJM5h+OpqTGCvo7Ajm0Iz4BBB8AkxljdsrDep43y57Joiz8TRg dhmDkv1nmHME75WW9mBzZ6D23DAPhYmmZXAx+T4r37RDQ4QP5iAZReOwL9QxGWLlhrhN q38qqSruR6AAQHLtdgRrkgVBjGcw3NgtUurVqYu2txuVgEaR37/bfs817DCYTsn+edju +cYgpsR2IC5Oi/gNwFHmvmxiv+AhN9WGfPgUkK8sfktedvQeGrUEK65RxF0noTc+LaNe FDlg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r2-20020a170906a20200b007277dd43476si1422107ejy.347.2022.08.09.01.55.55; Tue, 09 Aug 2022 01:56:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238096AbiHIIcs (ORCPT + 99 others); Tue, 9 Aug 2022 04:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236481AbiHIIcr (ORCPT ); Tue, 9 Aug 2022 04:32:47 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF6F1F619 for ; Tue, 9 Aug 2022 01:32:45 -0700 (PDT) Received: from mail-ej1-f43.google.com ([209.85.218.43]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MhClw-1nhIp41hvW-00eLLm for ; Tue, 09 Aug 2022 10:32:44 +0200 Received: by mail-ej1-f43.google.com with SMTP id dc19so20876909ejb.12 for ; Tue, 09 Aug 2022 01:32:44 -0700 (PDT) X-Gm-Message-State: ACgBeo0SUdbBO4Dx5cLdbJed7Ph9yRC7icTRVU6HyDFyCXruhFTTwM/U VE6wEbCOkJfvXtHmDoDSGU7HKBjaPAEQZuhhL3Q= X-Received: by 2002:a17:907:7395:b0:730:b636:2c89 with SMTP id er21-20020a170907739500b00730b6362c89mr16431662ejc.547.1660033964094; Tue, 09 Aug 2022 01:32:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Tue, 9 Aug 2022 10:32:27 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: New subsystem for acceleration devices To: Christoph Hellwig Cc: Greg Kroah-Hartman , Jason Gunthorpe , Oded Gabbay , Dave Airlie , dri-devel , Yuji Ishikawa , Jiho Chu , Arnd Bergmann , "Linux-Kernel@Vger. Kernel. Org" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:5E5bCciRIBKhYs8DONl/B/spZHbKI7r800+vqWgPu43CFVIOFTu m2StS3+sqLXuHOo9PcuJi0uizp1xuIpFG6dXqa+rvxrDTcbOG/AEwhAXp88JqQZJjNj9cPJ tzkRCQwdinppWbVwxCnUmCDiK+VcoDrrm6IyOYtVkQHW2BS03N5ddpARgSMgyJFJ23G1979 RT82PSVuQm1sorbhri/4w== X-UI-Out-Filterresults: notjunk:1;V03:K0:IUbD/5MRfm0=:wORYGYWlIPTD4JBHNA62p+ 3os6aBT/RUwOOX/Z/Cw4P0+W8uGghbFBflZDNfEPPuUuRNhjKAbmidj85wPGOElfvXYBBSRHP cwZ5e2zaX2NiWltTR7fr5VJPXeXfyl2GNZQWmITZIR4yfcF/D4DNyAhRbwRpnbRQkkyEmeWSR Na5gpN7JO0SPG+z2gFwLtClkLcKw3CuTWFyKos354aJ2NJ/bdYXh4x0dqkbH56uJm1+13IE7R qWKtcuTQzvH7YwXi+9a9QjIKUkE1pCuEgOOaHz8MXeBvLIKFI8Ic+EjTwbSgClD5Zr2FXs16d 5Yuib6Ce2gPPGsFWEQDOF03A/6iU9kP2g+2142TUy0HBl+NTH3lD1JMDYZYY61rIrSIydNClV wXTwwSiPyoTeyLOEjzBPJz3wlpkwHp8z821FGBPmA0gVvHYG9bcZ0v2vwOSnIzmZ953mnC3Ae hoGb44NuJZmQ676y6ZZODnxwj/93555iAsP6aR9/4ovGAAmjfKJb7OaFOLYu6KSpc0Dkbf+nK dWGbj5JrxKSimhWh40bHBekG8mIZXAJhe95Raw/J/mdEy45hdntpuBqXlUniOQgk8k5t1T2Ot dzqGW+LtbaW9Oq0OjBdZaD8KZCXnPK5UXriiIrnTvfLi8rkN6HcJF6uavJ7Nfbv3+xpsZzjvE PIrJ1e+i/5luDUZ2gKXtScXSzQjyQ1tT+rePW4N13p8YN6Q9sVEMNl4SS9LsXj/TRgoddudyr wk5SH2HdSM849NVt5Yqd5yOoqBTXdwOVBABr/r6xxn1HuiHYYf9f8/UtfAw/iMmBcybChwLEa hrxbkpV80wJZMu+eR84cHFHmBPCFZ9992mAYvsOM6jTE1CBjd83k/qodj1V7mWKLm2X7pgxtt CN6Ahd7uQOvptwHNvYtQ== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Tue, Aug 9, 2022 at 10:04 AM Christoph Hellwig wrote: > On Tue, Aug 09, 2022 at 08:23:27AM +0200, Greg Kroah-Hartman wrote: > > > 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. > > > > Yes, that's fine, if that is what is happening here, I have no > > objection. > > It would be great if we could actually life that into a common > layer (chardev or vfs) given just how common this, and drivers tend > to get it wrong, do it suboptimal so often. Totally agreed. I think for devices with hardware MMU contexts you actually want to bind the context to a 'mm_struct', and then ensure that the context is only ever used from a process that shares this mm_struct, regardless of who else has access to the same file or inode. We did this in a somewhat hacky way in spufs a long time ago, and I would expect this to be solved more cleanly in drivers/gpu/drm, but I don't know where to look for that code. Arnd