lkml.org 
[lkml]   [2017]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCHv2 02/29] asm-generic: introduce 5level-fixup.h
From
Date
On 12/27/2016 02:53 AM, Kirill A. Shutemov wrote:
> We are going to switch core MM to 5-level paging abstraction.
>
> This is preparation step which adds <asm-generic/5level-fixup.h>
> As with 4level-fixup.h, the new header allows quickly make all
> architectures compatible with 5-level paging in core MM.
>
> In long run we would like to switch architectures to properly folded p4d
> level by using <asm-generic/pgtable-nop4d.h>, but it requires more
> changes to arch-specific code.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
> include/asm-generic/4level-fixup.h | 3 ++-
> include/asm-generic/5level-fixup.h | 41 ++++++++++++++++++++++++++++++++++++++
> include/linux/mm.h | 3 +++
> 3 files changed, 46 insertions(+), 1 deletion(-)
> create mode 100644 include/asm-generic/5level-fixup.h
>
> diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h
> index 5bdab6bffd23..928fd66b1271 100644
> --- a/include/asm-generic/4level-fixup.h
> +++ b/include/asm-generic/4level-fixup.h
> @@ -15,7 +15,6 @@
> ((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \
> NULL: pmd_offset(pud, address))
>
> -#define pud_alloc(mm, pgd, address) (pgd)

This...

> #define pud_offset(pgd, start) (pgd)
> #define pud_none(pud) 0
> #define pud_bad(pud) 0
> @@ -35,4 +34,6 @@
> #undef pud_addr_end
> #define pud_addr_end(addr, end) (end)
>
> +#include <asm-generic/5level-fixup.h>

... plus this...

> +
> #endif
> diff --git a/include/asm-generic/5level-fixup.h b/include/asm-generic/5level-fixup.h
> new file mode 100644
> index 000000000000..b5ca82dc4175
> --- /dev/null
> +++ b/include/asm-generic/5level-fixup.h
> @@ -0,0 +1,41 @@
> +#ifndef _5LEVEL_FIXUP_H
> +#define _5LEVEL_FIXUP_H
> +
> +#define __ARCH_HAS_5LEVEL_HACK
> +#define __PAGETABLE_P4D_FOLDED
> +
> +#define P4D_SHIFT PGDIR_SHIFT
> +#define P4D_SIZE PGDIR_SIZE
> +#define P4D_MASK PGDIR_MASK
> +#define PTRS_PER_P4D 1
> +
> +#define p4d_t pgd_t
> +
> +#define pud_alloc(mm, p4d, address) \
> + ((unlikely(pgd_none(*(p4d))) && __pud_alloc(mm, p4d, address)) ? \
> + NULL : pud_offset(p4d, address))

... and this, makes me wonder if that broke pud_alloc() for architectures that
use the 4level-fixup.h. Don't those need to continue having pud_alloc() as (pgd)?

\
 
 \ /
  Last update: 2017-01-27 12:08    [W:1.127 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site