lkml.org 
[lkml]   [2022]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[RFC PATCH 39/47] mm: asi: Skip conventional L1TF/MDS mitigations
From
From: Ofir Weisse <oweisse@google.com>

If ASI is enabled for an mm, then the L1D flushes and MDS mitigations
will be taken care of ASI. We check if asi is enabled by checking
current->mm->asi_enabled. To use ASI, a cgroup flag must be set before
the VM process is forked - causing a flag mm->asi_enabled to be set.

Signed-off-by: Ofir Weisse <oweisse@google.com>


---
arch/x86/kvm/vmx/vmx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index e0178b57be75..6549fef39f2b 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6609,7 +6609,11 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,

kvm_guest_enter_irqoff();

- vmx_flush_sensitive_cpu_state(vcpu);
+ /* If Address Space Isolation is enabled, it will take care of L1D
+ * flushes, and will also mitigate MDS. In other words, if no ASI -
+ * flush sensitive cpu state. */
+ if (!static_asi_enabled() || !mm_asi_enabled(current->mm))
+ vmx_flush_sensitive_cpu_state(vcpu);

asi_enter(vcpu->kvm->asi);

--
2.35.1.473.g83b2b277ed-goog
\
 
 \ /
  Last update: 2022-02-23 06:29    [W:0.130 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site