linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm/altmap: Fix altmap boundary check
@ 2023-07-24 18:13 Aneesh Kumar K.V
  2023-07-24 18:22 ` David Hildenbrand
  2023-07-29  7:48 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2023-07-24 18:13 UTC (permalink / raw)
  To: linuxppc-dev, mpe, npiggin, christophe.leroy
  Cc: Aneesh Kumar K.V, Dan Williams, David Hildenbrand

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;
 	}
 
 	pr_debug("vmemmap_free %lx...%lx\n", start, end);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/mm/altmap: Fix altmap boundary check
  2023-07-24 18:13 [PATCH] powerpc/mm/altmap: Fix altmap boundary check Aneesh Kumar K.V
@ 2023-07-24 18:22 ` David Hildenbrand
  2023-07-29  7:48 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2023-07-24 18:22 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linuxppc-dev, mpe, npiggin, christophe.leroy
  Cc: Dan Williams

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/mm/altmap: Fix altmap boundary check
  2023-07-24 18:13 [PATCH] powerpc/mm/altmap: Fix altmap boundary check Aneesh Kumar K.V
  2023-07-24 18:22 ` David Hildenbrand
@ 2023-07-29  7:48 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-07-29  7:48 UTC (permalink / raw)
  To: linuxppc-dev, npiggin, christophe.leroy, Aneesh Kumar K.V
  Cc: Dan Williams, David Hildenbrand

On Mon, 24 Jul 2023 23:43:20 +0530, 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.
> 
> 

Applied to powerpc/fixes.

[1/1] powerpc/mm/altmap: Fix altmap boundary check
      https://git.kernel.org/powerpc/c/6722b25712054c0f903b839b8f5088438dd04df3

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-29  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-24 18:13 [PATCH] powerpc/mm/altmap: Fix altmap boundary check Aneesh Kumar K.V
2023-07-24 18:22 ` David Hildenbrand
2023-07-29  7:48 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).