Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1596077

Re: [PATCH 6/7] mm: convert generic code to 5-level paging

From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCH 6/7] mm: convert generic code to 5-level paging
Date 2017-03-09 15:00 +0100
Message-ID <tj6LL-5W9-5@gated-at.bofh.it> (permalink)
References (2 earlier) <tiKid-7jK-3@gated-at.bofh.it> <tiLHk-8qM-29@gated-at.bofh.it> <tj31w-3pp-19@gated-at.bofh.it> <tj4JY-4BF-39@gated-at.bofh.it> <tj5mG-56r-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Mar 09, 2017 at 01:20:30PM +0100, Michal Hocko wrote:
> On Thu 09-03-17 14:47:16, Kirill A. Shutemov wrote:
> > On Thu, Mar 09, 2017 at 10:54:15AM +0100, Michal Hocko wrote:
> > > On Wed 08-03-17 18:21:30, Kirill A. Shutemov wrote:
> [...]
> > > > We can drop the hack once all architectures that support kasan would be
> > > > converted to pgtable-nop4d.h -- amd64 and x86 at the moment.
> > > 
> > > But those architectures even do not enable kasan
> > > $ git grep "select *HAVE_ARCH_KASAN"
> > > arch/arm64/Kconfig:     select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP && !(ARM64_16K_PAGES && ARM64_VA_BITS_48)
> > > arch/x86/Kconfig:       select HAVE_ARCH_KASAN                  if X86_64 && SPARSEMEM_VMEMMAP
> > > 
> > > both arm64 and x86 (64b) do compile fine without the ifdef... So I guess
> > > we should be fine without it.
> > 
> > Have you build the image to the final linking? lm_alias() hides the error
> > until later.
> > 
> > x86-64 allmodconfig without the #ifndef:
> > 
> >   MODPOST vmlinux.o
> > mm/built-in.o: In function `kasan_populate_zero_shadow':
> > (.init.text+0xb72b): undefined reference to `kasan_zero_p4d'
> > Makefile:983: recipe for target 'vmlinux' failed
> > make: *** [vmlinux] Error 1
> 
> Interesting
> arm64 cross compile:
> $ grep CONFIG_KASAN .config
> CONFIG_KASAN=y
> CONFIG_KASAN_OUTLINE=y
> # CONFIG_KASAN_INLINE is not set
> 
> Compiling for arm64 with aarch64-linux using gcc 4.9.0
> [...]
>   LD      vmlinux.o
>   MODPOST vmlinux.o
>   KSYM    .tmp_kallsyms1.o
>   KSYM    .tmp_kallsyms2.o
>   LD      vmlinux
>   SORTEX  vmlinux
>   SYSMAP  System.map
> 
> x86_64 crosscompile with the same version to rule out gcc version
> changes
> 
> $ grep CONFIG_KASAN .config
> CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000
> CONFIG_KASAN=y
> CONFIG_KASAN_OUTLINE=y
> # CONFIG_KASAN_INLINE is not set
> 
> [...]
>   LD      init/built-in.o
>   LD      vmlinux.o
>   MODPOST vmlinux.o
> mm/built-in.o: In function `kasan_populate_zero_shadow':
> (.init.text+0x84e5): undefined reference to `kasan_zero_p4d'
> Makefile:983: recipe for target 'vmlinux' failed
> 
> no idea why arm64 build was OK.

allmodconfig on amd64 enables 3-level paging, whcih produces nop
pgd_populate().

defconfig + enabling CONFIG_KASAN would trigger the issue:

mm/built-in.o: In function `kasan_populate_zero_shadow':
/home/kas/linux/la57/mm/kasan/kasan_init.c:161: undefined reference to `kasan_zero_p4d'
/home/kas/linux/la57/mm/kasan/kasan_init.c:161: undefined reference to `kasan_zero_p4d'
Makefile:983: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

> Anyway I am not insisting on removing this ifdef it is just too ugly to
> spread __ARCH_HAS_5LEVEL_HACK outside of the arch code. We have few more
> in the mm code but those look much more understandable. Maybe a short
> comment explaining the ifdef would be better.

Sure.

Thanks.

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] 5-level paging: prepare generic code "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-06 21:50 +0100
  [PATCH 7/7] mm: introduce __p4d_alloc() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-06 21:50 +0100
  [PATCH 1/7] x86/cpufeature: Add 5-level paging detection "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-06 21:50 +0100
  [PATCH 3/7] asm-generic: introduce __ARCH_USE_5LEVEL_HACK "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-06 21:50 +0100
  [PATCH 4/7] arch, mm: convert all architectures to use 5level-fixup.h "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-06 21:50 +0100
  [PATCH 2/7] asm-generic: introduce 5level-fixup.h "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-06 21:50 +0100
  [PATCH 5/7] asm-generic: introduce <asm-generic/pgtable-nop4d.h> "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-06 22:00 +0100
  Re: [PATCH 6/7] mm: convert generic code to 5-level paging Michal Hocko <mhocko@kernel.org> - 2017-03-08 15:00 +0100
    Re: [PATCH 6/7] mm: convert generic code to 5-level paging "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-08 16:30 +0100
      Re: [PATCH 6/7] mm: convert generic code to 5-level paging Michal Hocko <mhocko@kernel.org> - 2017-03-09 11:00 +0100
        Re: [PATCH 6/7] mm: convert generic code to 5-level paging "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-09 12:50 +0100
          Re: [PATCH 6/7] mm: convert generic code to 5-level paging Michal Hocko <mhocko@kernel.org> - 2017-03-09 13:30 +0100
            Re: [PATCH 6/7] mm: convert generic code to 5-level paging "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-09 15:00 +0100
  Re: [PATCH 0/7] 5-level paging: prepare generic code "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-08 16:10 +0100
    Re: [PATCH 0/7] 5-level paging: prepare generic code Michal Hocko <mhocko@kernel.org> - 2017-03-08 17:00 +0100
  Re: [PATCH 0/7] 5-level paging: prepare generic code Michal Hocko <mhocko@kernel.org> - 2017-03-08 16:20 +0100

csiph-web