From: Congkai Tan <congkai@amazon.com>
To: <oupton@kernel.org>
Cc: <blakgeof@amazon.com>, <catalin.marinas@arm.com>,
<congkai@amazon.com>, <harisokn@amazon.com>, <joey.gouly@arm.com>,
<kvmarm@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <mark.rutland@arm.com>,
<maz@kernel.org>, <suzuki.poulose@arm.com>, <will@kernel.org>,
<yuzenghui@huawei.com>
Subject: Re: [PATCH] KVM: arm64: Expose PMMIR_EL1.SLOTS to guests
Date: Tue, 9 Jun 2026 20:56:21 +0000 [thread overview]
Message-ID: <20260609205621.2327622-1-congkai@amazon.com> (raw)
In-Reply-To: <aieclTmL1op0AYfS@kernel.org>
On Mon, Jun 08, 2026 at 09:54:45PM -0700, Oliver Upton wrote:
> > - set_pmmir() writes pmmir_slots to 0 if the user input is 0;
> > otherwise it no-ops or rejects.
>
> Reject is always better heh :)
For sure. Just to see what happens when migrating a guest onto a PMU
with different SLOTS - after pmmir_slots is set to the new value, the VMM
tries to restore the original non-zero SLOTS via SET_ONE_REG and gets the
error. I think it's a good design to force VMMs to be aware of SLOTS
changes?
> So I was previously under the impression that we already expose PMMIR_EL1
> to userspace but we actually don't. Grr.
>
> The UAPI around PMUv3 is crappy enough that we should just add a new
> vCPU feature flag. When that flag is set:
>
> - KVM will not create a 'default' PMU, userspace must select a PMU
> implementation to init the vCPU
>
> - PMMIR_EL1 becomes a user-visible register with the behavior that you
> outline above
>
> - No PMCEID masking for STALL_SLOT* events
>
> There's a couple larger PMU features underway (e.g. Colton's partitioned
> PMU, Akihiko's fixed counters PMU) that we can also condition on the new
> feature flag.
It makes sense to guard everything behind a flag. Just to confirm my
understanding, by "a new vCPU feature flag" are you referring to
extending the features set through KVM_ARM_VCPU_INIT? If so,
since the flag may guard more PMU features later, do you have a preferred
name in mind that best reflects its planned usage?
For v2 I'll work on 3 patches:
- Patch 1 adds the flag, skips the default PMU selection behind it, and
checks for/rejects absent PMU
- Patch 2 implements the new PMMIR_EL1 behavior
- Patch 3 implements the new PMCEID1 behavior
Thanks,
Congkai
next prev parent reply other threads:[~2026-06-09 20:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 19:39 [PATCH] KVM: arm64: Expose PMMIR_EL1.SLOTS to guests Congkai Tan
2026-06-01 20:06 ` Oliver Upton
2026-06-01 20:13 ` Oliver Upton
2026-06-08 21:03 ` Congkai Tan
2026-06-09 4:54 ` Oliver Upton
2026-06-09 20:56 ` Congkai Tan [this message]
2026-06-02 4:14 ` kernel test robot
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=20260609205621.2327622-1-congkai@amazon.com \
--to=congkai@amazon.com \
--cc=blakgeof@amazon.com \
--cc=catalin.marinas@arm.com \
--cc=harisokn@amazon.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--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