public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Mingwei Zhang <mizhang@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	David Matlack <dmatlack@google.com>
Subject: Re: [PATCH v4 3/3] KVM: x86: Print guest pgd in kvm_nested_vmenter()
Date: Tue, 30 Aug 2022 21:29:48 +0000	[thread overview]
Message-ID: <Yw6BTJ1HpPdYR2E0@google.com> (raw)
In-Reply-To: <20220825225755.907001-4-mizhang@google.com>

On Thu, Aug 25, 2022, Mingwei Zhang wrote:
> ---
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index e7f0da9474f0..b2be0348bb14 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -591,9 +591,10 @@ TRACE_EVENT(kvm_pv_eoi,
>   */
>  TRACE_EVENT(kvm_nested_vmenter,
>  	    TP_PROTO(__u64 rip, __u64 vmcb, __u64 nested_rip, __u32 int_ctl,
> -		     __u32 event_inj, bool tdp_enabled, __u32 isa),
> +		     __u32 event_inj, bool tdp_enabled, __u64 guest_tdp,

s/guest_tdp_pgd to differentiate it from "tdp_enabled"


>         TP_printk("rip: 0x%016llx %s: 0x%016llx nested_rip: 0x%016llx "
> -                 "int_ctl: 0x%08x event_inj: 0x%08x nested_%s: %s",
> +                 "int_ctl: 0x%08x event_inj: 0x%08x nested_%s: %s, "
> +                 "guest_pgd: 0x%016llx",

It's a little gross, but this can spit out nested_eptp vs. nested_cr3 vs. guest_cr3.

>                 __entry->rip,
>                 __entry->isa == KVM_ISA_VMX ? "vmcs" : "vmcb",
>                 __entry->vmcb,

> @@ -624,7 +628,8 @@ TRACE_EVENT(kvm_nested_vmenter,
>  		__entry->int_ctl,
>  		__entry->event_inj,
>  		__entry->isa == KVM_ISA_VMX ? "ept" : "npt",
> -		__entry->tdp_enabled ? "on" : "off")
> +		__entry->tdp_enabled ? "on" : "off",

To keep things aligned, and because "on nested_eptp" reads as a combined
snippet

  event_inj: 0x00000000 nested_ept: off guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept: off guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept: on nested_eptp: 0x0000000007ec501e
  event_inj: 0x00000000 nested_ept: on nested_eptp: 0x0000000007ec501e

what about teaking the format so that the output looks like this?

  event_inj: 0x00000000 nested_ept=n guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept=n guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept=y nested_eptp: 0x0000000007ec501e
  event_inj: 0x00000000 nested_ept=y nested_eptp: 0x0000000007ec501e

Deviating from the ": " style bothers me, but I find this difficult to read.
Again, letters delimited by whitespace get visually clumped together.

  event_inj: 0x00000000 nested_ept: n guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept: n guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept: y nested_eptp: 0x0000000007ec501e
  event_inj: 0x00000000 nested_ept: y nested_eptp: 0x0000000007ec501e

And this looks like a typo

  event_inj: 0x00000000 nested_ept:n guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept:n guest_cr3: 0x0000000001007000
  event_inj: 0x00000000 nested_ept:y nested_eptp: 0x0000000007ec501e
  event_inj: 0x00000000 nested_ept:y nested_eptp: 0x0000000007ec501e

We could leave off the nested_{ept/npt} entirely and leave the differentation to
the nested_eptp vs. nested_cr3 vs. guest_cr3, but I don't think that's worth
shaving a few chars.

  reply	other threads:[~2022-08-30 21:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 22:57 [PATCH v4 0/3] Extend KVM trace_kvm_nested_vmrun() to support VMX Mingwei Zhang
2022-08-25 22:57 ` [PATCH v4 1/3] KVM: x86: Update trace function for nested VM entry " Mingwei Zhang
2022-08-30 20:31   ` Sean Christopherson
2022-08-25 22:57 ` [PATCH v4 2/3] KVM: nVMX: Add tracepoint for nested vmenter Mingwei Zhang
2022-08-25 22:57 ` [PATCH v4 3/3] KVM: x86: Print guest pgd in kvm_nested_vmenter() Mingwei Zhang
2022-08-30 21:29   ` Sean Christopherson [this message]
2022-08-30 20:29 ` [PATCH v4 0/3] Extend KVM trace_kvm_nested_vmrun() to support VMX Sean Christopherson

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=Yw6BTJ1HpPdYR2E0@google.com \
    --to=seanjc@google.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mizhang@google.com \
    --cc=pbonzini@redhat.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