linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] arm64/hugetlb: Reserve CMA areas for gigantic pages on 16K and 64K configs
@ 2020-06-29  6:45 Anshuman Khandual
  2020-06-29 11:08 ` kernel test robot
  0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2020-06-29  6:45 UTC (permalink / raw)
  To: linux-mm
  Cc: robin.murphy, Anshuman Khandual, Catalin Marinas, Will Deacon,
	Mark Rutland, Mike Kravetz, Barry Song, Andrew Morton,
	linux-arm-kernel, linux-kernel

Currently 'hugetlb_cma=' command line argument does not create CMA area on
ARM64_16K_PAGES and ARM64_64K_PAGES based platforms. Instead, it just ends
up with the following warning message. Reason being, hugetlb_cma_reserve()
never gets called for these huge page sizes.

[   64.255669] hugetlb_cma: the option isn't supported by current arch

This enables CMA areas reservation on ARM64_16K_PAGES and ARM64_64K_PAGES
configs by defining an unified arm64_hugetlb_cma_reseve() that is wrapped
in CONFIG_CMA.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Barry Song <song.bao.hua@hisilicon.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
Applies on 5.8-rc3.

Changes in V2:

- Moved arm64_hugetlb_cma_reserve() stub and declaration near call site

Changes in V1: (https://patchwork.kernel.org/patch/11619839/)

 arch/arm64/mm/hugetlbpage.c | 38 +++++++++++++++++++++++++++++++++++++
 arch/arm64/mm/init.c        | 12 +++++++++---
 2 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 0a52ce46f020..ea7fb48b8617 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -19,6 +19,44 @@
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>
 
+/*
+ * HugeTLB Support Matrix
+ *
+ * ---------------------------------------------------
+ * | Page Size | CONT PTE |  PMD  | CONT PMD |  PUD  |
+ * ---------------------------------------------------
+ * |     4K    |   64K    |   2M  |    32M   |   1G  |
+ * |    16K    |    2M    |  32M  |     1G   |       |
+ * |    64K    |    2M    | 512M  |    16G   |       |
+ * ---------------------------------------------------
+ */
+
+/*
+ * Reserve CMA areas for the largest supported gigantic
+ * huge page when requested. Any other smaller gigantic
+ * huge pages could still be served from those areas.
+ */
+#ifdef CONFIG_CMA
+void __init arm64_hugetlb_cma_reserve(void)
+{
+	int order;
+
+#ifdef CONFIG_ARM64_4K_PAGES
+	order = PUD_SHIFT - PAGE_SHIFT;
+#else
+	order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT;
+#endif
+	/*
+	 * HugeTLB CMA reservation is required for gigantic
+	 * huge pages which could not be allocated via the
+	 * page allocator. Just warn if there is any change
+	 * breaking this assumption.
+	 */
+	WARN_ON(order <= MAX_ORDER);
+	hugetlb_cma_reserve(order);
+}
+#endif /* CONFIG_CMA */
+
 #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
 bool arch_hugetlb_migration_supported(struct hstate *h)
 {
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 1e93cfc7c47a..8a260ef0cb94 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -406,6 +406,14 @@ void __init arm64_memblock_init(void)
 	dma_contiguous_reserve(arm64_dma32_phys_limit);
 }
 
+#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA)
+void arm64_hugetlb_cma_reserve(void);
+#else
+static inline void arm64_hugetlb_cma_reserve(void)
+{
+}
+#endif
+
 void __init bootmem_init(void)
 {
 	unsigned long min, max;
@@ -425,9 +433,7 @@ void __init bootmem_init(void)
 	 * initialize node_online_map that gets used in hugetlb_cma_reserve()
 	 * while allocating required CMA size across online nodes.
 	 */
-#ifdef CONFIG_ARM64_4K_PAGES
-	hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
-#endif
+	arm64_hugetlb_cma_reserve();
 
 	/*
 	 * Sparsemem tries to allocate bootmem in memory_present(), so must be
-- 
2.20.1



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

* Re: [PATCH V2] arm64/hugetlb: Reserve CMA areas for gigantic pages on 16K and 64K configs
  2020-06-29  6:45 [PATCH V2] arm64/hugetlb: Reserve CMA areas for gigantic pages on 16K and 64K configs Anshuman Khandual
@ 2020-06-29 11:08 ` kernel test robot
  2020-06-30  1:05   ` Anshuman Khandual
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2020-06-29 11:08 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: kbuild-all, robin.murphy, Anshuman Khandual, Catalin Marinas,
	Will Deacon, Mark Rutland, Mike Kravetz, Barry Song,
	Andrew Morton, Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 2367 bytes --]

Hi Anshuman,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.8-rc3]
[also build test WARNING on next-20200629]
[cannot apply to arm64/for-next/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-hugetlb-Reserve-CMA-areas-for-gigantic-pages-on-16K-and-64K-configs/20200629-144736
base:    9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/arm64/mm/hugetlbpage.c:40:13: warning: no previous prototype for 'arm64_hugetlb_cma_reserve' [-Wmissing-prototypes]
      40 | void __init arm64_hugetlb_cma_reserve(void)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~

vim +/arm64_hugetlb_cma_reserve +40 arch/arm64/mm/hugetlbpage.c

    21	
    22	/*
    23	 * HugeTLB Support Matrix
    24	 *
    25	 * ---------------------------------------------------
    26	 * | Page Size | CONT PTE |  PMD  | CONT PMD |  PUD  |
    27	 * ---------------------------------------------------
    28	 * |     4K    |   64K    |   2M  |    32M   |   1G  |
    29	 * |    16K    |    2M    |  32M  |     1G   |       |
    30	 * |    64K    |    2M    | 512M  |    16G   |       |
    31	 * ---------------------------------------------------
    32	 */
    33	
    34	/*
    35	 * Reserve CMA areas for the largest supported gigantic
    36	 * huge page when requested. Any other smaller gigantic
    37	 * huge pages could still be served from those areas.
    38	 */
    39	#ifdef CONFIG_CMA
  > 40	void __init arm64_hugetlb_cma_reserve(void)
    41	{
    42		int order;
    43	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50158 bytes --]

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

* Re: [PATCH V2] arm64/hugetlb: Reserve CMA areas for gigantic pages on 16K and 64K configs
  2020-06-29 11:08 ` kernel test robot
