Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1689043pxj; Wed, 19 May 2021 11:31:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaewIe2Ob6i9BT+nYZNp2rjwv7u4e7535HlKd3IDZ1O7ZDFCyS3TDfNCzzQEcQvJwXgCO+ X-Received: by 2002:a5d:8d87:: with SMTP id b7mr816450ioj.46.1621449061851; Wed, 19 May 2021 11:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621449061; cv=none; d=google.com; s=arc-20160816; b=Ks4++OUL6z0GlqwSF5WO0agrd/SnvdlqbFKBomqG5WInWRJRUhYIQK7Kjt8C1HDMCc ngxpd0gr0uya0IESgPznMhJLY9sBud1IiVsHZmGshZJl2U+RPmp0ei1vrlrt/RPOoJZn HFkqVMKncuaGY1NAz2r5fmMOdYABGnfkPqDi646kQh21KD4nIVCSO5nJQE5v4pQNUveQ Q/Kcv/5cBBrI5jQlmCxRVSKjU+IWFCOe+oYyDpksxq68MKv+38v+ZCz9Y6OsxlMYsrUd Q/y/an0yNdE1ux+8uxAkYwki0ch+3dzJk68hQGHRHmvcrjD9ee87lUlye8Dm910Xg64i EXxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=QhylEz/FR85ErruFSaOoh3BqDrntgpzNqNGhC7MUbqE=; b=LvcfPEXPd1yT/+z/HztmF8bb9dE3aSRys1L3iOe0dEMtXWTSDRMktQZ180FkcMf1qX cMwPBJyhINGxV8MIIMvhd4hTDbd9ZB2GBdIV2Fh5uveBDWDylzTK5DGjOGe4CmC+/pGX i407TGTobWepTmm8ivvleCsi5/LsuMZLKg6FfeF9kM392mTnLanBLjYnm+uzoJSWJzG8 aDju9MCiaMVoTcimeSVR640VpnCbo1AMDVpEheZ8CkLafG3jSNu3D+bGDXuSigHxSrrm pEnchGQbbl48OXL45YBoQXKuhesY3PvOcOAkbEyDHWfxxUSpSLKLrYz0s67INXZN6i+O 73CA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d70si37965iog.4.2021.05.19.11.30.47; Wed, 19 May 2021 11:31:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351661AbhERSwe (ORCPT + 99 others); Tue, 18 May 2021 14:52:34 -0400 Received: from foss.arm.com ([217.140.110.172]:59300 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234553AbhERSwe (ORCPT ); Tue, 18 May 2021 14:52:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7BAB5101E; Tue, 18 May 2021 11:51:15 -0700 (PDT) Received: from [10.57.66.179] (unknown [10.57.66.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 96D703F719; Tue, 18 May 2021 11:51:14 -0700 (PDT) Subject: Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve To: Dong Aisheng , iommu@lists.linux-foundation.org Cc: dongas86@gmail.com, linux-kernel@vger.kernel.org, Christoph Hellwig References: <20210518112857.1198415-1-aisheng.dong@nxp.com> From: Robin Murphy Message-ID: Date: Tue, 18 May 2021 19:51:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210518112857.1198415-1-aisheng.dong@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-05-18 12:28, Dong Aisheng wrote: > dma_contiguous_reserve() aims to support cmdline case for CMA memory > reserve. But if users define reserved memory in DT, > 'dma_contiguous_default_area' will not be 0, then it's meaningless > to continue to run dma_contiguous_reserve(). So we return early > if detect 'dma_contiguous_default_area' is unzero. But dma_contiguous_default_area *shouldn't* be set if the command-line argument is present - see the "if (size_cmdline != -1 && default_cma)" part of rmem_cma_setup(). Are you seeing something different in practice? > Cc: Christoph Hellwig > Cc: Marek Szyprowski > Cc: Robin Murphy > Signed-off-by: Dong Aisheng > --- > kernel/dma/contiguous.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c > index 3d63d91cba5c..ebade9f43eff 100644 > --- a/kernel/dma/contiguous.c > +++ b/kernel/dma/contiguous.c > @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit) > phys_addr_t selected_limit = limit; > bool fixed = false; > > + if (dma_contiguous_default_area) > + return; > + > pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit); > > if (size_cmdline != -1) { > @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit) > #endif > } > > - if (selected_size && !dma_contiguous_default_area) { > + if (selected_size) { Either way, does skipping a handful of trivial calculations and a debugging message really matter even when it is redundant? I can't imagine it has any measurable effect on boot times... Robin. > pr_debug("%s: reserving %ld MiB for global area\n", __func__, > (unsigned long)selected_size / SZ_1M); > >