diff mbox series

[v2,09/12] mm/vm_debug_pgtable: Use struct pgtable_debug_args in PUD modifying tests

Message ID 20210719054138.198373-10-gshan@redhat.com (mailing list archive)
State New
Headers show
Series mm/debug_vm_pgtable: Enhancements | expand

Commit Message

Gavin Shan July 19, 2021, 5:41 a.m. UTC
This uses struct pgtable_debug_args in PUD modifying tests. The allocated
huge page is used when set_pud_at() is used. The corresponding tests
are skipped if the huge page doesn't exist.

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
 mm/debug_vm_pgtable.c | 114 ++++++++++++++++++------------------------
 1 file changed, 50 insertions(+), 64 deletions(-)

Comments

kernel test robot July 19, 2021, 9:13 a.m. UTC | #1
Hi Gavin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.14-rc2]
[cannot apply to hnaz-linux-mm/master linux/master next-20210716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2734d6c1b1a089fb593ef6a23d4b70903526fe0c
config: arm64-randconfig-r005-20210719 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d5b08761f944d5b9822d582378333cc4b36a0a7)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/69db26024e6bd48423ebc83b0f83b7b52217b624
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
        git checkout 69db26024e6bd48423ebc83b0f83b7b52217b624
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang 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 >>):

>> mm/debug_vm_pgtable.c:445:8: warning: variable 'pud' set but not used [-Wunused-but-set-variable]
           pud_t pud;
                 ^
   mm/debug_vm_pgtable.c:1140:17: warning: variable 'protnone' set but not used [-Wunused-but-set-variable]
           pgprot_t prot, protnone;
                          ^
   mm/debug_vm_pgtable.c:1142:36: warning: variable 'pmd_aligned' set but not used [-Wunused-but-set-variable]
           unsigned long vaddr, pte_aligned, pmd_aligned;
                                             ^
   mm/debug_vm_pgtable.c:1143:42: warning: variable 'pgd_aligned' set but not used [-Wunused-but-set-variable]
           unsigned long pud_aligned, p4d_aligned, pgd_aligned;
                                                   ^
   mm/debug_vm_pgtable.c:1143:29: warning: variable 'p4d_aligned' set but not used [-Wunused-but-set-variable]
           unsigned long pud_aligned, p4d_aligned, pgd_aligned;
                                      ^
   mm/debug_vm_pgtable.c:1143:16: warning: variable 'pud_aligned' set but not used [-Wunused-but-set-variable]
           unsigned long pud_aligned, p4d_aligned, pgd_aligned;
                         ^
   mm/debug_vm_pgtable.c:1140:11: warning: variable 'prot' set but not used [-Wunused-but-set-variable]
           pgprot_t prot, protnone;
                    ^
   7 warnings generated.


vim +/pud +445 mm/debug_vm_pgtable.c

