[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190806165823.3f735b45a7c4163aca20a767@linux-foundation.org>
Date: Tue, 6 Aug 2019 16:58:23 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Steven Price <steven.price@....com>
Cc: linux-mm@...ck.org, Andy Lutomirski <luto@...nel.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Arnd Bergmann <arnd@...db.de>, Borislav Petkov <bp@...en8.de>,
Catalin Marinas <catalin.marinas@....com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
James Morse <james.morse@....com>,
Jérôme Glisse <jglisse@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will@...nel.org>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Mark Rutland <Mark.Rutland@....com>,
"Liang, Kan" <kan.liang@...ux.intel.com>
Subject: Re: [PATCH v10 20/22] x86: mm: Convert dump_pagetables to use
walk_page_range
On Wed, 31 Jul 2019 16:46:01 +0100 Steven Price <steven.price@....com> wrote:
> Make use of the new functionality in walk_page_range to remove the
> arch page walking code and use the generic code to walk the page tables.
>
> The effective permissions are passed down the chain using new fields
> in struct pg_state.
>
> The KASAN optimisation is implemented by including test_p?d callbacks
> which can decide to skip an entire tree of entries
>
> ...
>
> +static const struct ptdump_range ptdump_ranges[] = {
> +#ifdef CONFIG_X86_64
>
> -#define pgd_large(a) (pgtable_l5_enabled() ? pgd_large(a) : p4d_large(__p4d(pgd_val(a))))
> -#define pgd_none(a) (pgtable_l5_enabled() ? pgd_none(a) : p4d_none(__p4d(pgd_val(a))))
> +#define normalize_addr_shift (64 - (__VIRTUAL_MASK_SHIFT + 1))
> +#define normalize_addr(u) ((signed long)(u << normalize_addr_shift) \
> + >> normalize_addr_shift)
>
> -static inline bool is_hypervisor_range(int idx)
> -{
> -#ifdef CONFIG_X86_64
> - /*
> - * A hole in the beginning of kernel address space reserved
> - * for a hypervisor.
> - */
> - return (idx >= pgd_index(GUARD_HOLE_BASE_ADDR)) &&
> - (idx < pgd_index(GUARD_HOLE_END_ADDR));
> + {0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2},
> + {normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL},
This blows up because PGD_LEVEL_MULT is sometimes not a constant.
x86_64 allmodconfig:
In file included from ./arch/x86/include/asm/pgtable_types.h:249:0,
from ./arch/x86/include/asm/paravirt_types.h:45,
from ./arch/x86/include/asm/ptrace.h:94,
from ./arch/x86/include/asm/math_emu.h:5,
from ./arch/x86/include/asm/processor.h:12,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:78,
from ./include/linux/spinlock.h:51,
from ./include/linux/wait.h:9,
from ./include/linux/wait_bit.h:8,
from ./include/linux/fs.h:6,
from ./include/linux/debugfs.h:15,
from arch/x86/mm/dump_pagetables.c:11:
./arch/x86/include/asm/pgtable_64_types.h:56:22: error: initializer element is not constant
#define PTRS_PER_PGD 512
^
arch/x86/mm/dump_pagetables.c:363:6: note: in expansion of macro ‘PTRS_PER_PGD’
{0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2},
^~~~~~~~~~~~
./arch/x86/include/asm/pgtable_64_types.h:56:22: note: (near initialization for ‘ptdump_ranges[0].end’)
#define PTRS_PER_PGD 512
^
arch/x86/mm/dump_pagetables.c:363:6: note: in expansion of macro ‘PTRS_PER_PGD’
{0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2},
^~~~~~~~~~~~
arch/x86/mm/dump_pagetables.c:360:27: error: initializer element is not constant
#define normalize_addr(u) ((signed long)(u << normalize_addr_shift) \
^
arch/x86/mm/dump_pagetables.c:364:3: note: in expansion of macro ‘normalize_addr’
{normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL},
^~~~~~~~~~~~~~
arch/x86/mm/dump_pagetables.c:360:27: note: (near initialization for ‘ptdump_ranges[1].start’)
#define normalize_addr(u) ((signed long)(u << normalize_addr_shift) \
^
arch/x86/mm/dump_pagetables.c:364:3: note: in expansion of macro ‘normalize_addr’
{normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL},
I don't know what to do about this so I'll drop the series.
Powered by blists - more mailing lists