Skip to content

trace_hyp_printk() for pKVM/nVHE hypervisor

Vincent Donnefort kvmarm linux-arm-kernel 5 versions – Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 1 replyApplied
  2. v44 patches 1 replySuperseded
  3. v34 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v24 patches1 replySuperseded
v14 patches10 repliesSuperseded

Changes in v5 from the cover letter

- Move hyp_string_fmts into its own output section (Sashiko)
- const hyp_string_fmt declarations and definitions
- Guard trace_seq_used() before indexing seq->buffer in __hyp_trace_printk() (Sashiko)
- Fix format string quoting in REMOTE_EVENT_CUSTOM_PRINTK() (Sashiko)

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/4KVM: arm64: Allow early calls to pKVM host_share/unshare_hyparch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/hyp/nvhe/hyp-main.c+3 -30 replies
2/4KVM: arm64: Move kvm_define_hypevents.h to arch/arm64/kvm/arch/arm64/kvm/define_hypevents.h arch/arm64/kvm/hyp_trace.c+1 -10 replies
3/4tracing/remotes: Add REMOTE_EVENT_CUSTOM_PRINTK() helperinclude/trace/define_remote_events.h+16 -30 replies
4/4KVM: arm64: Add hyp_printk event to nVHE/pKVM hyparch/arm64/include/asm/kvm_hypevents.h arch/arm64/include/asm/kvm_hyptrace.h arch/arm64/kernel/image-vars.h +5 more+165 -20 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchFuad TabbaSteven Rostedt
1/4R-b T-b
2/4R-b T-b
3/4R-b T-b A-b
4/4R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/4] trace_hyp_printk() for pKVM/nVHE hypervisor

Hi all,

This series adds a hypervisor event "hyp_printk" which enables developers to log pretty much anything into the hypervisor tracing buffer, just like the kernel function trace_printk().

This enables rich logging from the hypervisor, while leaving all the string parsing burden to the kernel. This has been the main way of debugging pKVM in Android.

Even though not strictly related to trace_hyp_printk, I have added the following two patches:

* KVM: arm64: Allow early calls to pKVM host_share/unshare_hyp

This one mainly intends to support one of the new features I have posted here [1], which allows to enable tracing as early as possible. I have added it here to limit cross-posting.

* KVM: arm64: Move kvm_define_hypevents.h to arch/arm64/kvm/

This one is just a cleanup.

[1] https://lore.kernel.org/all/[email protected]/

Changelog:

v5:
- Move hyp_string_fmts into its own output section (Sashiko)
- const hyp_string_fmt declarations and definitions
- Guard trace_seq_used() before indexing seq->buffer in __hyp_trace_printk() (Sashiko)
- Fix format string quoting in REMOTE_EVENT_CUSTOM_PRINTK() (Sashiko)

v4 (https://lore.kernel.org/all/[email protected]/):
- Store nr_args in struct hyp_string_fmt instead of using ring_buffer_event_length() (Sashiko)

v3 (https://lore.kernel.org/all/[email protected]/):
- Collect Steven's tag
- Rebase on 7.3-rc3

v2 (https://lore.kernel.org/all/[email protected]/):
- Collect Fuad's tags
- Rebase on 7.2-rc2
- Warn when trace_hyp_printk callsites are exhausted (Fuad)

v1 (https://lore.kernel.org/all/[email protected]/)

Vincent Donnefort (4):
KVM: arm64: Allow early calls to pKVM host_share/unshare_hyp
KVM: arm64: Move kvm_define_hypevents.h to arch/arm64/kvm/ tracing/remotes: Add REMOTE_EVENT_CUSTOM_PRINTK() helper
KVM: arm64: Add hyp_printk event to nVHE/pKVM hyp

 arch/arm64/include/asm/kvm_asm.h              |  4 +-
 arch/arm64/include/asm/kvm_hypevents.h        | 14 ++++
 arch/arm64/include/asm/kvm_hyptrace.h         |  9 +++
 arch/arm64/kernel/image-vars.h                |  1 +
 arch/arm64/kernel/vmlinux.lds.S               |  8 +++
 .../define_hypevents.h}                       |  0
 .../kvm/hyp/include/nvhe/define_events.h      |  2 -
 arch/arm64/kvm/hyp/include/nvhe/trace.h       | 66 +++++++++++++++++++
 arch/arm64/kvm/hyp/nvhe/events.c              |  6 ++
 arch/arm64/kvm/hyp/nvhe/hyp-main.c            |  2 +-
 arch/arm64/kvm/hyp_trace.c                    | 63 +++++++++++++++++-
 include/trace/define_remote_events.h          | 19 +++++-
 12 files changed, 185 insertions(+), 9 deletions(-)
 rename arch/arm64/{include/asm/kvm_define_hypevents.h => kvm/define_hypevents.h} (100%)

base-commit: fd73f4a6659897191fa0d40695fe370925dd3780

Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog