kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Fuad Tabba <tabba@google.com>
Cc: kvm@vger.kernel.org,
	"open list:KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)" 
	"moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" 
	Zenghui Yu <yuzenghui@huawei.com>,
	James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	kernel-team@android.com, stable@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: arm64: Commit pending PC adjustemnts before returning to userspace
Date: Tue, 11 May 2021 09:14:28 +0100	[thread overview]
Message-ID: <871radvg9n.wl-maz@kernel.org> (raw)
In-Reply-To: <CA+EHjTzcfmt4mxh05a_P+nheQ_A2FuXhpgvKXuV5__pZP0SxkA@mail.gmail.com>

Hi Fuad,

On Tue, 11 May 2021 09:03:40 +0100,
Fuad Tabba <tabba@google.com> wrote:
> Hi Marc,
> > KVM: arm64: Commit pending PC adjustemnts before returning to userspace
> s/adjustments/adjustments

Looks like Gmail refuses to let you mimic my spelling mistakes! :D

> On Mon, May 10, 2021 at 10:49 AM Marc Zyngier <maz@kernel.org> wrote:
> >
> > KVM currently updates PC (and the corresponding exception state)
> > using a two phase approach: first by setting a set of flags,
> > then by converting these flags into a state update when the vcpu
> > is about to enter the guest.
> >
> > However, this creates a disconnect with userspace if the vcpu thread
> > returns there with any exception/PC flag set. In this case, the exposed
> > context is wrong, as userpsace doesn't have access to these flags
> > (they aren't architectural). It also means that these flags are
> > preserved across a reset, which isn't expected.
> >
> > To solve this problem, force an explicit synchronisation of the
> > exception state on vcpu exit to userspace. As an optimisation
> > for nVHE systems, only perform this when there is something pending.
> I've tested this with a few nvhe and vhe tests that exercise both
> __kvm_adjust_pc call paths (__kvm_vcpu_run and
> kvm_arch_vcpu_ioctl_run), and the tests ran as expected.  I'll do the
> same for v2 when you send it out.

Ah, that's interesting. Do you have tests that actually fail when
hitting this bug? Given that this is pretty subtle, it'd be good to
have a way to make sure it doesn't crop up again.



Without deviation from the norm, progress is not possible.

  reply	other threads:[~2021-05-11  8:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  9:49 [PATCH 0/2] KVM: arm64: Fixup PC updates on exit to userspace Marc Zyngier
2021-05-10  9:49 ` [PATCH 1/2] KVM: arm64: Move __adjust_pc out of line Marc Zyngier
2021-05-10 14:55   ` Alexandru Elisei
2021-05-10 15:08     ` Marc Zyngier
2021-05-10  9:49 ` [PATCH 2/2] KVM: arm64: Commit pending PC adjustemnts before returning to userspace Marc Zyngier
2021-05-10 14:55   ` Alexandru Elisei
2021-05-10 15:04     ` Marc Zyngier
2021-05-10 15:14       ` Alexandru Elisei
2021-05-11  7:44         ` Marc Zyngier
2021-05-11 16:50           ` Alexandru Elisei
2021-05-11  8:03   ` Fuad Tabba
2021-05-11  8:14     ` Marc Zyngier [this message]
2021-05-11  8:22       ` Fuad Tabba
2021-05-11  8:45         ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871radvg9n.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=james.morse@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=yuzenghui@huawei.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).