Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2024509rwb; Mon, 7 Nov 2022 08:18:54 -0800 (PST) X-Google-Smtp-Source: AMsMyM5JW5NrQK8oXSIqaNoOcVFOSmmbSc5G/5hbc40l04U871xS/ena85NlcbyFZHS2niS6PKf7 X-Received: by 2002:a17:90a:b011:b0:213:473e:6fe1 with SMTP id x17-20020a17090ab01100b00213473e6fe1mr52755431pjq.229.1667837934193; Mon, 07 Nov 2022 08:18:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667837934; cv=none; d=google.com; s=arc-20160816; b=pDgbrxC/1OexuIOQU4vh8cP2jVw2tGt/Y82TAc6ztHnBAJuKErGb1AqdhrxV8HNzU/ CkNLbLkIpc85mI50BR+0BJbutlbxsWL3WM+Ryc/i3BsBY9R+KU62k9HbugXxCD6gufpF vLbjRK9bGvt6LplzQIwG420h8zRSP0wEWKPAIBnQ6Texm4HRIIpS+boXj5UMmoH1BVZP PwtMPzta+pUaEli2GuhxcLKcIcFxA/xnwbFm17PqYBjdHP1iFGfyjuug6Gd0PxwpECJr XUUVDW/sYIxJRfpmYmIBWOfy/Zq+zVWOCkw1/uNuCnCBpvXCz7PYhQ/72zTfwGLg4i3r Wbdg== 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:dkim-signature; bh=Du4ly8cNdD6kjhACACFPcG0D53BO1orBmWkVY19SAC8=; b=CcbpA1g6hPiHLGwCnLoJdcPFFEt0bhs7qC0GzBrTWfYpma/ySEOZD8NOo9nMKrelaA mnANx3qYF8erMFlYkEmYNG09Lnz4q13zBK16XrHuLSSyq38YKym/HShZwhkNVF0NlFfI VAJecLHnQiKbnP43Hx6Ul6WwjZBRhh5VneltDyVzoulH/aZjpDPfFwAJGPE2szuCv4oG aXw73nAZ5ZE1cs1wnbZekOsOAodKD4dxGG+FavwzrTiP0CTpVyDV8bjWy1M0jon+buYi 02JQo06ZC7YhXEXJqmanreJPT8ql4Kxbp/9IlJYfS3Hkha2YMwMeO/AfoP+dXxMEgunZ nRBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="jSPZaL/q"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e125-20020a636983000000b0047077aa5008si4769102pgc.578.2022.11.07.08.18.41; Mon, 07 Nov 2022 08:18:54 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="jSPZaL/q"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbiKGPyZ (ORCPT + 92 others); Mon, 7 Nov 2022 10:54:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231539AbiKGPyY (ORCPT ); Mon, 7 Nov 2022 10:54:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F21AB39B for ; Mon, 7 Nov 2022 07:54:23 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 8F93560EBB for ; Mon, 7 Nov 2022 15:54:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3578C4314D for ; Mon, 7 Nov 2022 15:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667836463; bh=Du4ly8cNdD6kjhACACFPcG0D53BO1orBmWkVY19SAC8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jSPZaL/qYt8lVzFah4sOQFP9Y9mdruk+onCFhiT9URVGSdOSv3knpSF1Tk37S7thp PHHx00VeajRbHY7NBuGNHSDLPqWjOd3GpwzLTCfVtgN776UoUIP+YBwXKiW+jOLv0L tkiSm7J51AL2RDTJrh2EgcatR0blclMSwsAs0jZuM2pVfiZrcl55qddGU7wCgf7J69 cGpiC4oFjOZZiz9G+nXka9UlJtj3d6AXPM48wwU7/MRegtBEMfqvAA3+dq4Usy28yo DSqV6wZWp2w121L1Ju/KiEsaua4pukpDAoF/DoCI0K+sSSbwqIfv0ewsVpo7Zgu0Kr OUBJbkUw/dZog== Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-36a4b86a0abso108356237b3.7 for ; Mon, 07 Nov 2022 07:54:22 -0800 (PST) X-Gm-Message-State: ACrzQf0/XNn0qnjcZgGS8UUjw2J/+W+FDtIeOTm/0xHwwCflaAy6SVHw fH0QC6Tn6j0VhaPaLEKaWa5Mg4Rh7d2fHVEvg7g= X-Received: by 2002:a05:690c:825:b0:36a:b160:21b with SMTP id by5-20020a05690c082500b0036ab160021bmr48865140ywb.211.1667836461563; Mon, 07 Nov 2022 07:54:21 -0800 (PST) MIME-Version: 1.0 References: <20221102203405.1797491-1-ogabbay@kernel.org> <20221102203405.1797491-2-ogabbay@kernel.org> In-Reply-To: From: Oded Gabbay Date: Mon, 7 Nov 2022 17:53:55 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 1/3] drivers/accel: define kconfig and register a new major To: Jason Gunthorpe Cc: Greg Kroah-Hartman , David Airlie , Daniel Vetter , Arnd Bergmann , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, John Hubbard , Alex Deucher , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Yuji Ishikawa , Jiho Chu , Daniel Stone , Tvrtko Ursulin , Jeffrey Hugo , Christoph Hellwig , Kevin Hilman , Jagan Teki , Jacek Lawrynowicz , Maciej Kwapulinski , stanislaw.gruszka@intel.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 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 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, Nov 7, 2022 at 4:10 PM Jason Gunthorpe wrote: > > On Mon, Nov 07, 2022 at 04:02:01PM +0200, Oded Gabbay wrote: > > On Mon, Nov 7, 2022 at 3:10 PM Jason Gunthorpe wrote: > > > > > > On Mon, Nov 07, 2022 at 03:01:08PM +0200, Oded Gabbay wrote: > > > > I don't agree with your statement that it should be "a layer over top of DRM". > > > > Anything on top of DRM is a device driver. > > > > Accel is not a device driver, it is a new type of drm minor / drm driver. > > > > > > Yeah, I still think this is not the right way, you are getting almost > > > nothing from DRM and making everything more complicated in the > > > process. > > > > > > > The only alternative imo to that is to abandon the idea of reusing > > > > drm, and just make an independant accel core code. > > > > > > Not quite really, layer it properly and librarize parts of DRM into > > > things accel can re-use so they are not intimately tied to the DRM > > > struct device notion. > > > > > > IMHO this is much better, because accel has very little need of DRM to > > > manage a struct device/cdev in the first place. > > > > > > Jason > > I'm not following. How can an accel device be a new type of drm_minor, > > if it doesn't have access to all its functions and members ? > > "drm_minor" is not necessary anymore. Strictly managing minor numbers > lost its value years ago when /dev/ was reorganized. Just use > dynamic minors fully. drm minor is not just about handling minor numbers. It contains the entire code to manage devices that register with drm framework (e.g. supply callbacks to file operations), manage their lifecycle, resources (e.g. automatic free of resources on release), sysfs, debugfs, etc. To take all of that out of drm.ko and make it a separate kernel module is a big change, which I don't know if the drm people even want me to do. > > > How will accel device leverage, for example, the GEM code without > > being a drm_minor ? > > Split GEM into a library so it doesn't require that. I don't see the advantage of doing that over defining accel as a new type of drm minor. > > > Librarizing parts of DRM sounds nice in theory but the reality is that > > everything there is interconnected, all the structures are > > interdependent. > > Yes, the kernel is full of stuff that needs improving. Let's not take > shortcuts. It's not about shortcuts. It's about a different way to solve this issue which I don't think is anyway hacky or inappropriate. > > > I would have to re-write the entire DRM library to make such a thing > > work. I don't think this was the intention. > > Not necessarily you, whoever someday needs GEM would have to do some > work. > > > The current design makes the accel device an integral part of drm, > > with very minimal code duplication and without re-writing DRM. > > And it smells bad, you can't even make it into a proper module. Who > knows what other problems will come. I would argue that if accel is part of drm, it doesn't have to be a proper module. I don't see that as a hard requirement. Oded > > Jason