Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3730577pxj; Tue, 1 Jun 2021 11:50:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN87RDdYnwWd0zXted5xFPvmBzngoPbK3UlBtPYaFxRA0igPTrREY4aEi0nQ7QV2NkJYjZ X-Received: by 2002:a05:6402:2786:: with SMTP id b6mr35099649ede.20.1622573407261; Tue, 01 Jun 2021 11:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622573407; cv=none; d=google.com; s=arc-20160816; b=m0zDRmrRZJvo/xsz2tOupZpOMCLyI4VDa5oDLFSnNYtqn3puagMwMOsaJsGw6ttHRC +crg1CZL4e0ep33h8Do5jkEXQC76XjOY/hU0Z220qkTkQa/T3dRbEHbH1T1qcscyI0DM w/nH2zzOL+5Yc5DyWAhXhB+p9ROIQEChct+GaZCANWVQd7iqtrdzGBP5lzms+iVbutxo 4wj8XxZhwsq+vzViTcPiYTGNYQQfxc1mmgn3G9CFoAcSclVXf0EEijFHgLbWrx6gePt9 sfMq+s3eDcqWRL1EOstGUtMdtjKPT63dJYqWWgufax+nu69Lo9n0ZcFhQeSAR27WEttF OiOQ== 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=nxEgmSG1X+FRiZc4+PeCY15AOhwwpgfxDDRUvlaSbZg=; b=rv/YwMP6xmusqmr11dK+vOpRMmiUqHvl5Mus7xoCJLaD7tYx3xmenLDZxz61A0oheN YueK9wS1Tx8Opgy9fNypFp6hMHYNZUt5JmYofEPUO8tM7VUyhh7lkb/ZuFD/kSQX5DD5 Uwi17G8OgpVS3Pgtp5/UxupgMt4TPsLkUgUc0/PgOMihxR+wv6hGVMS/wDRlvaDyUoC3 zbQcROgWU7jhdc8Bcmz90BX2pJgGAWRtYrBysUgJAtSv7DPZlWnwSXXju4H6UYJVynKZ TfcPGlv5113yiAJYd4nAdcKHwGDp21iaE7KhQvVfQrxBER0PZXTpYBY/6GAS3MyMYhWq sfeA== 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 v7si933882ejk.196.2021.06.01.11.49.43; Tue, 01 Jun 2021 11:50:07 -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 S234684AbhFASsd (ORCPT + 99 others); Tue, 1 Jun 2021 14:48:33 -0400 Received: from foss.arm.com ([217.140.110.172]:56410 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbhFASsd (ORCPT ); Tue, 1 Jun 2021 14:48:33 -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 73DC56D; Tue, 1 Jun 2021 11:46:51 -0700 (PDT) Received: from [10.57.73.64] (unknown [10.57.73.64]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B59C3F774; Tue, 1 Jun 2021 11:46:50 -0700 (PDT) Subject: Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve To: Dong Aisheng , Dong Aisheng Cc: iommu@lists.linux-foundation.org, open list , Christoph Hellwig , Marek Szyprowski References: <20210518112857.1198415-1-aisheng.dong@nxp.com> From: Robin Murphy Message-ID: <4a7922c0-7696-b4f7-f212-6710f4b2720d@arm.com> Date: Tue, 1 Jun 2021 19:46:45 +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: 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-31 10:21, Dong Aisheng wrote: > On Tue, May 18, 2021 at 7:29 PM 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. >> >> Cc: Christoph Hellwig >> Cc: Marek Szyprowski >> Cc: Robin Murphy >> Signed-off-by: Dong Aisheng > > Gently ping The commit message is still wrong, and I still think the change doesn't achieve anything meaningful. This code is hard to make sense of either way because the crucial interplay between size_cmdline and dma_contiguous_default_area is hidden somewhere else entirely, and it would take a much more significant refactoring to clear that up. Robin. > > Regards > 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) { >> pr_debug("%s: reserving %ld MiB for global area\n", __func__, >> (unsigned long)selected_size / SZ_1M); >> >> -- >> 2.25.1 >>