[Devel,rh7,v2] x86/mm: Use dirty bit for non-linear files ptes

Submitted by Andrey Ryabinin on Oct. 3, 2016, 8:56 a.m.

Details

Message ID 1475484975-32399-1-git-send-email-aryabinin@virtuozzo.com
State New
Series "x86/mm: Use dirty bit for non-linear files ptes"
Headers show

Commit Message

Andrey Ryabinin Oct. 3, 2016, 8:56 a.m.
Backported patchset "Workaround for Xeon Phi PTE A/D bits erratum"
caused - kernel BUG at mm/rmap.c:1305!

_PAGE_BIT_FILE is not present in upstream but still present
in RHEL7 kernel, so they did this:
   /* Pick a bit unaffected by the "KNL4 erratum": */
   #define _PAGE_BIT_FILE		_PAGE_BIT_PSE

   Which conflicts with ours code:
   #define _PAGE_SWP_SOFT_DIRTY	_PAGE_PSE

So, as temporary fix restore old value for _PAGE_FILE.
If we care about supporting Xeon Phi we could backport
remap_file_pages() emulation from upstream which removes uses _PAGE_FILE.

https://jira.sw.ru/browse/PSBM-52992

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
Changes since v1 - fixed typo
 s/_PAGE_PIT_DIRTY/_PAGE_BIT_DIRTY

 arch/x86/include/asm/pgtable_types.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 6e43ed0..5a6a5be 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -29,12 +29,8 @@ 
 /* - if the user mapped it with PROT_NONE; pte_present gives true */
 #define _PAGE_BIT_PROTNONE	_PAGE_BIT_GLOBAL
 /* - set: nonlinear file mapping, saved PTE; unset:swap */
-#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
-/* Pick a bit unaffected by the "KNL4 erratum": */
-#define _PAGE_BIT_FILE		_PAGE_BIT_PSE
-#else
+/* TODO: FIX: The following bit is affected by the "KNL4 erratum": */
 #define _PAGE_BIT_FILE		_PAGE_BIT_DIRTY
-#endif
 
 #define _PAGE_PRESENT	(_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
 #define _PAGE_RW	(_AT(pteval_t, 1) << _PAGE_BIT_RW)

Comments

Andrey Ryabinin Oct. 3, 2016, 9:19 a.m.
On 10/03/2016 11:56 AM, Andrey Ryabinin wrote:
> Backported patchset "Workaround for Xeon Phi PTE A/D bits erratum"
> caused - kernel BUG at mm/rmap.c:1305!
> 
> _PAGE_BIT_FILE is not present in upstream but still present
> in RHEL7 kernel, so they did this:
>    /* Pick a bit unaffected by the "KNL4 erratum": */
>    #define _PAGE_BIT_FILE		_PAGE_BIT_PSE
> 
>    Which conflicts with ours code:
>    #define _PAGE_SWP_SOFT_DIRTY	_PAGE_PSE
> 
> So, as temporary fix restore old value for _PAGE_FILE.
> If we care about supporting Xeon Phi we could backport
> remap_file_pages() emulation from upstream which removes uses _PAGE_FILE.
> 
> https://jira.sw.ru/browse/PSBM-52992
> 
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
> Changes since v1 - fixed typo
>  s/_PAGE_PIT_DIRTY/_PAGE_BIT_DIRTY
> 
>  arch/x86/include/asm/pgtable_types.h | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
> index 6e43ed0..5a6a5be 100644
> --- a/arch/x86/include/asm/pgtable_types.h
> +++ b/arch/x86/include/asm/pgtable_types.h
> @@ -29,12 +29,8 @@
>  /* - if the user mapped it with PROT_NONE; pte_present gives true */
>  #define _PAGE_BIT_PROTNONE	_PAGE_BIT_GLOBAL
>  /* - set: nonlinear file mapping, saved PTE; unset:swap */
> -#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
> -/* Pick a bit unaffected by the "KNL4 erratum": */
> -#define _PAGE_BIT_FILE		_PAGE_BIT_PSE
> -#else
> +/* TODO: FIX: The following bit is affected by the "KNL4 erratum": */
>  #define _PAGE_BIT_FILE		_PAGE_BIT_DIRTY

Self NACK. This can be masked out in pte_none(), probably safer to backport patches
removing remap_file_pages()

>  
>  #define _PAGE_PRESENT	(_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
>  #define _PAGE_RW	(_AT(pteval_t, 1) << _PAGE_BIT_RW)
>