Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Donnefort <vdonnefort@google.com>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: maz@kernel.org, oupton@kernel.org, kvmarm@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com,
	seiden@linux.ibm.com, suzuki.poulose@arm.com,
	yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org,
	kernel-team@android.com, qperret@google.com
Subject: Re: [PATCH v1 2/3] KVM: arm64: Add guest_hvc hyp event
Date: Fri, 9 Oct 2026 14:17:53 +0100	[thread overview]
Message-ID: <asjpgZDRmg54UfTm@google.com> (raw)
In-Reply-To: <CA+EHjTxzBBDpg3B9Lw47tMWMK+VCjpeEQDgYNKvLUnmUYVJVcA@mail.gmail.com>

On Fri, Oct 09, 2026 at 01:06:05PM +0100, Fuad Tabba wrote:
> Hi Vincent,
> 
> On Fri, 09 Oct 2026 09:45:28 +0100, Vincent Donnefort
> <vdonnefort@google.com> wrote:
> 
> > Add a guest_hvc hypervisor trace event to log protected VM HVC call IDs,
> > return values, and whether the call was handled by the hypervisor.
> 
> nit: only the first return value is logged.
> 
> [...]
> > diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h
> 
> [...]
> > +HYP_EVENT(guest_hvc,
> > +        HE_PROTO(u32 id, u64 val, u8 handled),
> > +        HE_STRUCT(
> > +                he_field(u8, handled)
> > +                he_field(u32, id)
> > +                he_field(u64, val)
> > +        ),
> 
> remote_event_format_show() doesn't align the field offsets, so the
> format file puts id at 3 and val at 7 instead of 4 and 8. hyp_enter's
> vcpu is already off the same way, so should this be a separate fix in
> trace_remote.c, with ALIGN(offset, field->align)?

Ha, absolutely, I'll send something to linux-trace. We don't have this issue in
Android kernel because the struct are __packed there.

> 
> [...]
> > diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> 
> [...]
> > @@ -1183,5 +1185,8 @@ bool kvm_handle_pvm_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code)
> >
> >          if (handled)
> >                  smccc_set_retval(vcpu, val[0], val[1], val[2], val[3]);
> > +
> > +        trace_guest_hvc(fn, val[0], handled);
> > +
> >          return handled;
> 
> When handled is false, val[0] is the SMCCC_RET_INVALID_PARAMETER
> initialiser, which the guest never gets. For example, a MEM_SHARE
> forwarded to the host logs "id=0xc6000003 val=0xfffffffffffffffd
> handled=0". Could this log 0 in that case?

Ack. That shouldn't be too difficult

> 
> Cheers,
> /fuad

-- 
Vincent


  reply	other threads:[~2026-10-09 13:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  8:45 [PATCH v1 0/3] KVM: arm64: pkvm: Extend hypervisor entering tracing reasons Vincent Donnefort
2026-10-09  8:45 ` [PATCH v1 1/3] KVM: arm64: Add ESR class to the hyp_enter hyp event Vincent Donnefort
2026-10-09 11:30   ` Fuad Tabba
2026-10-09 13:02     ` Vincent Donnefort
2026-10-09 14:08       ` Fuad Tabba
2026-10-09  8:45 ` [PATCH v1 2/3] KVM: arm64: Add guest_hvc " Vincent Donnefort
2026-10-09 12:06   ` Fuad Tabba
2026-10-09 13:17     ` Vincent Donnefort [this message]
2026-10-09  8:45 ` [PATCH v1 3/3] KVM: arm64: Add host_hvc " Vincent Donnefort
2026-10-09 12:26   ` Fuad Tabba
2026-10-09 13:20     ` Vincent Donnefort
2026-10-09 13:50 ` [PATCH v1 0/3] KVM: arm64: pkvm: Extend hypervisor entering tracing reasons 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=asjpgZDRmg54UfTm@google.com \
    --to=vdonnefort@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=qperret@google.com \
    --cc=seiden@linux.ibm.com \
    --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