Re: [PATCH V5 1/4] mm/debug_vm_pgtable: Add tests validating arch helpers for core MM features

2020-07-16 Thread Steven Price

On 13/07/2020 04:23, Anshuman Khandual wrote:

This adds new tests validating arch page table helpers for these following
core memory features. These tests create and test specific mapping types at
various page table levels.

1. SPECIAL mapping
2. PROTNONE mapping
3. DEVMAP mapping
4. SOFTDIRTY mapping
5. SWAP mapping
6. MIGRATION mapping
7. HUGETLB mapping
8. THP mapping

Cc: Andrew Morton 
Cc: Gerald Schaefer 
Cc: Christophe Leroy 
Cc: Mike Rapoport 
Cc: Vineet Gupta 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Michael Ellerman 
Cc: Heiko Carstens 
Cc: Vasily Gorbik 
Cc: Christian Borntraeger 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: "H. Peter Anvin" 
Cc: Kirill A. Shutemov 
Cc: Paul Walmsley 
Cc: Palmer Dabbelt 
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: linux-s...@vger.kernel.org
Cc: linux-ri...@lists.infradead.org
Cc: x...@kernel.org
Cc: linux...@kvack.org
Cc: linux-a...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
Tested-by: Vineet Gupta  #arc
Reviewed-by: Zi Yan 
Suggested-by: Catalin Marinas 
Signed-off-by: Anshuman Khandual 
---
  mm/debug_vm_pgtable.c | 302 +-
  1 file changed, 301 insertions(+), 1 deletion(-)

diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
index 61ab16fb2e36..2fac47db3eb7 100644
--- a/mm/debug_vm_pgtable.c
+++ b/mm/debug_vm_pgtable.c

[...]

+
+static void __init pte_swap_tests(unsigned long pfn, pgprot_t prot)
+{
+   swp_entry_t swp;
+   pte_t pte;
+
+   pte = pfn_pte(pfn, prot);
+   swp = __pte_to_swp_entry(pte);


Minor issue: this doesn't look necessarily valid - there's no reason a 
normal PTE can be turned into a swp_entry. In practise this is likely to 
work on all architectures because there's no reason not to use (at 
least) all the PFN bits for the swap entry, but it doesn't exactly seem 
correct.


Can we start with a swp_entry_t (from __swp_entry()) and check the round 
trip of that?


It would also seem sensible to have a check that 
is_swap_pte(__swp_entry_to_pte(__swp_entry(x,y))) is true.



+   pte = __swp_entry_to_pte(swp);
+   WARN_ON(pfn != pte_pfn(pte));
+}
+
+#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
+static void __init pmd_swap_tests(unsigned long pfn, pgprot_t prot)
+{
+   swp_entry_t swp;
+   pmd_t pmd;
+
+   pmd = pfn_pmd(pfn, prot);
+   swp = __pmd_to_swp_entry(pmd);
+   pmd = __swp_entry_to_pmd(swp);
+   WARN_ON(pfn != pmd_pfn(pmd));
+}
+#else  /* !CONFIG_ARCH_ENABLE_THP_MIGRATION */
+static void __init pmd_swap_tests(unsigned long pfn, pgprot_t prot) { }
+#endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
+
+static void __init swap_migration_tests(void)
+{
+   struct page *page;
+   swp_entry_t swp;
+
+   if (!IS_ENABLED(CONFIG_MIGRATION))
+   return;
+   /*
+* swap_migration_tests() requires a dedicated page as it needs to
+* be locked before creating a migration entry from it. Locking the
+* page that actually maps kernel text ('start_kernel') can be real
+* problematic. Lets allocate a dedicated page explicitly for this


NIT: s/Lets/Let's

Otherwise looks good to me.

Steve

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v17 02/23] arc: mm: Add p?d_leaf() definitions

2019-12-18 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta 
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 9019ed9f9c94..12be7e1b7cc0 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -273,6 +273,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(x) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v16 02/25] arc: mm: Add p?d_leaf() definitions

2019-12-06 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta 
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 9019ed9f9c94..12be7e1b7cc0 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -273,6 +273,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(x) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v15 02/23] arc: mm: Add p?d_leaf() definitions

2019-11-01 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta 
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 7addd0301c51..b4a0cf27ac1c 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -274,6 +274,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(x) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v14 02/22] arc: mm: Add p?d_leaf() definitions

2019-10-28 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta 
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 7addd0301c51..b4a0cf27ac1c 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -274,6 +274,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(x) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v13 02/22] arc: mm: Add p?d_leaf() definitions

2019-10-24 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta 
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 7addd0301c51..5ec798e50836 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -274,6 +274,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v12 02/22] arc: mm: Add p?d_leaf() definitions

2019-10-18 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta 
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 7addd0301c51..5ec798e50836 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -274,6 +274,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v10 02/22] arc: mm: Add p?d_leaf() definitions

2019-07-31 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 1d87c18a2976..8c425cf796db 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -274,6 +274,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v9 01/21] arc: mm: Add p?d_leaf() definitions

2019-07-22 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_leaf() functions/macros.

For arc, we only have two levels, so only pmd_leaf() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 1d87c18a2976..8c425cf796db 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -274,6 +274,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_leaf(x)(pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v8 01/20] arc: mm: Add p?d_large() definitions

2019-04-03 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_large() functions/macros.

For arc, we only have two levels, so only pmd_large() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
Acked-by: Vineet Gupta 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index cf4be70d5892..0edd27bc7018 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -277,6 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_large(x)   (pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v7 01/20] arc: mm: Add p?d_large() definitions

2019-03-28 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_large() functions/macros.

For arc, we only have two levels, so only pmd_large() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
Acked-by: Vineet Gupta 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index cf4be70d5892..0edd27bc7018 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -277,6 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_large(x)   (pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v6 01/19] arc: mm: Add p?d_large() definitions

2019-03-26 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_large() functions/macros.

For arc, we only have two levels, so only pmd_large() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
Acked-by: Vineet Gupta 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index cf4be70d5892..0edd27bc7018 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -277,6 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_large(x)   (pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v5 01/19] arc: mm: Add p?d_large() definitions

2019-03-21 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_large() functions/macros.

For arc, we only have two levels, so only pmd_large() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
Acked-by: Vineet Gupta 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index cf4be70d5892..0edd27bc7018 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -277,6 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_large(x)   (pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v4 01/19] arc: mm: Add p?d_large() definitions

2019-03-06 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_large() functions/macros.

For arc, we only have two levels, so only pmd_large() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
Acked-by: Vineet Gupta 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index cf4be70d5892..0edd27bc7018 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -277,6 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_large(x)   (pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v3 02/34] arc: mm: Add p?d_large() definitions

2019-02-27 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information will be provided by the
p?d_large() functions/macros.

For arc, we only have two levels, so only pmd_large() is needed.

CC: Vineet Gupta 
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Steven Price 
---
 arch/arc/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index cf4be70d5892..0edd27bc7018 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -277,6 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_none(x)(!pmd_val(x))
 #definepmd_bad(x)  ((pmd_val(x) & ~PAGE_MASK))
 #define pmd_present(x) (pmd_val(x))
+#define pmd_large(x)   (pmd_val(pmd) & _PAGE_HW_SZ)
 #define pmd_clear(xp)  do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc