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 46/47] kvm: asi: Do asi_exit() in vcpu_run loop before returning to userspace
From
From: Ofir Weisse <oweisse@google.com>

For the time being, we switch to the full kernel address space before
returning back to userspace. Once KPTI is also implemented using ASI,
we could potentially also switch to the KPTI address space directly.

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


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

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 680725089a18..294f73e9e71e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10148,13 +10148,17 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
r = xfer_to_guest_mode_handle_work(vcpu);
if (r)
- return r;
+ goto exit;
vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
}
}

srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);

+exit:
+ /* TODO(oweisse): trace this exit if we're still within an ASI. */
+ asi_exit();
+
return r;
}

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