All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Marc Zyngier <maz@kernel.org>
Cc: kvmarm@lists.linux.dev, James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
Subject: Re: [PATCH 0/3] KVM: arm64: nv: Add EL2 PMU event filtering support
Date: Mon, 26 Aug 2024 17:26:36 +0000	[thread overview]
Message-ID: <Zsy6zNQT2o6sTidY@linux.dev> (raw)
In-Reply-To: <86v7zpvwym.wl-maz@kernel.org>

Hey,

On Sun, Aug 25, 2024 at 09:16:33AM +0100, Marc Zyngier wrote:
> On Sat, 24 Aug 2024 01:13:59 +0100,
> Oliver Upton <oliver.upton@linux.dev> wrote:
> > 
> > We allow a nested VM to be configured with a vPMU, although it isn't
> > entirely functional. We do not currently respect the EL2 event filter
> > configuration from the guest hypervisor, which really needs to be
> > applied to EL1 when in a hyp context.
> > 
> > Series to do just that. Tested on Neoverse-V2 which fortunately
> > implements PMUv3 and NV, unlike the fruity stuff I'm typically using...
> > 
> > Oliver Upton (3):
> >   KVM: arm64: Add helpers to determine if PMC counts at a given EL
> >   KVM: arm64: nv: Honor NSH filter when in hyp context
> >   KVM: arm64: nv: Reprogram PMU events affected by nested transition
> > 
> >  arch/arm64/kvm/emulate-nested.c |  4 ++
> >  arch/arm64/kvm/pmu-emul.c       | 77 ++++++++++++++++++++++++++++-----
> >  include/kvm/arm_pmu.h           |  3 ++
> >  3 files changed, 72 insertions(+), 12 deletions(-)
> > 
> > 
> > base-commit: 7c626ce4bae1ac14f60076d00eafe71af30450ba
> 
> I had a quick look, and definitely like the way it is shaping up (it
> does the job without fuss, and NV isn't about performance anyway).
> 
> However, I think it needs a bit more work so that MDCR_EL2.HPMN is
> correctly handled. This shouldn't be hard to do, and if FEAT_FGT is
> supported in the guest, then we could even expose FEAT_HPMN0 (though I
> haven't worked out yet why FGT is a dependency).

Right, I was hoping to spoon-feed some more PMU patches going forward,
since we already allow the NV+PMU combination and can treat it as a 'bugfix'.
But I'm happy to throw some more cycles at the problem.

I think there are some gaps in the way the other coarse-grained PMU
traps are handled (TPM, TPMCR), since it looks like they also apply to
Host EL0 based on the pseudocode. I don't want to have a separate
mechanism for describing these 'InHost' traps, so I'm gonna try and
address this like so:

 - Indicate if CGTs apply to host EL0 in the trap_bits descriptor

 - Steal a trap_config bit to indicate if a sysreg can trap while
   InHost, and:

 - Mark a trap_config as InHost if any of the associated CGTs are
   InHost when inserting in the xarray

That way I can preserve the early return for is_hyp_ctxt() for all but a
few trap configs.

Thoughts?

-- 
Thanks,
Oliver

  reply	other threads:[~2024-08-26 17:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-24  0:13 [PATCH 0/3] KVM: arm64: nv: Add EL2 PMU event filtering support Oliver Upton
2024-08-24  0:14 ` [PATCH 1/3] KVM: arm64: Add helpers to determine if PMC counts at a given EL Oliver Upton
2024-08-24  0:14 ` [PATCH 2/3] KVM: arm64: nv: Honor NSH filter when in hyp context Oliver Upton
2024-08-24  0:14 ` [PATCH 3/3] KVM: arm64: nv: Reprogram PMU events affected by nested transition Oliver Upton
2024-08-25  8:16 ` [PATCH 0/3] KVM: arm64: nv: Add EL2 PMU event filtering support Marc Zyngier
2024-08-26 17:26   ` Oliver Upton [this message]
2024-08-27  6:35     ` Marc Zyngier
2024-08-27  7:01       ` Oliver Upton
2024-08-27  7:59         ` 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:
  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=Zsy6zNQT2o6sTidY@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=gankulkarni@os.amperecomputing.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.