5fe77be6bf14bf Shixin Liu        2021-06-30  442  
69db26024e6bd4 Gavin Shan        2021-07-19  443  static void __init pud_huge_tests(struct pgtable_debug_args *args)
a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  444  {
5fe77be6bf14bf Shixin Liu        2021-06-30 @445  	pud_t pud;
5fe77be6bf14bf Shixin Liu        2021-06-30  446  
69db26024e6bd4 Gavin Shan        2021-07-19  447  	if (!arch_vmap_pud_supported(args->page_prot))
5fe77be6bf14bf Shixin Liu        2021-06-30  448  		return;
5fe77be6bf14bf Shixin Liu        2021-06-30  449  
5fe77be6bf14bf Shixin Liu        2021-06-30  450  	pr_debug("Validating PUD huge\n");
5fe77be6bf14bf Shixin Liu        2021-06-30  451  	/*
5fe77be6bf14bf Shixin Liu        2021-06-30  452  	 * X86 defined pud_set_huge() verifies that the given
5fe77be6bf14bf Shixin Liu        2021-06-30  453  	 * PUD is not a populated non-leaf entry.
5fe77be6bf14bf Shixin Liu        2021-06-30  454  	 */
69db26024e6bd4 Gavin Shan        2021-07-19  455  	WRITE_ONCE(*(args->pudp), __pud(0));
69db26024e6bd4 Gavin Shan        2021-07-19  456  	WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn),
69db26024e6bd4 Gavin Shan        2021-07-19  457  			      args->page_prot));
69db26024e6bd4 Gavin Shan        2021-07-19  458  	WARN_ON(!pud_clear_huge(args->pudp));
69db26024e6bd4 Gavin Shan        2021-07-19  459  	pud = READ_ONCE(*(args->pudp));
a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  460  }
5fe77be6bf14bf Shixin Liu        2021-06-30  461  #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
54b1f4b50ddb0f Gavin Shan        2021-07-19  462  static void __init pmd_huge_tests(struct pgtable_debug_args *args) { }
69db26024e6bd4 Gavin Shan        2021-07-19  463  static void __init pud_huge_tests(struct pgtable_debug_args *args) { }
5fe77be6bf14bf Shixin Liu        2021-06-30  464  #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
399145f9eb6c67 Anshuman Khandual 2020-06-04  465  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Gavin Shan July 19, 2021, 11:30 a.m. UTC | #2
On 7/19/21 7:13 PM, kernel test robot wrote:
> Hi Gavin,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.14-rc2]
> [cannot apply to hnaz-linux-mm/master linux/master next-20210716]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2734d6c1b1a089fb593ef6a23d4b70903526fe0c
> config: arm64-randconfig-r005-20210719 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d5b08761f944d5b9822d582378333cc4b36a0a7)
> 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
>          # install arm64 cross compiling tool for clang build
>          # apt-get install binutils-aarch64-linux-gnu
>          # https://github.com/0day-ci/linux/commit/69db26024e6bd48423ebc83b0f83b7b52217b624
>          git remote add linux-review https://github.com/0day-ci/linux
>          git fetch --no-tags linux-review Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
>          git checkout 69db26024e6bd48423ebc83b0f83b7b52217b624
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 

Thanks for reporting the build warnings. I will fix it in v3.

> All warnings (new ones prefixed by >>):
> 
>>> mm/debug_vm_pgtable.c:445:8: warning: variable 'pud' set but not used [-Wunused-but-set-variable]
>             pud_t pud;
>  

A "WARN_ON(!pud_none(pud)) is missed from PATCH[9/12].

                  ^
>     mm/debug_vm_pgtable.c:1140:17: warning: variable 'protnone' set but not used [-Wunused-but-set-variable]
>             pgprot_t prot, protnone;
>                            ^
>     mm/debug_vm_pgtable.c:1142:36: warning: variable 'pmd_aligned' set but not used [-Wunused-but-set-variable]
>             unsigned long vaddr, pte_aligned, pmd_aligned;
>                                               ^
>     mm/debug_vm_pgtable.c:1143:42: warning: variable 'pgd_aligned' set but not used [-Wunused-but-set-variable]
>             unsigned long pud_aligned, p4d_aligned, pgd_aligned;
>                                                     ^
>     mm/debug_vm_pgtable.c:1143:29: warning: variable 'p4d_aligned' set but not used [-Wunused-but-set-variable]
>             unsigned long pud_aligned, p4d_aligned, pgd_aligned;
>                                        ^
>     mm/debug_vm_pgtable.c:1143:16: warning: variable 'pud_aligned' set but not used [-Wunused-but-set-variable]
>             unsigned long pud_aligned, p4d_aligned, pgd_aligned;
>                           ^
>     mm/debug_vm_pgtable.c:1140:11: warning: variable 'prot' set but not used [-Wunused-but-set-variable]
>             pgprot_t prot, protnone;
>                      ^
>     7 warnings generated.
> 

There are more build warnings introduced by other patches. I need to drop the unused
variables in debug_vm_pgtable(). So I need to drop the unused variables in separate
patches in v3, instead of dropping all of them in PATCH[v2 11/12].

Thanks,
Gavin

> 
> vim +/pud +445 mm/debug_vm_pgtable.c
> 
> 5fe77be6bf14bf Shixin Liu        2021-06-30  442
> 69db26024e6bd4 Gavin Shan        2021-07-19  443  static void __init pud_huge_tests(struct pgtable_debug_args *args)
> a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  444  {
> 5fe77be6bf14bf Shixin Liu        2021-06-30 @445  	pud_t pud;
> 5fe77be6bf14bf Shixin Liu        2021-06-30  446
> 69db26024e6bd4 Gavin Shan        2021-07-19  447  	if (!arch_vmap_pud_supported(args->page_prot))
> 5fe77be6bf14bf Shixin Liu        2021-06-30  448  		return;
> 5fe77be6bf14bf Shixin Liu        2021-06-30  449
> 5fe77be6bf14bf Shixin Liu        2021-06-30  450  	pr_debug("Validating PUD huge\n");
> 5fe77be6bf14bf Shixin Liu        2021-06-30  451  	/*
> 5fe77be6bf14bf Shixin Liu        2021-06-30  452  	 * X86 defined pud_set_huge() verifies that the given
> 5fe77be6bf14bf Shixin Liu        2021-06-30  453  	 * PUD is not a populated non-leaf entry.
> 5fe77be6bf14bf Shixin Liu        2021-06-30  454  	 */
> 69db26024e6bd4 Gavin Shan        2021-07-19  455  	WRITE_ONCE(*(args->pudp), __pud(0));
> 69db26024e6bd4 Gavin Shan        2021-07-19  456  	WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn),
> 69db26024e6bd4 Gavin Shan        2021-07-19  457  			      args->page_prot));
> 69db26024e6bd4 Gavin Shan        2021-07-19  458  	WARN_ON(!pud_clear_huge(args->pudp));
> 69db26024e6bd4 Gavin Shan        2021-07-19  459  	pud = READ_ONCE(*(args->pudp));
> a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  460  }
> 5fe77be6bf14bf Shixin Liu        2021-06-30  461  #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
> 54b1f4b50ddb0f Gavin Shan        2021-07-19  462  static void __init pmd_huge_tests(struct pgtable_debug_args *args) { }
> 69db26024e6bd4 Gavin Shan        2021-07-19  463  static void __init pud_huge_tests(struct pgtable_debug_args *args) { }
> 5fe77be6bf14bf Shixin Liu        2021-06-30  464  #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
> 399145f9eb6c67 Anshuman Khandual 2020-06-04  465
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
kernel test robot July 20, 2021, 2:46 a.m. UTC | #3
Hi Gavin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.14-rc2]
[cannot apply to hnaz-linux-mm/master linux/master next-20210719]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2734d6c1b1a089fb593ef6a23d4b70903526fe0c
config: x86_64-randconfig-c002-20210719 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/69db26024e6bd48423ebc83b0f83b7b52217b624
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
        git checkout 69db26024e6bd48423ebc83b0f83b7b52217b624
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

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

   mm/debug_vm_pgtable.c: In function 'pud_huge_tests':
>> mm/debug_vm_pgtable.c:445:8: warning: variable 'pud' set but not used [-Wunused-but-set-variable]
     445 |  pud_t pud;
         |        ^~~
   mm/debug_vm_pgtable.c: In function 'debug_vm_pgtable':
   mm/debug_vm_pgtable.c:1143:42: warning: variable 'pgd_aligned' set but not used [-Wunused-but-set-variable]
    1143 |  unsigned long pud_aligned, p4d_aligned, pgd_aligned;
         |                                          ^~~~~~~~~~~
   mm/debug_vm_pgtable.c:1143:29: warning: variable 'p4d_aligned' set but not used [-Wunused-but-set-variable]
    1143 |  unsigned long pud_aligned, p4d_aligned, pgd_aligned;
         |                             ^~~~~~~~~~~
   mm/debug_vm_pgtable.c:1143:16: warning: variable 'pud_aligned' set but not used [-Wunused-but-set-variable]
    1143 |  unsigned long pud_aligned, p4d_aligned, pgd_aligned;
         |                ^~~~~~~~~~~
   mm/debug_vm_pgtable.c:1142:36: warning: variable 'pmd_aligned' set but not used [-Wunused-but-set-variable]
    1142 |  unsigned long vaddr, pte_aligned, pmd_aligned;
         |                                    ^~~~~~~~~~~
   mm/debug_vm_pgtable.c:1140:17: warning: variable 'protnone' set but not used [-Wunused-but-set-variable]
    1140 |  pgprot_t prot, protnone;
         |                 ^~~~~~~~
   mm/debug_vm_pgtable.c:1140:11: warning: variable 'prot' set but not used [-Wunused-but-set-variable]
    1140 |  pgprot_t prot, protnone;
         |           ^~~~


vim +/pud +445 mm/debug_vm_pgtable.c

5fe77be6bf14bf Shixin Liu        2021-06-30  442  
69db26024e6bd4 Gavin Shan        2021-07-19  443  static void __init pud_huge_tests(struct pgtable_debug_args *args)
a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  444  {
5fe77be6bf14bf Shixin Liu        2021-06-30 @445  	pud_t pud;
5fe77be6bf14bf Shixin Liu        2021-06-30  446  
69db26024e6bd4 Gavin Shan        2021-07-19  447  	if (!arch_vmap_pud_supported(args->page_prot))
5fe77be6bf14bf Shixin Liu        2021-06-30  448  		return;
5fe77be6bf14bf Shixin Liu        2021-06-30  449  
5fe77be6bf14bf Shixin Liu        2021-06-30  450  	pr_debug("Validating PUD huge\n");
5fe77be6bf14bf Shixin Liu        2021-06-30  451  	/*
5fe77be6bf14bf Shixin Liu        2021-06-30  452  	 * X86 defined pud_set_huge() verifies that the given
5fe77be6bf14bf Shixin Liu        2021-06-30  453  	 * PUD is not a populated non-leaf entry.
5fe77be6bf14bf Shixin Liu        2021-06-30  454  	 */
69db26024e6bd4 Gavin Shan        2021-07-19  455  	WRITE_ONCE(*(args->pudp), __pud(0));
69db26024e6bd4 Gavin Shan        2021-07-19  456  	WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn),
69db26024e6bd4 Gavin Shan        2021-07-19  457  			      args->page_prot));
69db26024e6bd4 Gavin Shan        2021-07-19  458  	WARN_ON(!pud_clear_huge(args->pudp));
69db26024e6bd4 Gavin Shan        2021-07-19  459  	pud = READ_ONCE(*(args->pudp));
a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  460  }
5fe77be6bf14bf Shixin Liu        2021-06-30  461  #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
54b1f4b50ddb0f Gavin Shan        2021-07-19  462  static void __init pmd_huge_tests(struct pgtable_debug_args *args) { }
69db26024e6bd4 Gavin Shan        2021-07-19  463  static void __init pud_huge_tests(struct pgtable_debug_args *args) { }
5fe77be6bf14bf Shixin Liu        2021-06-30  464  #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
399145f9eb6c67 Anshuman Khandual 2020-06-04  465  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Gavin Shan July 20, 2021, 11:09 p.m. UTC | #4
On 7/20/21 12:46 PM, kernel test robot wrote:
> Hi Gavin,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.14-rc2]
> [cannot apply to hnaz-linux-mm/master linux/master next-20210719]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2734d6c1b1a089fb593ef6a23d4b70903526fe0c
> config: x86_64-randconfig-c002-20210719 (attached as .config)
> compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
> reproduce (this is a W=1 build):
>          # https://github.com/0day-ci/linux/commit/69db26024e6bd48423ebc83b0f83b7b52217b624
>          git remote add linux-review https://github.com/0day-ci/linux
>          git fetch --no-tags linux-review Gavin-Shan/mm-debug_vm_pgtable-Enhancements/20210719-134236
>          git checkout 69db26024e6bd48423ebc83b0f83b7b52217b624
>          # save the attached .config to linux build tree
>          make W=1 ARCH=x86_64
> 
> 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 >>):
> 
>     mm/debug_vm_pgtable.c: In function 'pud_huge_tests':
>>> mm/debug_vm_pgtable.c:445:8: warning: variable 'pud' set but not used [-Wunused-but-set-variable]
>       445 |  pud_t pud;
>           |        ^~~
>     mm/debug_vm_pgtable.c: In function 'debug_vm_pgtable':
>     mm/debug_vm_pgtable.c:1143:42: warning: variable 'pgd_aligned' set but not used [-Wunused-but-set-variable]
>      1143 |  unsigned long pud_aligned, p4d_aligned, pgd_aligned;
>           |                                          ^~~~~~~~~~~
>     mm/debug_vm_pgtable.c:1143:29: warning: variable 'p4d_aligned' set but not used [-Wunused-but-set-variable]
>      1143 |  unsigned long pud_aligned, p4d_aligned, pgd_aligned;
>           |                             ^~~~~~~~~~~
>     mm/debug_vm_pgtable.c:1143:16: warning: variable 'pud_aligned' set but not used [-Wunused-but-set-variable]
>      1143 |  unsigned long pud_aligned, p4d_aligned, pgd_aligned;
>           |                ^~~~~~~~~~~
>     mm/debug_vm_pgtable.c:1142:36: warning: variable 'pmd_aligned' set but not used [-Wunused-but-set-variable]
>      1142 |  unsigned long vaddr, pte_aligned, pmd_aligned;
>           |                                    ^~~~~~~~~~~
>     mm/debug_vm_pgtable.c:1140:17: warning: variable 'protnone' set but not used [-Wunused-but-set-variable]
>      1140 |  pgprot_t prot, protnone;
>           |                 ^~~~~~~~
>     mm/debug_vm_pgtable.c:1140:11: warning: variable 'prot' set but not used [-Wunused-but-set-variable]
>      1140 |  pgprot_t prot, protnone;
>           |           ^~~~
> 

