LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE
@ 2021-10-05 20:25 Mike Kravetz
  2021-10-05 20:54 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mike Kravetz @ 2021-10-05 20:25 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, Anshuman Khandual
  Cc: Will Deacon, Mark Rutland, Barry Song, Andrew Morton,
	Mike Kravetz, stable

For non-4K PAGE_SIZE configs, the largest gigantic huge page size is
CONT_PMD_SHIFT order.

Fixes: abb7962adc80 ("arm64/hugetlb: Reserve CMA areas for gigantic
pages on 16K and 64K configs")
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: <stable@vger.kernel.org>
---
 arch/arm64/mm/hugetlbpage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 23505fc35324..a8158c948966 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -43,7 +43,7 @@ void __init arm64_hugetlb_cma_reserve(void)
 #ifdef CONFIG_ARM64_4K_PAGES
 	order = PUD_SHIFT - PAGE_SHIFT;
 #else
-	order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT;
+	order = CONT_PMD_SHIFT - PAGE_SHIFT;
 #endif
 	/*
 	 * HugeTLB CMA reservation is required for gigantic
-- 
2.31.1


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

* Re: [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE
  2021-10-05 20:25 [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE Mike Kravetz
@ 2021-10-05 20:54 ` Andrew Morton
  2021-10-05 21:28   ` Mike Kravetz
  2021-10-06  7:55 ` Anshuman Khandual
  2021-10-06 13:06 ` Catalin Marinas
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2021-10-05 20:54 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: linux-kernel, linux-arm-kernel, Anshuman Khandual, Will Deacon,
	Mark Rutland, Barry Song, stable

On Tue,  5 Oct 2021 13:25:29 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:

> For non-4K PAGE_SIZE configs, the largest gigantic huge page size is
> CONT_PMD_SHIFT order.

What are the user visible effects of this bug?



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

* Re: [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE
  2021-10-05 20:54 ` Andrew Morton
@ 2021-10-05 21:28   ` Mike Kravetz
  2021-10-05 23:15     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Kravetz @ 2021-10-05 21:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-arm-kernel, Anshuman Khandual, Will Deacon,
	Mark Rutland, Barry Song, stable

On 10/5/21 1:54 PM, Andrew Morton wrote:
> On Tue,  5 Oct 2021 13:25:29 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:
> 
>> For non-4K PAGE_SIZE configs, the largest gigantic huge page size is
>> CONT_PMD_SHIFT order.
> 
> What are the user visible effects of this bug?
> 
> 

Sorry,
I only recently got easy access to arm64 platforms.  This is what I saw
as a user:

The largest gigantic huge page size on arm64 with 64K PAGE_SIZE 64K is
16G.  Therefore, one should be able to specify 'hugetlb_cma=16G' on the
kernel command line so that 1 gigantic page can be allocated from CMA.
However, when adding such an option the following message is produced:

hugetlb_cma: cma area should be at least 8796093022208 MiB

This is because the calculation for non-4K gigantic page order is
incorrect in the arm64 specific routine arm64_hugetlb_cma_reserve().

Would you like me to send a new version with this in the commit message?
Or, is it easier for you to just add it?
-- 
Mike Kravetz

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

* Re: [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE
  2021-10-05 21:28   ` Mike Kravetz
@ 2021-10-05 23:15     ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2021-10-05 23:15 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: linux-kernel, linux-arm-kernel, Anshuman Khandual, Will Deacon,
	Mark Rutland, Barry Song, stable

On Tue, 5 Oct 2021 14:28:03 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:

> On 10/5/21 1:54 PM, Andrew Morton wrote:
> > On Tue,  5 Oct 2021 13:25:29 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:
> > 
> >> For non-4K PAGE_SIZE configs, the largest gigantic huge page size is
> >> CONT_PMD_SHIFT order.
> > 
> > What are the user visible effects of this bug?
> > 
> > 
> 
> Sorry,
> I only recently got easy access to arm64 platforms.  This is what I saw
> as a user:
> 
> The largest gigantic huge page size on arm64 with 64K PAGE_SIZE 64K is
> 16G.  Therefore, one should be able to specify 'hugetlb_cma=16G' on the
> kernel command line so that 1 gigantic page can be allocated from CMA.
> However, when adding such an option the following message is produced:
> 
> hugetlb_cma: cma area should be at least 8796093022208 MiB
> 
> This is because the calculation for non-4K gigantic page order is
> incorrect in the arm64 specific routine arm64_hugetlb_cma_reserve().

Cool, thanks.

> Would you like me to send a new version with this in the commit message?
> Or, is it easier for you to just add it?

I assumed that it would be merged via the same path as the offending
abb7962adc80.  Catalin's arm tree, it appears.


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

* Re: [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE
  2021-10-05 20:25 [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE Mike Kravetz
  2021-10-05 20:54 ` Andrew Morton
@ 2021-10-06  7:55 ` Anshuman Khandual
  2021-10-06 13:06 ` Catalin Marinas
  2 siblings, 0 replies; 6+ messages in thread
From: Anshuman Khandual @ 2021-10-06  7:55 UTC (permalink / raw)
  To: Mike Kravetz, linux-kernel, linux-arm-kernel
  Cc: Will Deacon, Mark Rutland, Barry Song, Andrew Morton, stable



On 10/6/21 1:55 AM, Mike Kravetz wrote:
> For non-4K PAGE_SIZE configs, the largest gigantic huge page size is
> CONT_PMD_SHIFT order.
> 
> Fixes: abb7962adc80 ("arm64/hugetlb: Reserve CMA areas for gigantic
> pages on 16K and 64K configs")
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: <stable@vger.kernel.org>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
>  arch/arm64/mm/hugetlbpage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index 23505fc35324..a8158c948966 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -43,7 +43,7 @@ void __init arm64_hugetlb_cma_reserve(void)
>  #ifdef CONFIG_ARM64_4K_PAGES
>  	order = PUD_SHIFT - PAGE_SHIFT;
>  #else
> -	order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT;
> +	order = CONT_PMD_SHIFT - PAGE_SHIFT;
>  #endif
>  	/*
>  	 * HugeTLB CMA reservation is required for gigantic
> 

The commit a1634a542f74 ("arm64/mm: Redefine CONT_{PTE, PMD}_SHIFT")
which got merged during the exact same week, broke the above commit
as both were in flight. The commit here updated hugetlbpage_init()
but did not update the new incoming arm64_hugetlb_cma_reserve().

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

* Re: [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE
  2021-10-05 20:25 [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE Mike Kravetz
  2021-10-05 20:54 ` Andrew Morton
  2021-10-06  7:55 ` Anshuman Khandual
@ 2021-10-06 13:06 ` Catalin Marinas
  2 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2021-10-06 13:06 UTC (permalink / raw)
  To: Mike Kravetz, Anshuman Khandual, linux-kernel, linux-arm-kernel
  Cc: Will Deacon, Andrew Morton, stable, Mark Rutland, Barry Song

On Tue, 5 Oct 2021 13:25:29 -0700, Mike Kravetz wrote:
> For non-4K PAGE_SIZE configs, the largest gigantic huge page size is
> CONT_PMD_SHIFT order.

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE
      https://git.kernel.org/arm64/c/0350419b14b9

-- 
Catalin


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

end of thread, other threads:[~2021-10-06 13:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 20:25 [PATCH] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE Mike Kravetz
2021-10-05 20:54 ` Andrew Morton
2021-10-05 21:28   ` Mike Kravetz
2021-10-05 23:15     ` Andrew Morton
2021-10-06  7:55 ` Anshuman Khandual
2021-10-06 13:06 ` Catalin Marinas

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).