Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1718874rwb; Mon, 7 Nov 2022 05:07:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf4wcVuk8EP2foOrCsKtCj8KHDRdTwNwTldVIf5OdidAKgBNV6SSoMqlnftM7wPEKONutuy4 X-Received: by 2002:a17:906:db03:b0:741:337e:3600 with SMTP id xj3-20020a170906db0300b00741337e3600mr5584750ejb.343.1667826460020; Mon, 07 Nov 2022 05:07:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667826460; cv=none; d=google.com; s=arc-20160816; b=zNimBpLXiGMswiyi9fQaEeA+O7l1Z0e53LFQ/QcNIl151qUwmEGXZtTJ//8rWAgW+8 K0cJL0oQOxxjCE1RHF0VBfHAkAyKBKYK2s3Ku5fDcfM/kaQLXuvCAMfDnSAqyUPa9O2e IRPpwfU27Tu2J5nTmz+zDwMpo2q07hx/cx9kj9E9R+uwk23DcOF4YVlfK0P3LEOqBUMI ItAUfsH/nOhjwyNYFtXneBAW9ExEpb2+iDYYmhrdQgUQRxfRQWKwrMZEi5ANBuZy/jsC jcEWD+9JNKdS5fJeBxN0kb0cLFY9sfbB8SsPALTreLnRukObDM8AtUwgC9sQEMByizQo 8zkw== 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=tBURuUQhZxraq5MvajOMBDEZInTueelg6ampSgs223M=; b=zZ0thQImkMEd51FPHQRT5oJrudEERXJPyV2GZri+1IOiBrBEp4fxUdw0LV+EpFICQi pes8XGjx4letOb2oTPUWTZXVw0Q/8PqA568JBBW8FvOZxmWvo3rUNXcyZ0cPwYv3Yh4Y kna47hnKAZMR2wNDqElnlUk0+POUK0/RQwRLqZJZGHD/jaaJxS9gMjfsXKFzafzMP4Sr OtDFqut1T4vq9WttqrtQ2NOLPUUcgFva71Ksjo3IQz7MYEuYO06zrY2gZM7nEeo6FMj/ mdXQJqmRt3t2tGr7DQFV9C9Kjec+GukC1d/14iDZ0zPprzs1tmZg/ctIsWUVOMPPhY1f rIpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="SVxy/PgM"; 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 h20-20020aa7de14000000b0046314dd20a0si9376644edv.3.2022.11.07.05.07.15; Mon, 07 Nov 2022 05:07:40 -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="SVxy/PgM"; 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 S231520AbiKGNBm (ORCPT + 94 others); Mon, 7 Nov 2022 08:01:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231842AbiKGNBh (ORCPT ); Mon, 7 Nov 2022 08:01:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD9981C411 for ; Mon, 7 Nov 2022 05:01:36 -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 7AA7160F74 for ; Mon, 7 Nov 2022 13:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7370C4314B for ; Mon, 7 Nov 2022 13:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667826095; bh=lUkKGeRcTh9+9SDsnCQSKtY+GaKD9H0OWbszG978hiQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SVxy/PgMR6ttMpoY8TuKjEl1F7Wh/dW3/1R3mvAXjSle9/pwK7CWgZceEEIYkjtng uIFAd6OjoNOZXyFCbG1NTYQ3fjv46lrHoHYCISQTLs9vFcuepGn4dfCYomhxq8FgJZ KZFSbY33tPPTHNQhRse2bB7mhWup1TXgd9/DiOxnewHpUw+cFnQKFhulgiOBPANSO6 b/RgpA3v+YeiGog7fVcwOsStRl5CUC4ojMEHprUDnbdDvGGQFfRIoAWtXqJhhGOM8U BBegn3HBid0jGqa7QiV/13jFUJ5Mm+5MKsOXtmma1igJtUn9Sfev2hVWz26Q9Txopl IAzRe/hUQ+BAg== Received: by mail-yb1-f182.google.com with SMTP id 131so9092545ybl.3 for ; Mon, 07 Nov 2022 05:01:35 -0800 (PST) X-Gm-Message-State: ACrzQf2bGD6XP8W7fa9Vzczl/RqXjkZY4jRhrrgBDVSw8MqkwzVlR3PY IzWijuqN/oXvPnNK/J/oxNgXFZzflh1Q7f6FUpo= X-Received: by 2002:a25:1e89:0:b0:6bf:9e55:5cb4 with SMTP id e131-20020a251e89000000b006bf9e555cb4mr49430658ybe.642.1667826094690; Mon, 07 Nov 2022 05:01:34 -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 15:01:08 +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 2:56 PM Jason Gunthorpe wrote: > > On Thu, Nov 03, 2022 at 10:39:36PM +0200, Oded Gabbay wrote: > > On Thu, Nov 3, 2022 at 3:31 PM Oded Gabbay wrote: > > > > > > On Thu, Nov 3, 2022 at 2:31 AM Greg Kroah-Hartman > > > wrote: > > > > > > > > On Wed, Nov 02, 2022 at 10:34:03PM +0200, Oded Gabbay wrote: > > > > > --- /dev/null > > > > > +++ b/drivers/accel/Kconfig > > > > > @@ -0,0 +1,24 @@ > > > > > +# SPDX-License-Identifier: GPL-2.0-only > > > > > +# > > > > > +# Compute Acceleration device configuration > > > > > +# > > > > > +# This framework provides support for compute acceleration devices, such > > > > > +# as, but not limited to, Machine-Learning and Deep-Learning acceleration > > > > > +# devices > > > > > +# > > > > > +menuconfig ACCEL > > > > > + tristate "Compute Acceleration Framework" > > > > > + depends on DRM > > > > > + help > > > > > + Framework for device drivers of compute acceleration devices, such > > > > > + as, but not limited to, Machine-Learning and Deep-Learning > > > > > + acceleration devices. > > > > > + If you say Y here, you need to select the module that's right for > > > > > + your acceleration device from the list below. > > > > > + This framework is integrated with the DRM subsystem as compute > > > > > + accelerators and GPUs share a lot in common and can use almost the > > > > > + same infrastructure code. > > > > > + Having said that, acceleration devices will have a different > > > > > + major number than GPUs, and will be exposed to user-space using > > > > > + different device files, called accel/accel* (in /dev, sysfs > > > > > + and debugfs) > > > > > > > > Module name if "M" is chosen? > > > Will add > > So, unfortunately, the path of doing accel as a kernel module won't > > work cleanly (Thanks stanislaw for pointing this out to me). > > The reason is the circular dependency between drm and accel. drm calls > > accel exported symbols during init and when devices are registering > > (all the minor handling), and accel calls drm exported symbols because > > I don't want to duplicate the entire drm core code. > > I really don't think this is the right way to integrate with > DRM. Accel should be a layer over top of DRM, not have these wakky > co-dependencies. > > The fact you are running into stuff like this already smells really > bad. > > Jason 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. Please look at v3 of the patch-set. There I abandoned the idea of having accel as a separate module and instead it is part of drm.ko, as it should be because it is just a new drm minor. The only alternative imo to that is to abandon the idea of reusing drm, and just make an independant accel core code. Oded