Please ignore these build warnings raised against v2 series because all of them
should have been fixed in v3 series.

Thanks,
Gavin

> 
> vim +/pud +445 mm/debug_vm_pgtable.c
> 
> 5fe77be6bf14bf Shixin Liu        2021-06-30  442
> 69db26024e6bd4 Gavin Shan        2021-07-19  443  static void __init pud_huge_tests(struct pgtable_debug_args *args)
> a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  444  {
> 5fe77be6bf14bf Shixin Liu        2021-06-30 @445  	pud_t pud;
> 5fe77be6bf14bf Shixin Liu        2021-06-30  446
> 69db26024e6bd4 Gavin Shan        2021-07-19  447  	if (!arch_vmap_pud_supported(args->page_prot))
> 5fe77be6bf14bf Shixin Liu        2021-06-30  448  		return;
> 5fe77be6bf14bf Shixin Liu        2021-06-30  449
> 5fe77be6bf14bf Shixin Liu        2021-06-30  450  	pr_debug("Validating PUD huge\n");
> 5fe77be6bf14bf Shixin Liu        2021-06-30  451  	/*
> 5fe77be6bf14bf Shixin Liu        2021-06-30  452  	 * X86 defined pud_set_huge() verifies that the given
> 5fe77be6bf14bf Shixin Liu        2021-06-30  453  	 * PUD is not a populated non-leaf entry.
> 5fe77be6bf14bf Shixin Liu        2021-06-30  454  	 */
> 69db26024e6bd4 Gavin Shan        2021-07-19  455  	WRITE_ONCE(*(args->pudp), __pud(0));
> 69db26024e6bd4 Gavin Shan        2021-07-19  456  	WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn),
> 69db26024e6bd4 Gavin Shan        2021-07-19  457  			      args->page_prot));
> 69db26024e6bd4 Gavin Shan        2021-07-19  458  	WARN_ON(!pud_clear_huge(args->pudp));
> 69db26024e6bd4 Gavin Shan        2021-07-19  459  	pud = READ_ONCE(*(args->pudp));
> a5c3b9ffb0f404 Anshuman Khandual 2020-08-06  460  }
> 5fe77be6bf14bf Shixin Liu        2021-06-30  461  #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
> 54b1f4b50ddb0f Gavin Shan        2021-07-19  462  static void __init pmd_huge_tests(struct pgtable_debug_args *args) { }
> 69db26024e6bd4 Gavin Shan        2021-07-19  463  static void __init pud_huge_tests(struct pgtable_debug_args *args) { }
> 5fe77be6bf14bf Shixin Liu        2021-06-30  464  #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
> 399145f9eb6c67 Anshuman Khandual 2020-06-04  465
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
diff mbox series

Patch

diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
index 04c8d6102695..ebe79ad3cd29 100644
--- a/mm/debug_vm_pgtable.c
+++ b/mm/debug_vm_pgtable.c
@@ -338,55 +338,55 @@  static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx)
 	WARN_ON(!pud_bad(pud_mkhuge(pud)));
 }
 
-static void __init pud_advanced_tests(struct mm_struct *mm,
-				      struct vm_area_struct *vma, pud_t *pudp,
-				      unsigned long pfn, unsigned long vaddr,
-				      pgprot_t prot)
+static void __init pud_advanced_tests(struct pgtable_debug_args *args)
 {
+	unsigned long vaddr = (args->vaddr & HPAGE_PUD_MASK);
 	pud_t pud;
 
 	if (!has_transparent_hugepage())
 		return;
 
 	pr_debug("Validating PUD advanced\n");
-	/* Align the address wrt HPAGE_PUD_SIZE */
-	vaddr &= HPAGE_PUD_MASK;
+	if (args->pud_pfn == ULONG_MAX) {
+		pr_debug("%s: Skipped\n", __func__);
+		return;
+	}
 
-	pud = pfn_pud(pfn, prot);
-	set_pud_at(mm, vaddr, pudp, pud);
-	pudp_set_wrprotect(mm, vaddr, pudp);
-	pud = READ_ONCE(*pudp);
+	pud = pfn_pud(args->pud_pfn, args->page_prot);
+	set_pud_at(args->mm, vaddr, args->pudp, pud);
+	pudp_set_wrprotect(args->mm, vaddr, args->pudp);
+	pud = READ_ONCE(*(args->pudp));
 	WARN_ON(pud_write(pud));
 
 #ifndef __PAGETABLE_PMD_FOLDED
-	pudp_huge_get_and_clear(mm, vaddr, pudp);
-	pud = READ_ONCE(*pudp);
+	pudp_huge_get_and_clear(args->mm, vaddr, args->pudp);
+	pud = READ_ONCE(*(args->pudp));
 	WARN_ON(!pud_none(pud));
 #endif /* __PAGETABLE_PMD_FOLDED */
-	pud = pfn_pud(pfn, prot);
+	pud = pfn_pud(args->pud_pfn, args->page_prot);
 	pud = pud_wrprotect(pud);
 	pud = pud_mkclean(pud);
-	set_pud_at(mm, vaddr, pudp, pud);
+	set_pud_at(args->mm, vaddr, args->pudp, pud);
 	pud = pud_mkwrite(pud);
 	pud = pud_mkdirty(pud);
-	pudp_set_access_flags(vma, vaddr, pudp, pud, 1);
-	pud = READ_ONCE(*pudp);
+	pudp_set_access_flags(args->vma, vaddr, args->pudp, pud, 1);
+	pud = READ_ONCE(*(args->pudp));
 	WARN_ON(!(pud_write(pud) && pud_dirty(pud)));
 
 #ifndef __PAGETABLE_PMD_FOLDED
-	pudp_huge_get_and_clear_full(mm, vaddr, pudp, 1);
-	pud = READ_ONCE(*pudp);
+	pudp_huge_get_and_clear_full(args->mm, vaddr, args->pudp, 1);
+	pud = READ_ONCE(*(args->pudp));
 	WARN_ON(!pud_none(pud));
 #endif /* __PAGETABLE_PMD_FOLDED */
 
-	pud = pfn_pud(pfn, prot);
+	pud = pfn_pud(args->pud_pfn, args->page_prot);
 	pud = pud_mkyoung(pud);
-	set_pud_at(mm, vaddr, pudp, pud);
-	pudp_test_and_clear_young(vma, vaddr, pudp);
-	pud = READ_ONCE(*pudp);
+	set_pud_at(args->mm, vaddr, args->pudp, pud);
+	pudp_test_and_clear_young(args->vma, vaddr, args->pudp);
+	pud = READ_ONCE(*(args->pudp));
 	WARN_ON(pud_young(pud));
 
-	pudp_huge_get_and_clear(mm, vaddr, pudp);
+	pudp_huge_get_and_clear(args->mm, vaddr, args->pudp);
 }
 
 static void __init pud_leaf_tests(struct pgtable_debug_args *args)
