[RFC PATCH 25/47] mm: asi: Avoid warning from NMI userspace accesses in ASI context

Junaid Shahid
2022-02-23T05:26:31Z

nmi_uaccess_okay() emits a warning if current CR3 != mm->pgd.
Limit the warning to only when ASI is not active.

Signed-off-by: Junaid Shahid <junaids@google.com>

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

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 25bee959d1d3..628f1cd904ac 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1292,7 +1292,8 @@ bool nmi_uaccess_okay(void)
if (loaded_mm != current_mm)
return false;

- VM_WARN_ON_ONCE(current_mm->pgd != __va(read_cr3_pa()));
+ VM_WARN_ON_ONCE(current_mm->pgd != __va(read_cr3_pa()) &&
+ !is_asi_active());

return true;
}
--
2.35.1.473.g83b2b277ed-goog