@ 2020-06-30  1:05   ` Anshuman Khandual
  2020-07-02  4:51     ` [kbuild-all] " Xia, Hui
  0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2020-06-30  1:05 UTC (permalink / raw)
  To: kernel test robot, linux-mm
  Cc: kbuild-all, robin.murphy, Catalin Marinas, Will Deacon,
	Mark Rutland, Mike Kravetz, Barry Song, Andrew Morton

On 06/29/2020 04:38 PM, kernel test robot wrote:
> Hi Anshuman,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on v5.8-rc3]
> [also build test WARNING on next-20200629]
> [cannot apply to arm64/for-next/core]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use  as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-hugetlb-Reserve-CMA-areas-for-gigantic-pages-on-16K-and-64K-configs/20200629-144736
> base:    9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68
> config: arm64-defconfig (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> arch/arm64/mm/hugetlbpage.c:40:13: warning: no previous prototype for 'arm64_hugetlb_cma_reserve' [-Wmissing-prototypes]
>       40 | void __init arm64_hugetlb_cma_reserve(void)
>          |             ^~~~~~~~~~~~~~~~~~~~~~~~~

This only comes up with W=1 and I wonder if this is truly a
valid warning. Should all non-static function needs to have
a declaration in a header file ? In this case, there is a
declaration for this function near the call site itself, why
should not that be sufficient.

#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA)
void arm64_hugetlb_cma_reserve(void); <--------- Declaration
#else
static inline void arm64_hugetlb_cma_reserve(void)
{
}
#endif


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

* RE: [kbuild-all] Re: [PATCH V2] arm64/hugetlb: Reserve CMA areas for gigantic pages on 16K and 64K configs
  2020-06-30  1:05   ` Anshuman Khandual
@ 2020-07-02  4:51     ` Xia, Hui
  0 siblings, 0 replies; 4+ messages in thread
From: Xia, Hui @ 2020-07-02  4:51 UTC (permalink / raw)
  To: Anshuman Khandual, lkp, linux-mm
  Cc: kbuild-all, robin.murphy, Catalin Marinas, Will Deacon,
	Mark Rutland, Mike Kravetz, Barry Song, Andrew Morton



>-----Original Message-----
>From: Anshuman Khandual <anshuman.khandual@arm.com>
>Sent: 2020年6月30日 9:05
>To: lkp <lkp@intel.com>; linux-mm@kvack.org
>Cc: kbuild-all@lists.01.org; robin.murphy@arm.com; Catalin Marinas
><catalin.marinas@arm.com>; Will Deacon <will@kernel.org>; Mark Rutland
><mark.rutland@arm.com>; Mike Kravetz <mike.kravetz@oracle.com>; Barry
>Song <song.bao.hua@hisilicon.com>; Andrew Morton <akpm@linux-
>foundation.org>
>Subject: [kbuild-all] Re: [PATCH V2] arm64/hugetlb: Reserve CMA areas for
>gigantic pages on 16K and 64K configs
>
>On 06/29/2020 04:38 PM, kernel test robot wrote:
>> Hi Anshuman,
>>
>> Thank you for the patch! Perhaps something to improve:
>>
>> [auto build test WARNING on v5.8-rc3]
>> [also build test WARNING on next-20200629] [cannot apply to
>> arm64/for-next/core] [If your patch is applied to the wrong git tree,
>> kindly drop us a note.
>> And when submitting patch, we suggest to use  as documented in
>> https://git-scm.com/docs/git-format-patch]
>>
>> url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-
>hugetlb-Reserve-CMA-areas-for-gigantic-pages-on-16K-and-64K-
>configs/20200629-144736
>> base:    9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68
>> config: arm64-defconfig (attached as .config)
>> compiler: aarch64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1
>> build):
>>         wget https://raw.githubusercontent.com/intel/lkp-
>tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross
>> ARCH=arm64
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> arch/arm64/mm/hugetlbpage.c:40:13: warning: no previous prototype
>>>> for 'arm64_hugetlb_cma_reserve' [-Wmissing-prototypes]
>>       40 | void __init arm64_hugetlb_cma_reserve(void)
>>          |             ^~~~~~~~~~~~~~~~~~~~~~~~~
>
>This only comes up with W=1 and I wonder if this is truly a valid warning. Should
>all non-static function needs to have a declaration in a header file ? In this case,
>there is a declaration for this function near the call site itself, why should not that
>be sufficient.
Yes, -Wmissing-prototypes only enabled when make W=1. Kindly refer to FAQ 
https://github.com/intel/lkp-tests/wiki/LKP-FAQ#how-is-one-meant-to-act-on-w1-reports-like--wmissing-prototypes
please ignore this warning if confirmed it is not a issue here. sorry for inconvenient.

>
>#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA) void
>arm64_hugetlb_cma_reserve(void); <--------- Declaration #else static inline void
>arm64_hugetlb_cma_reserve(void) { } #endif
>_______________________________________________
>kbuild-all mailing list -- kbuild-all@lists.01.org To unsubscribe send an email to
>kbuild-all-leave@lists.01.org


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

end of thread, other threads:[~2020-07-02  4:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29  6:45 [PATCH V2] arm64/hugetlb: Reserve CMA areas for gigantic pages on 16K and 64K configs Anshuman Khandual
2020-06-29 11:08 ` kernel test robot
2020-06-30  1:05   ` Anshuman Khandual
2020-07-02  4:51     ` [kbuild-all] " Xia, Hui

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