From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Vipin Sharma <vipinsh@google.com>,
Jing Zhang <jingzhangos@google.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] KVM: arm64: Always invalidate TLB for stage-2 permission faults
Date: Sun, 24 Sep 2023 11:12:30 +0100 [thread overview]
Message-ID: <87ttrj5181.wl-maz@kernel.org> (raw)
In-Reply-To: <ZQ4eZcWRO/nHnGc4@linux.dev>
On Sat, 23 Sep 2023 00:08:21 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> On Fri, Sep 22, 2023 at 10:32:29PM +0000, Oliver Upton wrote:
> > It is possible for multiple vCPUs to fault on the same IPA and attempt
> > to resolve the fault. One of the page table walks will actually update
> > the PTE and the rest will return -EAGAIN per our race detection scheme.
> > KVM elides the TLB invalidation on the racing threads as the return
> > value is nonzero.
> >
> > Before commit a12ab1378a88 ("KVM: arm64: Use local TLBI on permission
> > relaxation") KVM always used broadcast TLB invalidations when handling
> > permission faults, which had the convenient property of making the
> > stage-2 updates visible to all CPUs in the system. However now we do a
> > local invalidation, and TLBI elision leads to vCPUs getting stuck in a
> > permission fault loop. Remember that the architecture permits the TLB to
> > cache translations that precipitate a permission fault.
>
> The effects of this are slightly overstated (got ahead of myself).
> EAGAIN only crops up if the cmpxchg() fails, we return 0 if the PTE
> didn't need to be updated.
>
> On the subsequent permission fault we'll do the right thing and
> invalidate the TLB, so this change is purely an optimization rather than
> a correctness issue.
Can you measure the actual effect of this change? In my (limited)
experience, I had to actually trick the guest into doing this, and
opportunistically invalidating TLBs didn't have any significant
benefit.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2023-09-24 10:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 22:32 [PATCH] KVM: arm64: Always invalidate TLB for stage-2 permission faults Oliver Upton
2023-09-22 23:08 ` Oliver Upton
2023-09-24 10:12 ` Marc Zyngier [this message]
2023-09-25 23:43 ` Oliver Upton
2023-09-29 9:17 ` Marc Zyngier
2023-09-30 18:12 ` Oliver Upton
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ttrj5181.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=james.morse@arm.com \
--cc=jingzhangos@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=oliver.upton@linux.dev \
--cc=stable@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=vipinsh@google.com \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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