@@ -406,24 +406,14 @@  static void __init pud_leaf_tests(struct pgtable_debug_args *args)
 }
 #else  /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { }
-static void __init pud_advanced_tests(struct mm_struct *mm,
-				      struct vm_area_struct *vma, pud_t *pudp,
-				      unsigned long pfn, unsigned long vaddr,
-				      pgprot_t prot)
-{
-}
+static void __init pud_advanced_tests(struct pgtable_debug_args *args) { }
 static void __init pud_leaf_tests(struct pgtable_debug_args *args) { }
 #endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
 #else  /* !CONFIG_TRANSPARENT_HUGEPAGE */
 static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx) { }
 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { }
 static void __init pmd_advanced_tests(struct pgtable_debug_args *args) { }
-static void __init pud_advanced_tests(struct mm_struct *mm,
-				      struct vm_area_struct *vma, pud_t *pudp,
-				      unsigned long pfn, unsigned long vaddr,
-				      pgprot_t prot)
-{
-}
+static void __init pud_advanced_tests(struct pgtable_debug_args *args) { }
 static void __init pmd_leaf_tests(struct pgtable_debug_args *args) { }
 static void __init pud_leaf_tests(struct pgtable_debug_args *args) { }
 static void __init pmd_savedwrite_tests(struct pgtable_debug_args *args) { }
@@ -450,11 +440,11 @@  static void __init pmd_huge_tests(struct pgtable_debug_args *args)
 	WARN_ON(!pmd_none(pmd));
 }
 
-static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot)
+static void __init pud_huge_tests(struct pgtable_debug_args *args)
 {
 	pud_t pud;
 
-	if (!arch_vmap_pud_supported(prot))
+	if (!arch_vmap_pud_supported(args->page_prot))
 		return;
 
 	pr_debug("Validating PUD huge\n");
@@ -462,15 +452,15 @@  static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot)
 	 * X86 defined pud_set_huge() verifies that the given
 	 * PUD is not a populated non-leaf entry.
 	 */
-	WRITE_ONCE(*pudp, __pud(0));
-	WARN_ON(!pud_set_huge(pudp, __pfn_to_phys(pfn), prot));
-	WARN_ON(!pud_clear_huge(pudp));
-	pud = READ_ONCE(*pudp);
-	WARN_ON(!pud_none(pud));
+	WRITE_ONCE(*(args->pudp), __pud(0));
+	WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn),
+			      args->page_prot));
+	WARN_ON(!pud_clear_huge(args->pudp));
+	pud = READ_ONCE(*(args->pudp));
 }
 #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
 static void __init pmd_huge_tests(struct pgtable_debug_args *args) { }
-static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot) { }
+static void __init pud_huge_tests(struct pgtable_debug_args *args) { }
 #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
 
 static void __init p4d_basic_tests(void)
@@ -492,27 +482,26 @@  static void __init pgd_basic_tests(void)
 }
 
 #ifndef __PAGETABLE_PUD_FOLDED
-static void __init pud_clear_tests(struct mm_struct *mm, pud_t *pudp)
+static void __init pud_clear_tests(struct pgtable_debug_args *args)
 {
-	pud_t pud = READ_ONCE(*pudp);
+	pud_t pud = READ_ONCE(*(args->pudp));
 
-	if (mm_pmd_folded(mm))
+	if (mm_pmd_folded(args->mm))
 		return;
 
 	pr_debug("Validating PUD clear\n");
 	pud = __pud(pud_val(pud) | RANDOM_ORVALUE);
-	WRITE_ONCE(*pudp, pud);
-	pud_clear(pudp);
-	pud = READ_ONCE(*pudp);
+	WRITE_ONCE(*(args->pudp), pud);
+	pud_clear(args->pudp);
+	pud = READ_ONCE(*(args->pudp));
 	WARN_ON(!pud_none(pud));
 }
 
-static void __init pud_populate_tests(struct mm_struct *mm, pud_t *pudp,
-				      pmd_t *pmdp)
+static void __init pud_populate_tests(struct pgtable_debug_args *args)
 {
 	pud_t pud;
 
-	if (mm_pmd_folded(mm))
+	if (mm_pmd_folded(args->mm))
 		return;
 
 	pr_debug("Validating PUD populate\n");
@@ -520,16 +509,13 @@  static void __init pud_populate_tests(struct mm_struct *mm, pud_t *pudp,
 	 * This entry points to next level page table page.
 	 * Hence this must not qualify as pud_bad().
 	 */
-	pud_populate(mm, pudp, pmdp);
-	pud = READ_ONCE(*pudp);
+	pud_populate(args->mm, args->pudp, args->start_pmdp);
+	pud = READ_ONCE(*(args->pudp));
 	WARN_ON(pud_bad(pud));
 }
 #else  /* !__PAGETABLE_PUD_FOLDED */
-static void __init pud_clear_tests(struct mm_struct *mm, pud_t *pudp) { }
-static void __init pud_populate_tests(struct mm_struct *mm, pud_t *pudp,
-				      pmd_t *pmdp)
-{
-}
+static void __init pud_clear_tests(struct pgtable_debug_args *args) { }
+static void __init pud_populate_tests(struct pgtable_debug_args *args) { }
 #endif /* PAGETABLE_PUD_FOLDED */
 
 #ifndef __PAGETABLE_P4D_FOLDED
@@ -1292,11 +1278,11 @@  static int __init debug_vm_pgtable(void)
 	pmd_populate_tests(&args);
 	spin_unlock(ptl);
 
-	ptl = pud_lock(mm, pudp);
-	pud_clear_tests(mm, pudp);
-	pud_advanced_tests(mm, vma, pudp, pud_aligned, vaddr, prot);
-	pud_huge_tests(pudp, pud_aligned, prot);
-	pud_populate_tests(mm, pudp, saved_pmdp);
+	ptl = pud_lock(args.mm, args.pudp);
+	pud_clear_tests(&args);
+	pud_advanced_tests(&args);
+	pud_huge_tests(&args);
+	pud_populate_tests(&args);
 	spin_unlock(ptl);
 
 	spin_lock(&mm->page_table_lock);