From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63AD8C43470 for ; Fri, 9 Apr 2021 13:35:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E080261178 for ; Fri, 9 Apr 2021 13:35:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E080261178 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 665E66B006E; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63BC66B0070; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B8266B0071; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 2AAB66B006E for ; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D52993624 for ; Fri, 9 Apr 2021 13:35:23 +0000 (UTC) X-FDA: 78012925326.31.A3DCAC0 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by imf24.hostedemail.com (Postfix) with ESMTP id A1BDEA000143 for ; Fri, 9 Apr 2021 13:35:18 +0000 (UTC) Received: from mail-ot1-f47.google.com ([209.85.210.47]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MiIhU-1m1Qx50gC6-00fUWR for ; Fri, 09 Apr 2021 15:35:21 +0200 Received: by mail-ot1-f47.google.com with SMTP id t23-20020a0568301e37b02901b65ab30024so5697345otr.4 for ; Fri, 09 Apr 2021 06:35:20 -0700 (PDT) X-Gm-Message-State: AOAM530Av2utdRVV73uVBJanBaBNN+/Oe+hKqv60m17/1oW21Kmxa5E6 eDf5415qSybhqN/VwHl4l9SKcafrH05gqV9alXo= X-Google-Smtp-Source: ABdhPJynlbx4kLNikSNjAjnCb5vtFq6G/850R+R5+xWMARHqWLy+tfY7F0Z+Hrp7Hz4KWDmPvvGBCrUcX4hM8LkZWnk= X-Received: by 2002:a9d:758b:: with SMTP id s11mr12240759otk.305.1617975319390; Fri, 09 Apr 2021 06:35:19 -0700 (PDT) MIME-Version: 1.0 References: <20210409112035.27221-1-david@redhat.com> In-Reply-To: <20210409112035.27221-1-david@redhat.com> From: Arnd Bergmann Date: Fri, 9 Apr 2021 15:35:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: David Hildenbrand Cc: Linux Kernel Mailing List , Linux-MM , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Joel Stanley , Andrew Jeffery , Lucas Stach , Russell King , Christian Gmeiner , Paul Cercueil , Linus Walleij , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Andrew Morton , Mike Rapoport , Bartlomiej Zolnierkiewicz , Eric Anholt , Michal Simek , Masahiro Yamada , "Alexander A. Klimov" , Peter Collingbourne , Suman Anna , Jason Gunthorpe , dri-devel , linux-aspeed , Linux ARM , The etnaviv authors , "open list:BROADCOM NVRAM DRIVER" , Linux Fbdev development list , "open list:IOMMU DRIVERS" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:zujcCUeU99yOgref8KSZibKzyqmwS4vOm3sFA3lyFKPx+qLuQpq RvkN5wXWMh+NGdg0XNcVZO1chJZ/FX1UuN0MdjDuSBiL+QoNtPez1kL7VfiIcnuJNhZNjgq IOeB27VJaxESYa/WURKi61D+NbWq0Zisd3V25gsaI3aJQENAgu1NHNt4vBGFpXoxIE4yyqt lT+ymra6c/Hh+CrKNs6IA== X-UI-Out-Filterresults: notjunk:1;V03:K0:UXvXZCDfB50=:gisZ5GoVEMqzulKEQvarVN A2pR803JBwVs6W+mRtzKW09xj0u71D7prlmiuTzm/OQPX/khp6YJvpcJlEgDaYIllkxiX+Cd1 XRJLfODM56czgHwlX+hlU9w+YidCUAf1MIaID4cfiktiksp0/3/O9XEoaZjY52Z2xdj8Lcn8r kN8n+qPoryiiUJwDuhYV9yFzbzb9HCUwGrtDPLVRQLH7PWgVnf3jog1yPFLd8J0X73k8ktEP/ XH27Nrn2qDRX6pWtaM/yp2tHmXV0zXDcof7Z2+T2yWF/SGRfQTokM9jLmzNr/dSOXZ9rj42vs WRgQdPkZsPgPF4Ohx2AmpSShCRbvBL+LzOCFH6vsMz4057EYIUj5AOUYAMG9cWnSboNYl6661 nKqn4SABR9+tHyXgVmH4bqpGEiNDYrD7iFOxy7FH7nc3vA6Gk2vD7z8/aJs7if6SwLnMgrDrN iwn2kSHn3O5AcBnLXnKI0ZeBBjGZeko= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A1BDEA000143 X-Stat-Signature: shpx6j43g6bo86b7t75kdtxeyce9rh5s Received-SPF: none (arndb.de>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mout.kundenserver.de; client-ip=212.227.17.24 X-HE-DKIM-Result: none/none X-HE-Tag: 1617975318-551671 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Apr 9, 2021 at 1:21 PM David Hildenbrand wrote: > > Random drivers should not override a user configuration of core knobs > (e.g., CONFIG_DMA_CMA=n). Applicable drivers would like to use DMA_CMA, > which depends on CMA, if possible; however, these drivers also have to > tolerate if DMA_CMA is not available/functioning, for example, if no CMA > area for DMA_CMA use has been setup via "cma=X". In the worst case, the > driver cannot do it's job properly in some configurations. > > For example, commit 63f5677544b3 ("drm/etnaviv: select CMA and DMA_CMA if > available") documents > While this is no build dependency, etnaviv will only work correctly > on most systems if CMA and DMA_CMA are enabled. Select both options > if available to avoid users ending up with a non-working GPU due to > a lacking kernel config. > So etnaviv really wants to have DMA_CMA, however, can deal with some cases > where it is not available. > > Let's introduce WANT_DMA_CMA and use it in most cases where drivers > select CMA/DMA_CMA, or depend on DMA_CMA (in a wrong way via CMA because > of recursive dependency issues). > > We'll assume that any driver that selects DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER would like to use DMA_CMA if possible. > > With this change, distributions can disable CONFIG_CMA or > CONFIG_DMA_CMA, without it silently getting enabled again by random > drivers. Also, we'll now automatically try to enabled both, CONFIG_CMA > and CONFIG_DMA_CMA if they are unspecified and any driver is around that > selects WANT_DMA_CMA -- also implicitly via DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER. > > For example, if any driver selects WANT_DMA_CMA and we do a > "make olddefconfig": > > 1. With "# CONFIG_CMA is not set" and no specification of > "CONFIG_DMA_CMA" > > -> CONFIG_DMA_CMA won't be part of .config > > 2. With no specification of CONFIG_CMA or CONFIG_DMA_CMA > > Contiguous Memory Allocator (CMA) [Y/n/?] (NEW) > DMA Contiguous Memory Allocator (DMA_CMA) [Y/n/?] (NEW) > > 3. With "# CONFIG_CMA is not set" and "# CONFIG_DMA_CMA is not set" > > -> CONFIG_DMA_CMA will be removed from .config > > Note: drivers/remoteproc seems to be special; commit c51e882cd711 > ("remoteproc/davinci: Update Kconfig to depend on DMA_CMA") explains that > there is a real dependency to DMA_CMA for it to work; leave that dependency > in place and don't convert it to a soft dependency. I don't think this dependency is fundamentally different from the others, though davinci machines tend to have less memory than a lot of the other machines, so it's more likely to fail without CMA. Regardless of this, Reviewed-by: Arnd Bergmann