[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aS28dyrKgZaOmMNr@google.com>
Date: Mon, 1 Dec 2025 16:04:07 +0000
From: Vincent Donnefort <vdonnefort@...gle.com>
To: Marc Zyngier <maz@...nel.org>
Cc: rostedt@...dmis.org, mhiramat@...nel.org,
mathieu.desnoyers@...icios.com, linux-trace-kernel@...r.kernel.org,
oliver.upton@...ux.dev, joey.gouly@....com, suzuki.poulose@....com,
yuzenghui@...wei.com, kvmarm@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, jstultz@...gle.com,
qperret@...gle.com, will@...nel.org, aneesh.kumar@...nel.org,
kernel-team@...roid.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 26/28] KVM: arm64: Add hyp_enter/hyp_exit events to
pKVM hyp
On Sun, Nov 30, 2025 at 07:00:52PM +0000, Marc Zyngier wrote:
> On Fri, 07 Nov 2025 09:38:38 +0000,
> Vincent Donnefort <vdonnefort@...gle.com> wrote:
> >
> > The hyp_enter and hyp_exit events are logged by the hypervisor any time
> > it is entered and exited.
> >
> > Signed-off-by: Vincent Donnefort <vdonnefort@...gle.com>
> >
> > diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h
> > index d6e033c96c52..ce3953bc884a 100644
> > --- a/arch/arm64/include/asm/kvm_hypevents.h
> > +++ b/arch/arm64/include/asm/kvm_hypevents.h
> > @@ -7,4 +7,21 @@
> > #include <nvhe/trace.h>
> > #endif
> >
> > +HYP_EVENT(hyp_enter,
> > + HE_PROTO(void),
> > + HE_STRUCT(
> > + ),
> > + HE_ASSIGN(
> > + ),
> > + HE_PRINTK()
> > +);
> > +
> > +HYP_EVENT(hyp_exit,
> > + HE_PROTO(void),
> > + HE_STRUCT(
> > + ),
> > + HE_ASSIGN(
> > + ),
> > + HE_PRINTK()
> > +);
> > #endif
> > diff --git a/arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h b/arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h
> > new file mode 100644
> > index 000000000000..4b69d33e4f2d
> > --- /dev/null
> > +++ b/arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h
> > @@ -0,0 +1,13 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +
> > +#include <asm/kvm_hypevents.h>
> > +
> > +#include <linux/arm-smccc.h>
> > +
> > +#undef arm_smccc_1_1_smc
> > +#define arm_smccc_1_1_smc(...) \
> > + do { \
> > + trace_hyp_exit(); \
> > + __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__); \
> > + trace_hyp_enter(); \
> > + } while (0)
>
> Huh. No, please. Don't override existing kernel constructs behind
> everybody's back. I know that tracing folks love to play that sort of
> game, but I really don't want any of that here.
And you haven't seen what I had for arm_smccc_1_2_smc()
>
> Just define a wrapper that is KVM-specific, and use that.
>
> Then from a semantic perspective, an SMC call, an ERET back to EL1
> host, and an ERET back to EL1 guest are all very different events that
> you lump under the "exit" category. That's not right. Same thing for
> "enter".
The idea of those events is just to know when we enter and exit the hypervisor,
purely from a timing point of view. In ACK, we already have other separated
events that can give the "cause" for entering or exiting the hypervisor. I
haven't added them to that series because I thought it was big enough.
So happy to add now or do a follow-up, once we're done with that one?
>
> Thanks,
>
> M.
>
> --
> Jazz isn't dead. It just smells funny.
Powered by blists - more mailing lists