public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	x86@kernel.org, Wanpeng Li <wanpengli@tencent.com>,
	linux-kernel@vger.kernel.org, Jim Mattson <jmattson@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: Thoughts on sharing KVM tracepoints [was:Re: [PATCH 2/2] KVM: nVMX: trace nested vm entry]
Date: Mon, 25 Jan 2021 13:01:25 -0800	[thread overview]
Message-ID: <YA8xpfPtonJdxU2D@google.com> (raw)
In-Reply-To: <f1c90d8a44795bbdef549a5fcf375bcf1d52af93.camel@redhat.com>

On Mon, Jan 25, 2021, Maxim Levitsky wrote:
> On Thu, 2021-01-21 at 14:27 -0800, Sean Christopherson wrote:
> > I still don't see why VMX can't share this with SVM.  "npt' can easily be "tdp",
> > differentiating between VMCB and VMCS can be down with ISA, and VMX can give 0
> > for int_ctl (or throw in something else interesting/relevant).
> 
> I understand very well your point, and I don't strongly disagree with you.
> However let me voice my own thoughts on this:
>  
> I think that sharing tracepoints between SVM and VMX isn't necessarily a good idea.
> It does make sense in some cases but not in all of them.
>  
> The trace points are primarily intended for developers, thus they should capture as
> much as possible relevant info but not everything because traces can get huge.
>  
> Also despite the fact that a developer will look at the traces, some usability is welcome
> as well (e.g for new developers), and looking at things like info1/info2/intr_info/error_code
> isn't very usable

I'm not opposed to printing different names on VMX, e.g. exit_qual and
idt_vec_info, but I 100% think that VMX and SVM should share the bulk of the
code.  Improvements to VMX almost always apply in some way to SVM, and vice
versa.  It's all but guaranteed that splitting flows will eventually cause
divergence in a bad way.  Divergence in tracepoints is likely to be minor at
worst, but I don't think that's a good reason to intentionally split the code
when it's quite easy to share.

> (btw the error_code should at least be called intr_info_error_code, and

Heh, I disagree even on this.  IMO, after debugging a few times, associating
error_code with the event being injected is second nature.  Prepending
intr_info_ would just add extra characters and slow down mental processing.

> of course both it and intr_info are VMX specific).

Not really, SVM has the exact same fields with slightly different names.

> So I don't even like the fact that kvm_entry/kvm_exit are shared, and neither I want
> to add even more shared trace points.
>
> I understand that there are some benefits of sharing, namely a userspace tool can use
> the same event to *profile* kvm, but I am not sure that this is worth it.

Why is it not worth it?  It's a small amount of one-time kernel pain that allows
all users/developers to reuse scripts and tools across VMX and SVM.  Even manual
usage benefits, e.g. I don't have to remember that a tracepoint is 'x' on VMX
but 'y' on SVM.

> What we could have done is to have ISA (and maybe even x86) agnostic kvm_exit/kvm_entry
> tracepoints that would have no data attached to them, or have very little (like maybe RIP),
> and then have ISA specific tracepoints with the reset of the info.

That would probably end up as the least user friendly combination.  Usually I
enable a tracepoint to get more info, rarely am I interested in _just_ the
logging of the tracepoint itself.  The generic tracepoint would either be
useless and never enabled, or even worse would cause people to overlook the
vendor-specific variant.

> Same could be applied to kvm_nested_vmenter, although for this one I don't think that we
> need an ISA agnostic tracepoint.
>  
> Having said all that, I am not hell bent on this. If you really want it to be this way,
> I won't argue that much.
>  
> Thoughts?

  reply	other threads:[~2021-01-25 21:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 17:10 [PATCH 0/2] VMX: few tracing improvements Maxim Levitsky
2021-01-21 17:10 ` [PATCH 1/2] KVM: nSVM: move nested vmrun tracepoint to enter_svm_guest_mode Maxim Levitsky
2021-01-21 17:10 ` [PATCH 2/2] KVM: nVMX: trace nested vm entry Maxim Levitsky
2021-01-21 22:27   ` Sean Christopherson
2021-01-25 13:22     ` Thoughts on sharing KVM tracepoints [was:Re: [PATCH 2/2] KVM: nVMX: trace nested vm entry] Maxim Levitsky
2021-01-25 21:01       ` Sean Christopherson [this message]
2021-01-27 10:35         ` Paolo Bonzini

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=YA8xpfPtonJdxU2D@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --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=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --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