linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Frank van der Linden <fvdl@google.com>
Cc: akpm@linux-foundation.org, muchun.song@linux.dev,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	gushchin@linux.dev
Subject: Re: [PATCH] mm/cma: report base address of single range correctly
Date: Tue, 8 Apr 2025 10:05:48 +0200	[thread overview]
Message-ID: <CAMuHMdUeGjbOx-aJTvwOVBWdUFmY7wU-p3mKaCbEzQ4PbJDqNg@mail.gmail.com> (raw)
In-Reply-To: <20250407165435.2567898-1-fvdl@google.com>

On Mon, 7 Apr 2025 at 18:54, Frank van der Linden <fvdl@google.com> wrote:
> The cma_declare_contiguous_nid code was refactored by
> commit c009da4258f9 ("mm, cma: support multiple contiguous
> ranges, if requested"), so that it could use an internal
> function to attempt a single range area first, and then
> try a multi-range one.
>
> However, that meant that the actual base address used for
> the !fixed case (base == 0) wasn't available one level up
> to be printed in the informational message, and it would
> always end up printing a base address of 0 in the boot
> message.
>
> Make the internal function take a phys_addr_t pointer to
> the base address, so that the value is available to the
> caller.
>
> Fixes: c009da4258f9 ("mm, cma: support multiple contiguous ranges, if requested")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Closes: https://lore.kernel.org/linux-mm/CAMuHMdVWviQ7O9yBFE3f=ev0eVb1CnsQvR6SKtEROBbM6z7g3w@mail.gmail.com/
> Signed-off-by: Frank van der Linden <fvdl@google.com>

Thanks, this fixes the issue!
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -724,8 +724,10 @@ static int __init __cma_declare_contiguous_nid(phys_addr_t base,
>         ret = cma_init_reserved_mem(base, size, order_per_bit, name, res_cma);
>         if (ret)
>                 memblock_phys_free(base, size);
> -
> -       (*res_cma)->nid = nid;
> +       else {
> +               (*res_cma)->nid = nid;
> +               *basep = base;
> +       }

Please add curly braces to the other branch, too.

Or perhaps restructure as:

    if (ret) {
            memblock_phys_free(base, size);
            return ret;
    }

    (*res_cma)->nid = nid;
    *basep = base;

    return 0;

>
>         return ret;
>  }

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


  reply	other threads:[~2025-04-08  8:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 16:54 Frank van der Linden
2025-04-08  8:05 ` Geert Uytterhoeven [this message]
2025-04-08 16:41   ` Frank van der Linden

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=CAMuHMdUeGjbOx-aJTvwOVBWdUFmY7wU-p3mKaCbEzQ4PbJDqNg@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=fvdl@google.com \
    --cc=gushchin@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox