From: Dario Faggioli <dfaggioli@suse.com>
To: Sean Christopherson <seanjc@google.com>,
Stefano De Venuto <stefano.devenuto99@gmail.com>
Cc: linux-kernel@vger.kernel.org, pbonzini@redhat.com,
vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com,
x86@kernel.org, hpa@zytor.com, kvm@vger.kernel.org,
rostedt@goodmis.org, y.karadz@gmail.com
Subject: Re: [PATCH] Move VMEnter and VMExit tracepoints closer to the actual event
Date: Fri, 21 May 2021 09:51:14 +0200 [thread overview]
Message-ID: <5e6ad92a72e139877fa0e7a1d77682a075060d16.camel@suse.com> (raw)
In-Reply-To: <YKaBEn6oUXaVAb0K@google.com>
[-- Attachment #1: Type: text/plain, Size: 3063 bytes --]
Hi Sean,
On Thu, 2021-05-20 at 15:32 +0000, Sean Christopherson wrote:
> On Wed, May 19, 2021, Stefano De Venuto wrote:
> >
> > This patch moves the tracepoints closer to the events, for both
> > Intel
> > and AMD, so that a combined host-guest trace will offer a more
> > realistic representation of what is really happening, as shown
> > here:
> >
> > trace.dat: CPU 0/KVM-2553 [000] 2.190290: write_msr:
> > 48, value 0
>
> I'm not sure this is a good thing, as it's not clear to me that
> invoking tracing
> with the guest's SPEC_CTRL loaded is desirable. Maybe it's a non-
> issue, but it
> should be explicitly called out and discussed.
>
Oh, this is actually a very good point. Considering the rest of the
review comments, it looks like we're not putting the tracepoint past
the SPEC_CTRL msr-write, not for now at least. :-) But I agree that it
must be explicitly considered and thought about, if/when trying to do
it again.
> And to some extent, the current behavior is _more_ accurate because
> it shows that
> KVM started its VM-Enter sequence and then the WRMSR occured as part
> of that
> sequence. It is writing the guest's value after all. Ditto for
> XCR0, XSS, PKRU,
> Intel PT, etc...
>
Yaah, I guess it comes to what we want/assume the meaning of the
VMEnter/Exit tracepoints to be. I.e., is it the beginning of the
sequence of operations necessary to enter a guest, or the exact point
in time where we switch to it (and vice-versa, for exit)?
In my view and in my experience of trying to trace host and guest at
the same time, I find the latter more useful, but I appreciate that the
former is valid too especially considering that, as you say, some
operations are altering the guest's state already.
> A more concrete example would be perf; on VMX, if a perf NMI happens
> after KVM
> invokes atomic_switch_perf_msrs() then I absolutely want to see that
> reflected
> in the trace, e.g. to help debug the PEBS mess[*]. If the VM-Enter
> tracepoint
> is moved closer to VM-Enter, that may or may not hold true depending
> on where the
> NMI lands.
>
> On VMX, I think the tracepoint can be moved below the VMWRITEs
> without much
> contention (though doing so is likely a nop), but moving it below
> kvm_load_guest_xsave_state() requires a bit more discussion.
>
Ok, well, IMO closer is better, even if no past XSAVE state handling.
:-) Let us look into this a little bit.
> I 100% agree that the current behavior can be a bit confusing, but I
> wonder if
> we'd be better off "solving" that problem through documentation.
>
Indeed. So, do you happen to have in mind what could be the best place
and the best way for documenting this?
Thanks and Regards
--
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-05-21 7:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 18:23 Stefano De Venuto
2021-05-20 6:05 ` Dario Faggioli
2021-05-20 7:21 ` Thomas Gleixner
2021-05-21 7:13 ` Dario Faggioli
2021-05-20 15:32 ` Sean Christopherson
2021-05-20 16:18 ` Paolo Bonzini
2021-05-21 7:58 ` Dario Faggioli
2021-05-28 16:55 ` Dario Faggioli
2021-05-28 16:57 ` Paolo Bonzini
2021-05-21 7:51 ` Dario Faggioli [this message]
2021-05-25 16:20 ` Sean Christopherson
2021-05-28 17:03 ` Dario Faggioli
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=5e6ad92a72e139877fa0e7a1d77682a075060d16.camel@suse.com \
--to=dfaggioli@suse.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=stefano.devenuto99@gmail.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
--cc=y.karadz@gmail.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
all inboxes | Powered by JetHome®