Re: [PATCH 09/11] x86/pti: enable global pages for shared areas

Nadav Amit
2018-03-23T19:12:55Z

Dave Hansen <dave.hansen@linux.intel.com> wrote:

>
> From: Dave Hansen <dave.hansen@linux.intel.com>
>
> The entry/exit text and cpu_entry_area are mapped into userspace and
> the kernel. But, they are not _PAGE_GLOBAL. This creates unnecessary
> TLB misses.
>
> Add the _PAGE_GLOBAL flag for these areas.
>
> static void __init
> diff -puN arch/x86/mm/pti.c~kpti-why-no-global arch/x86/mm/pti.c
> --- a/arch/x86/mm/pti.c~kpti-why-no-global 2018-03-21 16:32:00.799192311 -0700
> +++ b/arch/x86/mm/pti.c 2018-03-21 16:32:00.803192311 -0700
> @@ -300,6 +300,13 @@ pti_clone_pmds(unsigned long start, unsi
> return;
>
> /*
> + * Setting 'target_pmd' below creates a mapping in both
> + * the user and kernel page tables. It is effectively
> + * global, so set it as global in both copies.
> + */
> + *pmd = pmd_set_flags(*pmd, _PAGE_GLOBAL);
if (boot_cpu_has(X86_FEATURE_PGE)) ?