All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au,
	npiggin@gmail.com, christophe.leroy@csgroup.eu
Cc: Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH] powerpc/mm/altmap: Fix altmap boundary check
Date: Mon, 24 Jul 2023 20:22:47 +0200	[thread overview]
Message-ID: <12e3f722-e6e5-cba4-23c5-546dcf7f6f2b@redhat.com> (raw)
In-Reply-To: <20230724181320.471386-1-aneesh.kumar@linux.ibm.com>

On 24.07.23 20:13, Aneesh Kumar K.V wrote:
> altmap->free includes the entire free space from which altmap blocks
> can be allocated. So when checking whether the kernel is doing altmap
> block free, compute the boundary correctly.
> 
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Fixes: 9ef34630a461 ("powerpc/mm: Fallback to RAM if the altmap is unusable")
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>   arch/powerpc/mm/init_64.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
> index fe1b83020e0d..0ec5b45b1e86 100644
> --- a/arch/powerpc/mm/init_64.c
> +++ b/arch/powerpc/mm/init_64.c
> @@ -314,8 +314,7 @@ void __ref vmemmap_free(unsigned long start, unsigned long end,
>   	start = ALIGN_DOWN(start, page_size);
>   	if (altmap) {
>   		alt_start = altmap->base_pfn;
> -		alt_end = altmap->base_pfn + altmap->reserve +
> -			  altmap->free + altmap->alloc + altmap->align;
> +		alt_end = altmap->base_pfn + altmap->reserve + altmap->free;


Right, align is treated like allocated and align+alloc cannot exceed free.

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb


  reply	other threads:[~2023-07-24 18:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24 18:13 [PATCH] powerpc/mm/altmap: Fix altmap boundary check Aneesh Kumar K.V
2023-07-24 18:22 ` David Hildenbrand [this message]
2023-07-29  7:48 ` Michael Ellerman

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=12e3f722-e6e5-cba4-23c5-546dcf7f6f2b@redhat.com \
    --to=david@redhat.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dan.j.williams@intel.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /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.