[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YQQvT7vAnRrcAcx/@google.com>
Date: Fri, 30 Jul 2021 16:56:47 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Oliver Upton <oupton@...gle.com>
Cc: Marc Zyngier <maz@...nel.org>, kvmarm@...ts.cs.columbia.edu,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
James Morse <james.morse@....com>,
Alexandru Elisei <Alexandru.Elisei@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
Peter Shier <pshier@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>,
Guangyu Shi <guangyus@...gle.com>
Subject: Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work
function
On Fri, Jul 30, 2021, Oliver Upton wrote:
>
> On Fri, Jul 30, 2021 at 2:41 AM Marc Zyngier <maz@...nel.org> wrote:
> >
> > On Thu, 29 Jul 2021 23:09:16 +0100, Oliver Upton <oupton@...gle.com> wrote:
> > > @@ -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().
Powered by blists - more mailing lists