All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Dong Aisheng <aisheng.dong@nxp.com>, iommu@lists.linux-foundation.org
Cc: dongas86@gmail.com, linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
Date: Tue, 18 May 2021 19:51:07 +0100	[thread overview]
Message-ID: <fe37a3d0-1360-77e8-f594-c9f32cc39cf2@arm.com> (raw)
In-Reply-To: <20210518112857.1198415-1-aisheng.dong@nxp.com>

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 <hch@lst.de>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> ---
>   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);
>   
> 

WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: Dong Aisheng <aisheng.dong@nxp.com>, iommu@lists.linux-foundation.org
Cc: Christoph Hellwig <hch@lst.de>,
	dongas86@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
Date: Tue, 18 May 2021 19:51:07 +0100	[thread overview]
Message-ID: <fe37a3d0-1360-77e8-f594-c9f32cc39cf2@arm.com> (raw)
In-Reply-To: <20210518112857.1198415-1-aisheng.dong@nxp.com>

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 <hch@lst.de>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> ---
>   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);
>   
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-05-18 18:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 11:28 [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve Dong Aisheng
2021-05-18 11:28 ` Dong Aisheng
2021-05-18 18:51 ` Robin Murphy [this message]
2021-05-18 18:51   ` Robin Murphy
2021-05-19  3:54   ` Dong Aisheng
2021-05-19  3:54     ` Dong Aisheng
2021-05-31  9:21 ` Dong Aisheng
2021-05-31  9:21   ` Dong Aisheng
2021-06-01 18:46   ` Robin Murphy
2021-06-01 18:46     ` Robin Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe37a3d0-1360-77e8-f594-c9f32cc39cf2@arm.com \
    --to=robin.murphy@arm.com \
    --cc=aisheng.dong@nxp.com \
    --cc=dongas86@gmail.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.