x86/svm: Always flush TLB using TLB_CTRL_FLUSH_ALL

Xen currently uses an ASID scheme where:
- ASIDs are cycled where a "TLB flush" is performed
- When ASIDs wrap around, perform a full TLB flush
- In exceptional cases, stop using ASIDs

However, the TLB control mode used only flushes the current active ASID of
the logical processor. Which mean that will supply "stale" ASIDs (not flushed),
because it hasn't been actually flushed (TLB_CTRL_FLUSH_ASID only performs a
TLB flush of the ASID set in VMCB).

This affects CPUs where flush-by-asid is available (Fam15h (2011) and later).

To fix this, always flush all ASIDs even when flush-by-asid is available.

Fixes: 64b1da5a2f ("x86/svm: Use flush-by-asid when available")
Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 68871b1f9b
master date: 2025-07-23 15:23:44 +0200
This commit is contained in:
Teddy Astie authored and Jan Beulich committed 2025-07-31 09:51:13 +02:00
1 parent f1f2ac1a63
commit 2fd3628fa6
1 file changed
+2 -3
+2 -3
View File
@@ -46,9 +46,8 @@ void svm_asid_handle_vmrun(void)
if ( vmcb_get_asid(vmcb) != p_asid->asid )
vmcb_set_asid(vmcb, p_asid->asid);
vmcb->tlb_control =
!need_flush ? TLB_CTRL_NO_FLUSH :
cpu_has_svm_flushbyasid ? TLB_CTRL_FLUSH_ASID : TLB_CTRL_FLUSH_ALL;
/* We can't rely on TLB_CTRL_FLUSH_ASID as all ASIDs are stale here. */
vmcb->tlb_control = need_flush ? TLB_CTRL_FLUSH_ALL : TLB_CTRL_NO_FLUSH;
}
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.