Thread (8 messages) 8 messages, 3 authors, 2021-07-30

Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work function

From: Sean Christopherson <seanjc@google.com>
Date: 2021-07-30 16:56:58
Also in: kvm, kvmarm, lkml

On Fri, Jul 30, 2021, Oliver Upton wrote:
On Fri, Jul 30, 2021 at 2:41 AM Marc Zyngier [off-list ref] wrote:
quoted
On Thu, 29 Jul 2021 23:09:16 +0100, Oliver Upton [off-list ref] wrote:
quoted
@@ -714,6 +715,13 @@ static bool vcpu_mode_is_bad_32bit(struct kvm_vcpu *vcpu)
              static_branch_unlikely(&arm64_mismatched_32bit_el0);
 }

+static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu)
+{
+     return kvm_request_pending(vcpu) ||
+                     need_new_vmid_gen(&vcpu->arch.hw_mmu->vmid) ||
+                     xfer_to_guest_mode_work_pending();
Here's what xfer_to_guest_mode_work_pending() says:

<quote>
 * Has to be invoked with interrupts disabled before the transition to
 * guest mode.
</quote>

At the point where you call this, we already are in guest mode, at
least in the KVM sense.
I believe the comment is suggestive of guest mode in the hardware
sense, not KVM's vcpu->mode designation. I got this from
arch/x86/kvm/x86.c:vcpu_enter_guest() to infer the author's
intentions.
Yeah, the comment is referring to hardware guest mode.  The intent is to verify
there is no work to be done before making the expensive world switch.  There's
no meaningful interaction with vcpu->mode, on x86 it's simply more convenient
from a code perspective to throw it into kvm_vcpu_exit_request().

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help