From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Maxim Levitsky <mlevitsk@redhat.com>,
kvm@vger.kernel.org, Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH v2 0/4] KVM: x86: tracepoint updates
Date: Tue, 26 Sep 2023 13:45:24 -0700 [thread overview]
Message-ID: <ZRNC5IKXDq1yv0v3@google.com> (raw)
In-Reply-To: <ef6a0ebf-cb5f-0bb0-f453-0e9e0fdc87d5@redhat.com>
On Tue, Sep 26, 2023, Paolo Bonzini wrote:
> On 9/26/23 10:28, Maxim Levitsky wrote:
> > > trace_kvm_exit is good example, where despite all of the information that is captured
> > > by KVM, it's borderline worthless for CPUID and MSR exits because their interesting
> > > information is held in registers and not captured in the VMCS or VMCB.
> > >
> > > There are some on BTF type info issues that I've encountered, but I suspect that's
> > > as much a PEBKAC problem as anything.
> > >
> > While eBPF has its use cases, none of the extra tracepoints were added solely because of
> > the monitoring tool and I do understand that tracepoints are a limited resource.
> >
> > Each added tracepoint/info was added only when it was also found to be useful for regular
> > kvm tracing.
>
> I am not sure about _all_ of them, but I agree with both of you.
>
> On one hand, it would be pretty cool to have eBPF access to registers. On
> the other hand, the specific info you're adding is generic and I think there
> are only a couple exceptions where I am not sure it belongs in the generic
> KVM tracepoints.
I'm not saying this information isn't useful, *sometimes*. What I'm saying is
that I don't think it's sustainable/maintainble to keep expanding KVM's tracepoints.
E.g. why trace req_immediate_exit and not mmu_invalidate_seq[*]?
It's practically impossible to predict exactly what information will be useful in
the field. And for something like kvmon, IMO the onus is on userspace to do the
heavy lifting.
Rather than hardcode mounds of information in KVM's tracepoints, I think we should
refactor KVM to make it as easy as possible to use BPF to piggyback tracepoints
and get at data that *might* be interesting, and then add a variety of BPF programs
(e.g. using bpftrace for simplicity) somewhere in tools/ to provide equivalent
functionality to select existing tracepoints.
E.g. if we rework kvm_vcpu to place "struct kvm_vcpu_arch arch" at offset '0',
then we get at all the GPRs and pseudo-registers by hardcoding offsets into the
struct, i.e. without needing BTF type info. More elaborate trace programs would
likely need BTF, or maybe some clever shenanigans, but it seems very doable.
[*] https://lore.kernel.org/all/ZOaUdP46f8XjQvio@google.com
prev parent reply other threads:[~2023-09-26 20:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 12:44 [PATCH v2 0/4] KVM: x86: tracepoint updates Maxim Levitsky
2023-09-24 12:44 ` [PATCH v2 1/4] KVM: x86: refactor req_immediate_exit logic Maxim Levitsky
2023-09-26 16:37 ` Paolo Bonzini
2023-09-28 10:41 ` Maxim Levitsky
2023-09-24 12:44 ` [PATCH v2 2/4] KVM: x86: add more information to the kvm_entry tracepoint Maxim Levitsky
2023-09-26 16:39 ` Paolo Bonzini
2023-09-28 10:41 ` Maxim Levitsky
2023-09-24 12:44 ` [PATCH v2 3/4] KVM: x86: add more information to kvm_exit tracepoint Maxim Levitsky
2023-09-26 16:40 ` Paolo Bonzini
2023-09-28 10:41 ` Maxim Levitsky
2023-09-24 12:44 ` [PATCH v2 4/4] KVM: x86: add new nested vmexit tracepoints Maxim Levitsky
2023-09-26 16:50 ` Paolo Bonzini
2023-09-28 10:42 ` Maxim Levitsky
2023-09-26 0:03 ` [PATCH v2 0/4] KVM: x86: tracepoint updates Sean Christopherson
2023-09-26 8:28 ` Maxim Levitsky
2023-09-26 16:36 ` Paolo Bonzini
2023-09-26 20:45 ` Sean Christopherson [this message]
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=ZRNC5IKXDq1yv0v3@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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