[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87h7go2h69.wl-maz@kernel.org>
Date: Wed, 21 Jul 2021 09:40:46 +0100
From: Marc Zyngier <maz@...nel.org>
To: Joel Fernandes <joelaf@...gle.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Will Deacon <will@...nel.org>,
Suleiman Souhlal <suleiman@...gle.com>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCHv2 4/4] arm64: add host pv-vcpu-state support
On Tue, 20 Jul 2021 19:44:53 +0100,
Joel Fernandes <joelaf@...gle.com> wrote:
>
> On Mon, Jul 12, 2021 at 12:24 PM Marc Zyngier <maz@...nel.org> wrote:
> >
> [...]
> > > void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
> > > {
> > > + kvm_update_vcpu_preempted(vcpu, true);
> >
> > This doesn't look right. With this, you are now telling the guest that
> > a vcpu that is blocked on WFI is preempted. This really isn't the
> > case, as it has voluntarily entered a low-power mode while waiting for
> > an interrupt. Indeed, the vcpu isn't running. A physical CPU wouldn't
> > be running either.
>
> Can that be cured by just checking vcpu->preempted before calling
> kvm_update_vcpu_preempted() ?
It isn't obvious to me that this is the right thing to do.
vcpu->preempted is always updated on sched-out from the preempt
notifier if the vcpu was on the run-queue, so my guess is that it will
always be set when switching to another task.
What you probably want is to check whether the vcpu is blocked by
introspecting the wait-queue with:
scuwait_active(kvm_arch_vcpu_get_wait(vcpu)
which will tell you whether you are blocking or not. We are already
using a similar construct for arming a background timer in this case.
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists