2020-03-23 01:08:41

by Anshuman Khandual

[permalink] [raw]
Subject: [PATCH] x86/memory: Drop pud_mknotpresent()

There is an inconsistency between PMD and PUD based THP page table helpers
like the following, as pud_present() does not test for _PAGE_PSE.

pmd_present(pmd_mknotpresent(pmd)) : True
pud_present(pud_mknotpresent(pud)) : False

This drops pud_mknotpresent() as there are no current users. If/when needed
back later, pud_present() will also have to fixed to accommodate _PAGE_PSE.

Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Anshuman Khandual <[email protected]>
---
This has been build and boot tested on x86.

Changes in V2:

- Dropped pud_mknotpresent() instead per Kirill

Changes in V1: (https://patchwork.kernel.org/patch/11444529/)

arch/x86/include/asm/pgtable.h | 6 ------
1 file changed, 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 7e118660bbd9..d74dc560e3ab 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -595,12 +595,6 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd)
__pgprot(pmd_flags(pmd) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
}

-static inline pud_t pud_mknotpresent(pud_t pud)
-{
- return pfn_pud(pud_pfn(pud),
- __pgprot(pud_flags(pud) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
-}
-
static inline u64 flip_protnone_guard(u64 oldval, u64 val, u64 mask);

static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
--
2.17.1


2020-03-23 01:38:28

by Baoquan He

[permalink] [raw]
Subject: Re: [PATCH] x86/memory: Drop pud_mknotpresent()

On 03/23/20 at 06:35am, Anshuman Khandual wrote:
> There is an inconsistency between PMD and PUD based THP page table helpers
> like the following, as pud_present() does not test for _PAGE_PSE.
>
> pmd_present(pmd_mknotpresent(pmd)) : True
> pud_present(pud_mknotpresent(pud)) : False
>
> This drops pud_mknotpresent() as there are no current users. If/when needed
> back later, pud_present() will also have to fixed to accommodate _PAGE_PSE.
>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Borislav Petkov <[email protected]>
> Cc: "H. Peter Anvin" <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: Kirill A. Shutemov <[email protected]>
> Cc: Dan Williams <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Anshuman Khandual <[email protected]>
> ---
> This has been build and boot tested on x86.
>
> Changes in V2:
>
> - Dropped pud_mknotpresent() instead per Kirill
>
> Changes in V1: (https://patchwork.kernel.org/patch/11444529/)
>
> arch/x86/include/asm/pgtable.h | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index 7e118660bbd9..d74dc560e3ab 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -595,12 +595,6 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd)
> __pgprot(pmd_flags(pmd) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
> }
>
> -static inline pud_t pud_mknotpresent(pud_t pud)
> -{
> - return pfn_pud(pud_pfn(pud),
> - __pgprot(pud_flags(pud) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
> -}
> -
> static inline u64 flip_protnone_guard(u64 oldval, u64 val, u64 mask);
>
> static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)

Reviewed-by: Baoquan He <[email protected]>

2020-03-23 03:26:30

by Balbir Singh

[permalink] [raw]
Subject: Re: [PATCH] x86/memory: Drop pud_mknotpresent()

On 23/3/20 12:05 pm, Anshuman Khandual wrote:
> There is an inconsistency between PMD and PUD based THP page table helpers
> like the following, as pud_present() does not test for _PAGE_PSE.
>
> pmd_present(pmd_mknotpresent(pmd)) : True
> pud_present(pud_mknotpresent(pud)) : False
>
> This drops pud_mknotpresent() as there are no current users. If/when needed
> back later, pud_present() will also have to fixed to accommodate _PAGE_PSE.
>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Borislav Petkov <[email protected]>
> Cc: "H. Peter Anvin" <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: Kirill A. Shutemov <[email protected]>
> Cc: Dan Williams <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Anshuman Khandual <[email protected]>
> ---

Makes sense

Acked-by: Balbir Singh <[email protected]>


Attachments:
pEpkey.asc (2.44 kB)

2020-03-23 07:48:38

by Kirill A. Shutemov

[permalink] [raw]
Subject: Re: [PATCH] x86/memory: Drop pud_mknotpresent()

On Mon, Mar 23, 2020 at 06:35:42AM +0530, Anshuman Khandual wrote:
> There is an inconsistency between PMD and PUD based THP page table helpers
> like the following, as pud_present() does not test for _PAGE_PSE.
>
> pmd_present(pmd_mknotpresent(pmd)) : True
> pud_present(pud_mknotpresent(pud)) : False
>
> This drops pud_mknotpresent() as there are no current users. If/when needed
> back later, pud_present() will also have to fixed to accommodate _PAGE_PSE.
>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Borislav Petkov <[email protected]>
> Cc: "H. Peter Anvin" <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: Kirill A. Shutemov <[email protected]>
> Cc: Dan Williams <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Anshuman Khandual <[email protected]>

Acked-by: Kirill A. Shutemov <[email protected]>

--
Kirill A. Shutemov

Subject: [tip: x86/cleanups] x86/mm: Drop pud_mknotpresent()

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 31a9122058bc5f042cb04bcdb8cd9e6c77fdae8d
Gitweb: https://git.kernel.org/tip/31a9122058bc5f042cb04bcdb8cd9e6c77fdae8d
Author: Anshuman Khandual <[email protected]>
AuthorDate: Mon, 23 Mar 2020 06:35:42 +05:30
Committer: Borislav Petkov <[email protected]>
CommitterDate: Mon, 23 Mar 2020 09:11:48 +01:00

x86/mm: Drop pud_mknotpresent()

There is an inconsistency between PMD and PUD-based THP page table helpers
like the following, as pud_present() does not test for _PAGE_PSE.

pmd_present(pmd_mknotpresent(pmd)) : True
pud_present(pud_mknotpresent(pud)) : False

Drop pud_mknotpresent() as there are no current users. If/when needed
back later, pud_present() will also have to be fixed to accommodate
_PAGE_PSE.

Signed-off-by: Anshuman Khandual <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Reviewed-by: Baoquan He <[email protected]>
Acked-by: Balbir Singh <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
arch/x86/include/asm/pgtable.h | 6 ------
1 file changed, 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 7e11866..d74dc56 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -595,12 +595,6 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd)
__pgprot(pmd_flags(pmd) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
}

-static inline pud_t pud_mknotpresent(pud_t pud)
-{
- return pfn_pud(pud_pfn(pud),
- __pgprot(pud_flags(pud) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
-}
-
static inline u64 flip_protnone_guard(u64 oldval, u64 val, u64 mask);

static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)

2020-03-23 20:30:38

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH] x86/memory: Drop pud_mknotpresent()

Looks sane. 'git grep' confirms precisely zero references in the entire
tree.

Acked-by: Dave Hansen <[email protected]>