Skip to contentSkip to conversation

arm/mm: Drop [PTE|PMD]_TYPE_FAULT

PATCH In review Anshuman Khandual 2 participants 3 messages May 13, 2021 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/mm: Drop [PTE|PMD]_TYPE_FAULT

Drop these unused symbols i.e PTE_TYPE_FAULT and PMD_TYPE_FAULT.

---
Applies on latest mainline. Just found this by code inspection and built tested for arm platform. Posted this earlier as well but some how got missed.

https://patchwork.kernel.org/project/linux-arm-kernel/patch/[email protected]/

 arch/arm/include/asm/pgtable-2level-hwdef.h | 2 --
 arch/arm/include/asm/pgtable-3level-hwdef.h | 2 --
 2 files changed, 4 deletions(-)
arch/arm/include/asm/pgtable-2level-hwdef.h +0 -2
index 556937e1790e..b10d6e1aee33 100644
@@ -14,7 +14,6 @@
  *   - common
  */
 #define PMD_TYPE_MASK		(_AT(pmdval_t, 3) << 0)
-#define PMD_TYPE_FAULT		(_AT(pmdval_t, 0) << 0)
 #define PMD_TYPE_TABLE		(_AT(pmdval_t, 1) << 0)
 #define PMD_TYPE_SECT		(_AT(pmdval_t, 2) << 0)
 #define PMD_PXNTABLE		(_AT(pmdval_t, 1) << 2)     /* v7 */
@@ -56,7 +55,6 @@
  *   - common
  */
 #define PTE_TYPE_MASK		(_AT(pteval_t, 3) << 0)
-#define PTE_TYPE_FAULT		(_AT(pteval_t, 0) << 0)
 #define PTE_TYPE_LARGE		(_AT(pteval_t, 1) << 0)
 #define PTE_TYPE_SMALL		(_AT(pteval_t, 2) << 0)
 #define PTE_TYPE_EXT		(_AT(pteval_t, 3) << 0)		/* v5 */
arch/arm/include/asm/pgtable-3level-hwdef.h +0 -2
index 2f35b4eddaa8..43aa8f61eac1 100644
@@ -15,7 +15,6 @@
  *   - common
  */
 #define PMD_TYPE_MASK		(_AT(pmdval_t, 3) << 0)
-#define PMD_TYPE_FAULT		(_AT(pmdval_t, 0) << 0)
 #define PMD_TYPE_TABLE		(_AT(pmdval_t, 3) << 0)
 #define PMD_TYPE_SECT		(_AT(pmdval_t, 1) << 0)
 #define PMD_TABLE_BIT		(_AT(pmdval_t, 1) << 1)
@@ -56,7 +55,6 @@
  * + Level 3 descriptor (PTE)
  */
 #define PTE_TYPE_MASK		(_AT(pteval_t, 3) << 0)
-#define PTE_TYPE_FAULT		(_AT(pteval_t, 0) << 0)
 #define PTE_TYPE_PAGE		(_AT(pteval_t, 3) << 0)
 #define PTE_TABLE_BIT		(_AT(pteval_t, 1) << 1)
 #define PTE_BUFFERABLE		(_AT(pteval_t, 1) << 2)		/* AttrIndx[0] */
Signature · 1 line
2.20.1
#1 lore raw
Quoted 1 line · Anshuman Khandual

Drop these unused symbols i.e PTE_TYPE_FAULT and PMD_TYPE_FAULT.

They're documentation, although PTE_TYPE_FAULT ought to be used by __swp_entry() to show that better.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#2 lore raw
Quoted 5 lines · Russell King - ARM Linux admin
Quoted 1 line · Anshuman Khandual

Drop these unused symbols i.e PTE_TYPE_FAULT and PMD_TYPE_FAULT.

They're documentation, although PTE_TYPE_FAULT ought to be used by __swp_entry() to show that better.

So really, we should be doing something like this:

arch/arm/include/asm/pgtable.h +1 -1
index c02f24400369..c43e07d6046d 100644
@@ -303,7 +303,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) })
 
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
-#define __swp_entry_to_pte(swp)	((pte_t) { (swp).val })
+#define __swp_entry_to_pte(swp)	__pte((swp).val | PTE_TYPE_FAULT)
 
 /*
  * It is an error for the kernel to have more swap files than we can

Since that is really what is going on here. It is by design that the swp_entry_t is layed out to be correct, and of course because PTE_TYPE_FAULT has the value of zero, the above merely adds to the "documentation" rather than having any functional effect.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!