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=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 3719BC433B4 for ; Fri, 9 Apr 2021 13:40:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D0328610D1 for ; Fri, 9 Apr 2021 13:40:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0328610D1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6D4C86B0071; Fri, 9 Apr 2021 09:40:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65D0E6B0072; Fri, 9 Apr 2021 09:40:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4894A6B0073; Fri, 9 Apr 2021 09:40:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 2857D6B0071 for ; Fri, 9 Apr 2021 09:40:08 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C98CB8248047 for ; Fri, 9 Apr 2021 13:40:07 +0000 (UTC) X-FDA: 78012937254.33.DC2670A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 1D4AFE0001AC for ; Fri, 9 Apr 2021 13:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617975606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lsrzJwlfstULCCREnSPVP3WRVuSyvEw5HXvTFd2r4do=; b=OMtcyd0Ey8henN7DdHOa64TG6+RcQ3yQtd9qJqu4fIbwhvuSElxbzysNjju/dUo5Tg7ydo MlYxJSNpyADshpWO3/0QogVaZ3JdMf3ol84JxmiAetnJVVMvG4GV3wa3TtZ+fewuLtpPJ5 jJArafTsuWFRRzZd2bJyiA+Iiq6zuQ4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-143-3MzYaf2pNUSmKJKsGUehFg-1; Fri, 09 Apr 2021 09:40:02 -0400 X-MC-Unique: 3MzYaf2pNUSmKJKsGUehFg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB324C73AD; Fri, 9 Apr 2021 13:39:57 +0000 (UTC) Received: from [10.36.115.11] (ovpn-115-11.ams2.redhat.com [10.36.115.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id E60C619801; Fri, 9 Apr 2021 13:39:48 +0000 (UTC) Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: Arnd Bergmann 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" References: <20210409112035.27221-1-david@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <53ec94ac-ffe3-d0bc-d081-3489fa03daa1@redhat.com> Date: Fri, 9 Apr 2021 15:39:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1D4AFE0001AC X-Stat-Signature: b1ijk5g4dpi6odcp8rtd4kdkr9z74e6o Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617975605-574144 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 09.04.21 15:35, Arnd Bergmann wrote: > 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. > I was also unsure - and Lucas had similar thoughts. If you want, I can send a v4 also taking care of this. Thanks! > Regardless of this, > > Reviewed-by: Arnd Bergmann > -- Thanks, David / dhildenb