Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5583670rwb; Mon, 8 Aug 2022 23:52:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5HLvicY0pD3acH1h8+OM1j3I4YmdXBOT3Sr4wDVUSX4eSoy6RxPZHwVro3+qQysLZkbK+S X-Received: by 2002:a05:6402:14da:b0:441:cff1:1b88 with SMTP id f26-20020a05640214da00b00441cff11b88mr325171edx.359.1660027953114; Mon, 08 Aug 2022 23:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660027953; cv=none; d=google.com; s=arc-20160816; b=xCgk85vXi4Zh4lVGbnjJC7hemv0Bye8ht4pHoVHhPZObuPTTKomrVJZv3hqu3ZJl41 WJ2qXiX4HlE9HgCWLgLEXdvpVbfPW5QHXoJ1unZu3YUX9q3GgBvVcE21QzZSEXBzvjGD AMfuPZroDKcsZijY19SeRyHAWwHVoFuy7W5KZ8KdfHwiIRAripQaMIv6r2NMgQfi9l2B cPBrXBtisC6hHMjt03GzNMFEvdMQsPJnaiNFgHFNUmWGpy/j3diofbG+Qml+ukk4sOUE bSOebsUUhzseXruJbQwIhpnjQr1OsvhdAYRnMyl22tJdIc1ssVdAo5GsbHtbZZGC7vP9 bk3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=d1FgskL62TI+rVw5FxcF/OXjISbEkUYUl/AXeCBKOAQ=; b=ZbNuNDcL0PqToiD+0rwJdk2jiPwrNY9+8vb0xxQRRTfR8Uv8f5OtMxmSyD0JvUPXbC TOHuZmdWBO2t19bPCvXpSLf+2Yb/hvWi51n3twwLmCeDQy6tVEndvDFqMc0HbloONgFj M9HwptS7um0nraSuS4P9PzUXme2rmDxhxawZLt/kSJFf4rn8lRNulOr07pYIYCmc7YpV 7nD+m1ABlDUCGR6MdQjzLJ4jIvLprr8wjDpQD8sWlcp+0Wq6W3Ooz9TiMoJn0YdJy1g8 3Afkh8nlwVWTTZWj9HGUzxqNvOtZtzTYq/xGYqfOfmhtSSRZd0M5Jml8ysT4AGTu1T6Y oh0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BEztx697; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs16-20020a170906dc9000b007306dbac8c6si1485685ejc.28.2022.08.08.23.52.07; Mon, 08 Aug 2022 23:52:33 -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=@linuxfoundation.org header.s=korg header.b=BEztx697; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236979AbiHIGXi (ORCPT + 99 others); Tue, 9 Aug 2022 02:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237021AbiHIGXf (ORCPT ); Tue, 9 Aug 2022 02:23:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 959911FCFC for ; Mon, 8 Aug 2022 23:23:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2A2D2B811B8 for ; Tue, 9 Aug 2022 06:23:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20A67C4347C; Tue, 9 Aug 2022 06:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660026211; bh=r4gBsXWejMioOyU9kv7AqoaLFSBmsdp3u4zoSc5meJs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BEztx697rcbEZiFXoACdMEbb6LbyomvNJOqu1DzKUk8Z2VMo6BYyenk6YGf4f2yLi sjubCbTVpCuZsqzIVGbVvvcNhSh6DC5u1bQg6a/D6/HSPpnCIjQsyl4PVisfcuD0r6 vy+nmLXW/3zlz8yODEdV/0oKdPA+Ya0LRx+64b5w= Date: Tue, 9 Aug 2022 08:23:27 +0200 From: Greg Kroah-Hartman To: Jason Gunthorpe 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: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Mon, Aug 08, 2022 at 02:55:28PM -0300, Jason Gunthorpe wrote: > 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. Based on the number of drivers that I see submitted weekly that try to restrict their open call to just one user by using atomic variables or other tricks, I think my interpretation of this stands :) > 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. Yes, that's fine, if that is what is happening here, I have no objection. greg k-h