public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] arm64/mm/hotplug: Replace pxx_present() with pxx_valid()
Date: Fri, 21 Feb 2025 15:14:49 +0530	[thread overview]
Message-ID: <20250221094449.1188427-3-anshuman.khandual@arm.com> (raw)
In-Reply-To: <20250221094449.1188427-1-anshuman.khandual@arm.com>

pte_present() asserts either the entry has PTE_VALID or PTE_PRESENT_INVALID
bit set. Although PTE_PRESENT_INVALID bit only gets set on user space page
table entries to represent pxx_present_invalid() state. So present invalid
state is not really possible in kernel page table entries including linear
and vmemap mapping which get teared down during memory hot remove operation
. Hence just check for pxx_valid() instead of pxx_present() in all relevant
places.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/mm/mmu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 66906c45c7f6..33a8b77b5e6b 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -863,7 +863,7 @@ static void unmap_hotplug_pte_range(pmd_t *pmdp, unsigned long addr,
 		if (pte_none(pte))
 			continue;
 
-		WARN_ON(!pte_present(pte));
+		WARN_ON(!pte_valid(pte));
 		__pte_clear(&init_mm, addr, ptep);
 		flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
 		if (free_mapped)
@@ -886,7 +886,7 @@ static void unmap_hotplug_pmd_range(pud_t *pudp, unsigned long addr,
 		if (pmd_none(pmd))
 			continue;
 
-		WARN_ON(!pmd_present(pmd));
+		WARN_ON(!pmd_valid(pmd));
 		if (pmd_sect(pmd)) {
 			pmd_clear(pmdp);
 
@@ -919,7 +919,7 @@ static void unmap_hotplug_pud_range(p4d_t *p4dp, unsigned long addr,
 		if (pud_none(pud))
 			continue;
 
-		WARN_ON(!pud_present(pud));
+		WARN_ON(!pud_valid(pud));
 		if (pud_sect(pud)) {
 			pud_clear(pudp);
 
@@ -1032,7 +1032,7 @@ static void free_empty_pmd_table(pud_t *pudp, unsigned long addr,
 		if (pmd_none(pmd))
 			continue;
 
-		WARN_ON(!pmd_present(pmd) || !pmd_table(pmd) || pmd_sect(pmd));
+		WARN_ON(!pmd_valid(pmd) || !pmd_table(pmd) || pmd_sect(pmd));
 		free_empty_pte_table(pmdp, addr, next, floor, ceiling);
 	} while (addr = next, addr < end);
 
@@ -1072,7 +1072,7 @@ static void free_empty_pud_table(p4d_t *p4dp, unsigned long addr,
 		if (pud_none(pud))
 			continue;
 
-		WARN_ON(!pud_present(pud) || !pud_table(pud) || pud_sect(pud));
+		WARN_ON(!pud_valid(pud) || !pud_table(pud) || pud_sect(pud));
 		free_empty_pmd_table(pudp, addr, next, floor, ceiling);
 	} while (addr = next, addr < end);
 
-- 
2.30.2



  parent reply	other threads:[~2025-02-21 10:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21  9:44 [PATCH 0/2] arm64/mm/hotplug: Drop some redundant WARN_ON() Anshuman Khandual
2025-02-21  9:44 ` [PATCH 1/2] arm64/mm/hotplug: Drop redundant [pgd|p4d]_present() Anshuman Khandual
2025-02-21 17:37   ` Dev Jain
2025-03-18 11:16   ` Mark Rutland
2025-03-19  6:02     ` Anshuman Khandual
2025-02-21  9:44 ` Anshuman Khandual [this message]
2025-03-18  5:54 ` [PATCH 0/2] arm64/mm/hotplug: Drop some redundant WARN_ON() Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250221094449.1188427-3-anshuman.khandual@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox