[PATCH V13] mm/debug: Add tests validating architecture page table helpers
This adds tests which will validate architecture page table helpers and other accessors in their compliance with expected generic MM semantics. This will help various architectures in validating changes to existing page table helpers or addition of new ones. This test covers basic page table entry transformations including but not limited to old, young, dirty, clean, write, write protect etc at various level along with populating intermediate entries with next page table page and validating them. Test page table pages are allocated from system memory with required size and alignments. The mapped pfns at page table levels are derived from a real pfn representing a valid kernel text symbol. This test gets called inside kernel_init() right after async_synchronize_full(). This test gets built and run when CONFIG_DEBUG_VM_PGTABLE is selected. Any architecture, which is willing to subscribe this test will need to select ARCH_HAS_DEBUG_VM_PGTABLE. For now this is limited to arc, arm64, x86, s390 and ppc32 platforms where the test is known to build and run successfully. Going forward, other architectures too can subscribe the test after fixing any build or runtime problems with their page table helpers. Meanwhile for better platform coverage, the test can also be enabled with CONFIG_EXPERT even without ARCH_HAS_DEBUG_VM_PGTABLE. Folks interested in making sure that a given platform's page table helpers conform to expected generic MM semantics should enable the above config which will just trigger this test during boot. Any non conformity here will be reported as an warning which would need to be fixed. This test will help catch any changes to the agreed upon semantics expected from generic MM and enable platforms to accommodate it thereafter. Cc: Andrew Morton Cc: Vlastimil Babka Cc: Greg Kroah-Hartman Cc: Thomas Gleixner Cc: Mike Rapoport Cc: Jason Gunthorpe Cc: Dan Williams Cc: Peter Zijlstra Cc: Michal Hocko Cc: Mark Rutland Cc: Mark Brown Cc: Steven Price Cc: Ard Biesheuvel Cc: Masahiro Yamada Cc: Kees Cook Cc: Tetsuo Handa Cc: Matthew Wilcox Cc: Dave Hansen Cc: Russell King - ARM Linux Cc: Michael Ellerman Cc: Paul Mackerras Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: "David S. Miller" Cc: Vineet Gupta Cc: James Hogan Cc: Paul Burton Cc: Ralf Baechle Cc: Kirill A. Shutemov Cc: Gerald Schaefer Cc: Christophe Leroy Cc: Ingo Molnar Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Mark Salter Cc: Aurelien Jacquiot Cc: Yoshinori Sato Cc: Brian Cain Cc: Geert Uytterhoeven Cc: Michal Simek Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Guan Xuetao Cc: Chris Zankel Cc: Max Filippov Cc: Qian Cai Cc: linux-al...@vger.kernel.org Cc: linux-c6x-...@linux-c6x.org Cc: uclinux-h8-de...@lists.sourceforge.jp Cc: linux-hexa...@vger.kernel.org Cc: linux-m...@lists.linux-m68k.org Cc: linux-ri...@lists.infradead.org Cc: linux-xte...@linux-xtensa.org Cc: linux-snps-...@lists.infradead.org Cc: linux-m...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-i...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-s...@vger.kernel.org Cc: linux...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: x...@kernel.org Cc: linux-ker...@vger.kernel.org Suggested-by: Catalin Marinas Reviewed-by: Ingo Molnar Tested-by: Gerald Schaefer # s390 Tested-by: Christophe Leroy# ppc32 Signed-off-by: Andrew Morton Signed-off-by: Christophe Leroy Signed-off-by: Anshuman Khandual --- This adds a test validation for architecture exported page table helpers. Patch adds basic transformation tests at various levels of the page table. This test was originally suggested by Catalin during arm64 THP migration RFC discussion earlier. Going forward it can include more specific tests with respect to various generic MM functions like THP, HugeTLB etc and platform specific tests. https://lore.kernel.org/linux-mm/20190628102003.ga56...@arrakis.emea.arm.com/ Needs to be applied on linux V5.5 Changes in V13: - Subscribed s390 platform and updated debug-vm-pgtable/arch-support.txt per Gerald - Dropped keyword 'extern' from debug_vm_pgtable() declaration per Christophe - Moved debug_vm_pgtable() declarations to per Christophe - Moved debug_vm_pgtable() call site into kernel_init() per Christophe - Changed CONFIG_DEBUG_VM_PGTABLE rules per Christophe - Updated commit to include new supported platforms and changed config selection Changes in V12: (https://patchwork.kernel.org/project/linux-mm/list/?series=233905) - Replaced __mmdrop() with mmdrop() - Enable ARCH_HAS_DEBUG_VM_PGTABLE on X86 for non CONFIG_X86_PAE platforms as the test procedure interfere with pre-allocated PMDs attached to the PGD resulting in runtime failures with VM_BUG_ON() Changes in V11: (https://patchwork.kernel.org/project/linux-mm/list/?series=221135) - Rebased the patch on V5.4 Changes in V10: (https://patchwork.kernel.org/project/linux-mm/list/?series=205529) - Always enable DEBUG_VM_PG
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
Hi Anshuman, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on s390/features linus/master arc/for-next v5.5] [cannot apply to mmotm/master tip/x86/core arm64/for-next/core next-20200205] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 7.5.0 reproduce: 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 GCC_VERSION=7.5.0 make.cross ARCH=ia64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot All error/warnings (new ones prefixed by >>): In file included from include/asm-generic/pgtable-nopud.h:8:0, from arch/ia64/include/asm/pgtable.h:586, from include/linux/mm.h:99, from include/linux/highmem.h:8, from mm/debug_vm_pgtable.c:14: mm/debug_vm_pgtable.c: In function 'pud_clear_tests': >> include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit declaration >> of function '__pgd'; did you mean '__p4d'? >> [-Werror=implicit-function-declaration] #define __pud(x)((pud_t) { __pgd(x) }) ^ >> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ >> include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing braces >> around initializer [-Wmissing-braces] #define __pud(x)((pud_t) { __pgd(x) }) ^ >> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ cc1: some warnings being treated as errors vim +47 include/asm-generic/pgtable-nop4d-hack.h 30ec842660bd0d Kirill A. Shutemov 2017-03-09 45 30ec842660bd0d Kirill A. Shutemov 2017-03-09 46 #define pud_val(x) (pgd_val((x).pgd)) 30ec842660bd0d Kirill A. Shutemov 2017-03-09 @47 #define __pud(x) ((pud_t) { __pgd(x) }) 30ec842660bd0d Kirill A. Shutemov 2017-03-09 48 :: The code at line 47 was first introduced by commit :: 30ec842660bd0d056d4a7028ac5bd4a82b113d4f asm-generic: introduce __ARCH_USE_5LEVEL_HACK :: TO: Kirill A. Shutemov :: CC: Linus Torvalds --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org Intel Corporation .config.gz Description: application/gzip
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
On 02/06/2020 04:40 AM, kbuild test robot wrote: > Hi Anshuman, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on powerpc/next] > [also build test ERROR on s390/features linus/master arc/for-next v5.5] > [cannot apply to mmotm/master tip/x86/core arm64/for-next/core next-20200205] > [if your patch is applied to the wrong git tree, please drop us a note to help > improve the system. BTW, we also suggest to use '--base' option to specify the > base tree in git format-patch, please see > https://stackoverflow.com/a/37406982] > > url: > https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 > base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next > config: ia64-allmodconfig (attached as .config) > compiler: ia64-linux-gcc (GCC) 7.5.0 > reproduce: > 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 > GCC_VERSION=7.5.0 make.cross ARCH=ia64 > > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot > > All error/warnings (new ones prefixed by >>): > >In file included from include/asm-generic/pgtable-nopud.h:8:0, > from arch/ia64/include/asm/pgtable.h:586, > from include/linux/mm.h:99, > from include/linux/highmem.h:8, > from mm/debug_vm_pgtable.c:14: >mm/debug_vm_pgtable.c: In function 'pud_clear_tests': >>> include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit declaration >>> of function '__pgd'; did you mean '__p4d'? >>> [-Werror=implicit-function-declaration] > #define __pud(x)((pud_t) { __pgd(x) }) >^ >>> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' > pud = __pud(pud_val(pud) | RANDOM_ORVALUE); >^ >>> include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing braces >>> around initializer [-Wmissing-braces] > #define __pud(x)((pud_t) { __pgd(x) }) > ^ >>> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' > pud = __pud(pud_val(pud) | RANDOM_ORVALUE); >^ >cc1: some warnings being treated as errors This build failure is expected now given that we have allowed DEBUG_VM_PGTABLE with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. This problem i.e build failure caused without a platform __pgd(), is known to exist both on ia64 and arm (32bit) platforms. Please refer https://lkml.org/lkml/2019/9/24/314 for details where this was discussed earlier. - Anshuman
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
On Thu, 6 Feb 2020 13:49:35 +0530 Anshuman Khandual wrote: > > On 02/06/2020 04:40 AM, kbuild test robot wrote: > > Hi Anshuman, > > > > Thank you for the patch! Yet something to improve: > > > > [auto build test ERROR on powerpc/next] > > [also build test ERROR on s390/features linus/master arc/for-next v5.5] > > [cannot apply to mmotm/master tip/x86/core arm64/for-next/core > > next-20200205] > > [if your patch is applied to the wrong git tree, please drop us a note to > > help > > improve the system. BTW, we also suggest to use '--base' option to specify > > the > > base tree in git format-patch, please see > > https://stackoverflow.com/a/37406982] > > > > url: > > https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > > next > > config: ia64-allmodconfig (attached as .config) > > compiler: ia64-linux-gcc (GCC) 7.5.0 > > reproduce: > > 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 > > GCC_VERSION=7.5.0 make.cross ARCH=ia64 > > > > If you fix the issue, kindly add following tag > > Reported-by: kbuild test robot > > > > All error/warnings (new ones prefixed by >>): > > > >In file included from include/asm-generic/pgtable-nopud.h:8:0, > > from arch/ia64/include/asm/pgtable.h:586, > > from include/linux/mm.h:99, > > from include/linux/highmem.h:8, > > from mm/debug_vm_pgtable.c:14: > >mm/debug_vm_pgtable.c: In function 'pud_clear_tests': > >>> include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit > >>> declaration of function '__pgd'; did you mean '__p4d'? > >>> [-Werror=implicit-function-declaration] > > #define __pud(x)((pud_t) { __pgd(x) }) > >^ > >>> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' > > pud = __pud(pud_val(pud) | RANDOM_ORVALUE); > >^ > >>> include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing braces > >>> around initializer [-Wmissing-braces] > > #define __pud(x)((pud_t) { __pgd(x) }) > > ^ > >>> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' > > pud = __pud(pud_val(pud) | RANDOM_ORVALUE); > >^ > >cc1: some warnings being treated as errors > > This build failure is expected now given that we have allowed DEBUG_VM_PGTABLE > with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. This problem > i.e build failure caused without a platform __pgd(), is known to exist both on > ia64 and arm (32bit) platforms. Please refer > https://lkml.org/lkml/2019/9/24/314 > for details where this was discussed earlier. > I'd prefer not to merge a patch which is known to cause build regressions. Is there some temporary thing we can do to prevent these errors until arch maintainers(?) get around to implementing the long-term fixes?
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
On 02/10/2020 10:22 AM, Andrew Morton wrote: > On Thu, 6 Feb 2020 13:49:35 +0530 Anshuman Khandual > wrote: > >> >> On 02/06/2020 04:40 AM, kbuild test robot wrote: >>> Hi Anshuman, >>> >>> Thank you for the patch! Yet something to improve: >>> >>> [auto build test ERROR on powerpc/next] >>> [also build test ERROR on s390/features linus/master arc/for-next v5.5] >>> [cannot apply to mmotm/master tip/x86/core arm64/for-next/core >>> next-20200205] >>> [if your patch is applied to the wrong git tree, please drop us a note to >>> help >>> improve the system. BTW, we also suggest to use '--base' option to specify >>> the >>> base tree in git format-patch, please see >>> https://stackoverflow.com/a/37406982] >>> >>> url: >>> https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 >>> base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git >>> next >>> config: ia64-allmodconfig (attached as .config) >>> compiler: ia64-linux-gcc (GCC) 7.5.0 >>> reproduce: >>> 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 >>> GCC_VERSION=7.5.0 make.cross ARCH=ia64 >>> >>> If you fix the issue, kindly add following tag >>> Reported-by: kbuild test robot >>> >>> All error/warnings (new ones prefixed by >>): >>> >>>In file included from include/asm-generic/pgtable-nopud.h:8:0, >>> from arch/ia64/include/asm/pgtable.h:586, >>> from include/linux/mm.h:99, >>> from include/linux/highmem.h:8, >>> from mm/debug_vm_pgtable.c:14: >>>mm/debug_vm_pgtable.c: In function 'pud_clear_tests': > include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit > declaration of function '__pgd'; did you mean '__p4d'? > [-Werror=implicit-function-declaration] >>> #define __pud(x)((pud_t) { __pgd(x) }) >>>^ > mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' >>> pud = __pud(pud_val(pud) | RANDOM_ORVALUE); >>>^ > include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing braces > around initializer [-Wmissing-braces] >>> #define __pud(x)((pud_t) { __pgd(x) }) >>> ^ > mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' >>> pud = __pud(pud_val(pud) | RANDOM_ORVALUE); >>>^ >>>cc1: some warnings being treated as errors >> >> This build failure is expected now given that we have allowed >> DEBUG_VM_PGTABLE >> with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. This >> problem >> i.e build failure caused without a platform __pgd(), is known to exist both >> on >> ia64 and arm (32bit) platforms. Please refer >> https://lkml.org/lkml/2019/9/24/314 >> for details where this was discussed earlier. >> > > I'd prefer not to merge a patch which is known to cause build > regressions. Is there some temporary thing we can do to prevent these > errors until arch maintainers(?) get around to implementing the > long-term fixes? We could explicitly disable CONFIG_DEBUG_VM_PGTABLE on ia64 and arm platforms which will ensure that others can still use the EXPERT path. config DEBUG_VM_PGTABLE bool "Debug arch page table for semantics compliance" depends on MMU depends on !(IA64 || ARM) depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT default n if !ARCH_HAS_DEBUG_VM_PGTABLE default y if DEBUG_VM
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
Le 10/02/2020 à 06:35, Anshuman Khandual a écrit : On 02/10/2020 10:22 AM, Andrew Morton wrote: On Thu, 6 Feb 2020 13:49:35 +0530 Anshuman Khandual wrote: On 02/06/2020 04:40 AM, kbuild test robot wrote: Hi Anshuman, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on s390/features linus/master arc/for-next v5.5] [cannot apply to mmotm/master tip/x86/core arm64/for-next/core next-20200205] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 7.5.0 reproduce: 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 GCC_VERSION=7.5.0 make.cross ARCH=ia64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot All error/warnings (new ones prefixed by >>): In file included from include/asm-generic/pgtable-nopud.h:8:0, from arch/ia64/include/asm/pgtable.h:586, from include/linux/mm.h:99, from include/linux/highmem.h:8, from mm/debug_vm_pgtable.c:14: mm/debug_vm_pgtable.c: In function 'pud_clear_tests': include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit declaration of function '__pgd'; did you mean '__p4d'? [-Werror=implicit-function-declaration] #define __pud(x)((pud_t) { __pgd(x) }) ^ mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing braces around initializer [-Wmissing-braces] #define __pud(x)((pud_t) { __pgd(x) }) ^ mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ cc1: some warnings being treated as errors This build failure is expected now given that we have allowed DEBUG_VM_PGTABLE with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. This problem i.e build failure caused without a platform __pgd(), is known to exist both on ia64 and arm (32bit) platforms. Please refer https://lkml.org/lkml/2019/9/24/314 for details where this was discussed earlier. I'd prefer not to merge a patch which is known to cause build regressions. Is there some temporary thing we can do to prevent these errors until arch maintainers(?) get around to implementing the long-term fixes? We could explicitly disable CONFIG_DEBUG_VM_PGTABLE on ia64 and arm platforms which will ensure that others can still use the EXPERT path. config DEBUG_VM_PGTABLE bool "Debug arch page table for semantics compliance" depends on MMU depends on !(IA64 || ARM) depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT default n if !ARCH_HAS_DEBUG_VM_PGTABLE default y if DEBUG_VM On both ia32 and arm, the fix is trivial. Can we include the fix within this patch, just the same way as the mm_p4d_folded() fix for x86 ? Christophe
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
On Mon, Feb 10, 2020 at 07:38:38AM +0100, Christophe Leroy wrote: > > > Le 10/02/2020 à 06:35, Anshuman Khandual a écrit : > > > > > > On 02/10/2020 10:22 AM, Andrew Morton wrote: > > > On Thu, 6 Feb 2020 13:49:35 +0530 Anshuman Khandual > > > wrote: > > > > > > > > > > > On 02/06/2020 04:40 AM, kbuild test robot wrote: > > > > > Hi Anshuman, > > > > > > > > > > Thank you for the patch! Yet something to improve: > > > > > > > > > > [auto build test ERROR on powerpc/next] > > > > > [also build test ERROR on s390/features linus/master arc/for-next > > > > > v5.5] > > > > > [cannot apply to mmotm/master tip/x86/core arm64/for-next/core > > > > > next-20200205] > > > > > [if your patch is applied to the wrong git tree, please drop us a > > > > > note to help > > > > > improve the system. BTW, we also suggest to use '--base' option to > > > > > specify the > > > > > base tree in git format-patch, please see > > > > > https://stackoverflow.com/a/37406982] > > > > > > > > > > url: > > > > > https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 > > > > > base: > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next > > > > > config: ia64-allmodconfig (attached as .config) > > > > > compiler: ia64-linux-gcc (GCC) 7.5.0 > > > > > reproduce: > > > > > 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 > > > > > GCC_VERSION=7.5.0 make.cross ARCH=ia64 > > > > > > > > > > If you fix the issue, kindly add following tag > > > > > Reported-by: kbuild test robot > > > > > > > > > > All error/warnings (new ones prefixed by >>): > > > > > > > > > > In file included from include/asm-generic/pgtable-nopud.h:8:0, > > > > > from arch/ia64/include/asm/pgtable.h:586, > > > > > from include/linux/mm.h:99, > > > > > from include/linux/highmem.h:8, > > > > > from mm/debug_vm_pgtable.c:14: > > > > > mm/debug_vm_pgtable.c: In function 'pud_clear_tests': > > > > > > > include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit > > > > > > > declaration of function '__pgd'; did you mean '__p4d'? > > > > > > > [-Werror=implicit-function-declaration] > > > > > #define __pud(x)((pud_t) { __pgd(x) }) > > > > > ^ > > > > > > > mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' > > > > > pud = __pud(pud_val(pud) | RANDOM_ORVALUE); > > > > > ^ > > > > > > > include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing > > > > > > > braces around initializer [-Wmissing-braces] > > > > > #define __pud(x)((pud_t) { __pgd(x) }) > > > > > ^ > > > > > > > mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' > > > > > pud = __pud(pud_val(pud) | RANDOM_ORVALUE); > > > > > ^ > > > > > cc1: some warnings being treated as errors > > > > > > > > This build failure is expected now given that we have allowed > > > > DEBUG_VM_PGTABLE > > > > with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. This > > > > problem > > > > i.e build failure caused without a platform __pgd(), is known to exist > > > > both on > > > > ia64 and arm (32bit) platforms. Please refer > > > > https://lkml.org/lkml/2019/9/24/314 > > > > for details where this was discussed earlier. > > > > > > > > > > I'd prefer not to merge a patch which is known to cause build > > > regressions. Is there some temporary thing we can do to prevent these > > > errors until arch maintainers(?) get around to implementing the > > > long-term fixes? > > > > We could explicitly disable CONFIG_DEBUG_VM_PGTABLE on ia64 and arm > > platforms > > which will ensure that others can still use the EXPERT path. > > > > config DEBUG_VM_PGTABLE > > bool "Debug arch page table for semantics compliance" > > depends on MMU > > depends on !(IA64 || ARM) > > depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT > > default n if !ARCH_HAS_DEBUG_VM_PGTABLE > > default y if DEBUG_VM > > > > On both ia32 and arm, the fix is trivial. > > Can we include the fix within this patch, just the same way as the > mm_p4d_folded() fix for x86 ? Why should arm include a macro for something that nothing (apart from this checker) requires? If the checker requires it but the rest of the kernel does not, it suggests that the checker isn't actually correct, and the results can't be relied upon. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
Le 10/02/2020 à 11:02, Russell King - ARM Linux admin a écrit : On Mon, Feb 10, 2020 at 07:38:38AM +0100, Christophe Leroy wrote: Le 10/02/2020 à 06:35, Anshuman Khandual a écrit : On 02/10/2020 10:22 AM, Andrew Morton wrote: On Thu, 6 Feb 2020 13:49:35 +0530 Anshuman Khandual wrote: On 02/06/2020 04:40 AM, kbuild test robot wrote: Hi Anshuman, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on s390/features linus/master arc/for-next v5.5] [cannot apply to mmotm/master tip/x86/core arm64/for-next/core next-20200205] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 7.5.0 reproduce: 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 GCC_VERSION=7.5.0 make.cross ARCH=ia64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot All error/warnings (new ones prefixed by >>): In file included from include/asm-generic/pgtable-nopud.h:8:0, from arch/ia64/include/asm/pgtable.h:586, from include/linux/mm.h:99, from include/linux/highmem.h:8, from mm/debug_vm_pgtable.c:14: mm/debug_vm_pgtable.c: In function 'pud_clear_tests': include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit declaration of function '__pgd'; did you mean '__p4d'? [-Werror=implicit-function-declaration] #define __pud(x)((pud_t) { __pgd(x) }) ^ mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing braces around initializer [-Wmissing-braces] #define __pud(x)((pud_t) { __pgd(x) }) ^ mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ cc1: some warnings being treated as errors This build failure is expected now given that we have allowed DEBUG_VM_PGTABLE with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. This problem i.e build failure caused without a platform __pgd(), is known to exist both on ia64 and arm (32bit) platforms. Please refer https://lkml.org/lkml/2019/9/24/314 for details where this was discussed earlier. I'd prefer not to merge a patch which is known to cause build regressions. Is there some temporary thing we can do to prevent these errors until arch maintainers(?) get around to implementing the long-term fixes? We could explicitly disable CONFIG_DEBUG_VM_PGTABLE on ia64 and arm platforms which will ensure that others can still use the EXPERT path. config DEBUG_VM_PGTABLE bool "Debug arch page table for semantics compliance" depends on MMU depends on !(IA64 || ARM) depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT default n if !ARCH_HAS_DEBUG_VM_PGTABLE default y if DEBUG_VM On both ia32 and arm, the fix is trivial. Can we include the fix within this patch, just the same way as the mm_p4d_folded() fix for x86 ? Why should arm include a macro for something that nothing (apart from this checker) requires? If the checker requires it but the rest of the kernel does not, it suggests that the checker isn't actually correct, and the results can't be relied upon. As far as I can see, the problem is that arm opencodes part of the API instead of including asm-generic/pgtable-nopmd.h Here, the ARM has 2 levels, ie only PGD and PTE. But instead of defining __pgd and __pte and getting everything else from asm-generic, it defines a __pmd then redefines the folded levels like the pud, etc ... That's exactly what the checker aims at detecting: architectures than do not properly use the standard linux page table structures. Christophe
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
On Mon, Feb 10, 2020 at 11:46:23AM +0100, Christophe Leroy wrote: > > > Le 10/02/2020 à 11:02, Russell King - ARM Linux admin a écrit : > > On Mon, Feb 10, 2020 at 07:38:38AM +0100, Christophe Leroy wrote: > > > > > > > > > Le 10/02/2020 à 06:35, Anshuman Khandual a écrit : > > > > > > > > > > > > On 02/10/2020 10:22 AM, Andrew Morton wrote: > > > > > On Thu, 6 Feb 2020 13:49:35 +0530 Anshuman Khandual > > > > > wrote: > > > > > > > > > > > > > > > > > On 02/06/2020 04:40 AM, kbuild test robot wrote: > > > > > > > Hi Anshuman, > > > > > > > > > > > > > > Thank you for the patch! Yet something to improve: > > > > > > > > > > > > > > [auto build test ERROR on powerpc/next] > > > > > > > [also build test ERROR on s390/features linus/master arc/for-next > > > > > > > v5.5] > > > > > > > [cannot apply to mmotm/master tip/x86/core arm64/for-next/core > > > > > > > next-20200205] > > > > > > > [if your patch is applied to the wrong git tree, please drop us a > > > > > > > note to help > > > > > > > improve the system. BTW, we also suggest to use '--base' option > > > > > > > to specify the > > > > > > > base tree in git format-patch, please see > > > > > > > https://stackoverflow.com/a/37406982] > > > > > > > > > > > > > > url: > > > > > > > https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 > > > > > > > base: > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > > > > > > > next > > > > > > > config: ia64-allmodconfig (attached as .config) > > > > > > > compiler: ia64-linux-gcc (GCC) 7.5.0 > > > > > > > reproduce: > > > > > > > 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 > > > > > > > GCC_VERSION=7.5.0 make.cross ARCH=ia64 > > > > > > > > > > > > > > If you fix the issue, kindly add following tag > > > > > > > Reported-by: kbuild test robot > > > > > > > > > > > > > > All error/warnings (new ones prefixed by >>): > > > > > > > > > > > > > > In file included from > > > > > > > include/asm-generic/pgtable-nopud.h:8:0, > > > > > > > from arch/ia64/include/asm/pgtable.h:586, > > > > > > > from include/linux/mm.h:99, > > > > > > > from include/linux/highmem.h:8, > > > > > > > from mm/debug_vm_pgtable.c:14: > > > > > > > mm/debug_vm_pgtable.c: In function 'pud_clear_tests': > > > > > > > > > include/asm-generic/pgtable-nop4d-hack.h:47:32: error: > > > > > > > > > implicit declaration of function '__pgd'; did you mean > > > > > > > > > '__p4d'? [-Werror=implicit-function-declaration] > > > > > > > #define __pud(x)((pud_t) { __pgd(x) }) > > > > > > > ^ > > > > > > > > > mm/debug_vm_pgtable.c:141:8: note: in expansion of macro > > > > > > > > > '__pud' > > > > > > >pud = __pud(pud_val(pud) | RANDOM_ORVALUE); > > > > > > > ^ > > > > > > > > > include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: > > > > > > > > > missing braces around initializer [-Wmissing-braces] > > > > > > > #define __pud(x)((pud_t) { __pgd(x) }) > > > > > > >^ > > > > > > > > > mm/debug_vm_pgtable.c:141:8: note: in expansion of macro > > > > > > > > > '__pud' > > > > > > >pud = __pud(pud_val(pud) | RANDOM_ORVALUE); > > > > > > > ^ > > > > > > > cc1: some warnings being treated as errors > > > > > > > > > > > > This build failure is expected now given that we have allowed > > > > > > DEBUG_VM_PGTABLE > > > > > > with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. > > > > > > This problem > > > > > > i.e build failure caused without a platform __pgd(), is known to > > > > > > exist both on > > > > > > ia64 and arm (32bit) platforms. Please refer > > > > > > https://lkml.org/lkml/2019/9/24/314 > > > > > > for details where this was discussed earlier. > > > > > > > > > > > > > > > > I'd prefer not to merge a patch which is known to cause build > > > > > regressions. Is there some temporary thing we can do to prevent these > > > > > errors until arch maintainers(?) get around to implementing the > > > > > long-term fixes? > > > > > > > > We could explicitly disable CONFIG_DEBUG_VM_PGTABLE on ia64 and arm > > > > platforms > > > > which will ensure that others can still use the EXPERT path. > > > > > > > > config DEBUG_VM_PGTABLE > > > > bool "Debug arch page table for semantics compliance" > > > > depends on MMU > > > > depends on !(IA64 || ARM) > > > > depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT > > > > default n if !ARCH_HAS_DEBUG_VM_PGTABLE > > > > default y if DEBUG_VM >
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
On 02/10/2020 04:36 PM, Russell King - ARM Linux admin wrote: > On Mon, Feb 10, 2020 at 11:46:23AM +0100, Christophe Leroy wrote: >> >> >> Le 10/02/2020 à 11:02, Russell King - ARM Linux admin a écrit : >>> On Mon, Feb 10, 2020 at 07:38:38AM +0100, Christophe Leroy wrote: Le 10/02/2020 à 06:35, Anshuman Khandual a écrit : > > > On 02/10/2020 10:22 AM, Andrew Morton wrote: >> On Thu, 6 Feb 2020 13:49:35 +0530 Anshuman Khandual >> wrote: >> >>> >>> On 02/06/2020 04:40 AM, kbuild test robot wrote: Hi Anshuman, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on s390/features linus/master arc/for-next v5.5] [cannot apply to mmotm/master tip/x86/core arm64/for-next/core next-20200205] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20200205-215507 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 7.5.0 reproduce: 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 GCC_VERSION=7.5.0 make.cross ARCH=ia64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot All error/warnings (new ones prefixed by >>): In file included from include/asm-generic/pgtable-nopud.h:8:0, from arch/ia64/include/asm/pgtable.h:586, from include/linux/mm.h:99, from include/linux/highmem.h:8, from mm/debug_vm_pgtable.c:14: mm/debug_vm_pgtable.c: In function 'pud_clear_tests': >> include/asm-generic/pgtable-nop4d-hack.h:47:32: error: implicit >> declaration of function '__pgd'; did you mean '__p4d'? >> [-Werror=implicit-function-declaration] #define __pud(x)((pud_t) { __pgd(x) }) ^ >> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ >> include/asm-generic/pgtable-nop4d-hack.h:47:22: warning: missing >> braces around initializer [-Wmissing-braces] #define __pud(x)((pud_t) { __pgd(x) }) ^ >> mm/debug_vm_pgtable.c:141:8: note: in expansion of macro '__pud' pud = __pud(pud_val(pud) | RANDOM_ORVALUE); ^ cc1: some warnings being treated as errors >>> >>> This build failure is expected now given that we have allowed >>> DEBUG_VM_PGTABLE >>> with EXPERT without platform requiring ARCH_HAS_DEBUG_VM_PGTABLE. This >>> problem >>> i.e build failure caused without a platform __pgd(), is known to exist >>> both on >>> ia64 and arm (32bit) platforms. Please refer >>> https://lkml.org/lkml/2019/9/24/314 >>> for details where this was discussed earlier. >>> >> >> I'd prefer not to merge a patch which is known to cause build >> regressions. Is there some temporary thing we can do to prevent these >> errors until arch maintainers(?) get around to implementing the >> long-term fixes? > > We could explicitly disable CONFIG_DEBUG_VM_PGTABLE on ia64 and arm > platforms > which will ensure that others can still use the EXPERT path. > > config DEBUG_VM_PGTABLE > bool "Debug arch page table for semantics compliance" > depends on MMU > depends on !(IA64 || ARM) > depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT > default n if !ARCH_HAS_DEBUG_VM_PGTABLE > default y if DEBUG_VM > On both ia32 and arm, the fix is trivial. Can we include the fix within this patch, just the same way as the mm_p4d_folded() fix for x86 ? >>> >>> Why should arm include a macro for something that nothing (apart from >>> this checker) requires? If the checker requires it but the rest of >>> the kernel does not, it suggests that the checker isn't actually >>> correct, and the results can't be relied upon. >>> >> >> As far as I can see, t
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
Le 11/02/2020 à 03:25, Anshuman Khandual a écrit : On 02/10/2020 04:36 PM, Russell King - ARM Linux admin wrote: There are good reasons for the way ARM does stuff. The generic crap was written without regard for the circumstances that ARM has, and thus is entirely unsuitable for 32-bit ARM. Since we dont have an agreement here, lets just settle with disabling the test for now on platforms where the build fails. CONFIG_EXPERT is enabling this test for better adaptability and coverage, hence how about re framing the config like this ? This at the least conveys the fact that EXPERT only works when platform is neither IA64 or ARM. Agreed config DEBUG_VM_PGTABLE bool "Debug arch page table for semantics compliance" depends on MMU depends on ARCH_HAS_DEBUG_VM_PGTABLE || (EXPERT && !(IA64 || ARM)) I think it's maybe better to have a dedicated depends line: depends on !IA64 && !ARM depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT The day arm and/or ia64 is ready for building the test, we can remove that depends. default n if !ARCH_HAS_DEBUG_VM_PGTABLE default y if DEBUG_VM Christophe
Re: [PATCH V13] mm/debug: Add tests validating architecture page table helpers
On Tue, Feb 11, 2020 at 06:33:47AM +0100, Christophe Leroy wrote: > > > Le 11/02/2020 à 03:25, Anshuman Khandual a écrit : > > > > > > On 02/10/2020 04:36 PM, Russell King - ARM Linux admin wrote: > > > There are good reasons for the way ARM does stuff. The generic crap was > > > written without regard for the circumstances that ARM has, and thus is > > > entirely unsuitable for 32-bit ARM. > > > > Since we dont have an agreement here, lets just settle with disabling the > > test for now on platforms where the build fails. CONFIG_EXPERT is enabling > > this test for better adaptability and coverage, hence how about re framing > > the config like this ? This at the least conveys the fact that EXPERT only > > works when platform is neither IA64 or ARM. > > Agreed > > > > > config DEBUG_VM_PGTABLE > > bool "Debug arch page table for semantics compliance" > > depends on MMU > > depends on ARCH_HAS_DEBUG_VM_PGTABLE || (EXPERT && !(IA64 || ARM)) > > I think it's maybe better to have a dedicated depends line: > > depends on !IA64 && !ARM > depends on ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT > > The day arm and/or ia64 is ready for building the test, we can remove that > depends. Never going to happen as its technically infeasible, sorry. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up