[PATCH] x86/mm: Remove duplicate check from build_cr3()

Yuntao Wang posted 1 patch 1 year, 5 months ago
There is a newer version of this series
arch/x86/mm/tlb.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] x86/mm: Remove duplicate check from build_cr3()
Posted by Yuntao Wang 1 year, 5 months ago
There is already a check for 'asid > MAX_ASID_AVAILABLE' in kern_pcid(),
so it is unnecessary to perform this check again in build_cr3(). Remove it.

Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
---
 arch/x86/mm/tlb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 44ac64f3a047..5bc87519e13e 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -160,7 +160,6 @@ static inline unsigned long build_cr3(pgd_t *pgd, u16 asid, unsigned long lam)
 	unsigned long cr3 = __sme_pa(pgd) | lam;
 
 	if (static_cpu_has(X86_FEATURE_PCID)) {
-		VM_WARN_ON_ONCE(asid > MAX_ASID_AVAILABLE);
 		cr3 |= kern_pcid(asid);
 	} else {
 		VM_WARN_ON_ONCE(asid != 0);
-- 
2.46.0
[tip: x86/mm] x86/mm: Remove duplicate check from build_cr3()
Posted by tip-bot2 for Yuntao Wang 1 year, 5 months ago
The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     d4245fd4a62931aebd1c5e6b7b6f51b6ef7ad087
Gitweb:        https://git.kernel.org/tip/d4245fd4a62931aebd1c5e6b7b6f51b6ef7ad087
Author:        Yuntao Wang <yuntao.wang@linux.dev>
AuthorDate:    Wed, 14 Aug 2024 20:46:45 +08:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 14 Aug 2024 19:41:40 +02:00

x86/mm: Remove duplicate check from build_cr3()

There is already a check for 'asid > MAX_ASID_AVAILABLE' in kern_pcid(), so
it is unnecessary to perform this check in build_cr3() right before calling
kern_pcid().

Remove it.

Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240814124645.51019-1-yuntao.wang@linux.dev

---
 arch/x86/mm/tlb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 09950fe..86593d1 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -158,7 +158,6 @@ static inline unsigned long build_cr3(pgd_t *pgd, u16 asid, unsigned long lam)
 	unsigned long cr3 = __sme_pa(pgd) | lam;
 
 	if (static_cpu_has(X86_FEATURE_PCID)) {
-		VM_WARN_ON_ONCE(asid > MAX_ASID_AVAILABLE);
 		cr3 |= kern_pcid(asid);
 	} else {
 		VM_WARN_ON_ONCE(asid != 0);