From: Sean Christopherson <seanjc@google.com>
To: David Edmondson <david.edmondson@oracle.com>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Joerg Roedel <joro@8bytes.org>, Ingo Molnar <mingo@redhat.com>,
Jim Mattson <jmattson@google.com>,
kvm@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
David Matlack <dmatlack@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Wanpeng Li <wanpengli@tencent.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [PATCH v3 1/3] KVM: x86: kvm_x86_ops.get_exit_info should include the exit reason
Date: Thu, 29 Jul 2021 22:27:28 +0000 [thread overview]
Message-ID: <YQMrUOjZMD1eiIeE@google.com> (raw)
In-Reply-To: <20210729133931.1129696-2-david.edmondson@oracle.com>
Shortlog is a bit odd, "should" is subjective and makes this sound like a bug fix.
KVM: x86: Get exit_reason as part of kvm_x86_ops.get_exit_info
On Thu, Jul 29, 2021, David Edmondson wrote:
> Extend the get_exit_info static call to provide the reason for the VM
> exit. Modify relevant trace points to use this rather than extracting
> the reason in the caller.
>
> Signed-off-by: David Edmondson <david.edmondson@oracle.com>
> ---
> -static void svm_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2,
> +static void svm_get_exit_info(struct kvm_vcpu *vcpu, u64 *reason,
> + u64 *info1, u64 *info2,
> u32 *intr_info, u32 *error_code)
> {
> struct vmcb_control_area *control = &to_svm(vcpu)->vmcb->control;
>
> + *reason = control->exit_code;
> *info1 = control->exit_info_1;
> *info2 = control->exit_info_2;
> *intr_info = control->exit_int_info;
...
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index b484141ea15b..2228565beda2 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -273,11 +273,11 @@ TRACE_EVENT(kvm_apic,
>
> #define TRACE_EVENT_KVM_EXIT(name) \
> TRACE_EVENT(name, \
> - TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa), \
> - TP_ARGS(exit_reason, vcpu, isa), \
> + TP_PROTO(struct kvm_vcpu *vcpu, u32 isa), \
> + TP_ARGS(vcpu, isa), \
> \
> TP_STRUCT__entry( \
> - __field( unsigned int, exit_reason ) \
> + __field( u64, exit_reason ) \
Converting to a u64 is unnecessary and misleading. vmcs.EXIT_REASON and
vmcb.EXIT_CODE are both u32s, a.k.a. unsigned ints. There is vmcb.EXIT_CODE_HI,
but that's not being included, and AFAICT isn't even sanity checked by KVM.
> __field( unsigned long, guest_rip ) \
> __field( u32, isa ) \
> __field( u64, info1 ) \
next prev parent reply other threads:[~2021-07-29 22:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 13:39 [PATCH v3 0/3] kvm: x86: Convey the exit reason, etc. to user-space on emulation failure David Edmondson
2021-07-29 13:39 ` [PATCH v3 1/3] KVM: x86: kvm_x86_ops.get_exit_info should include the exit reason David Edmondson
2021-07-29 22:27 ` Sean Christopherson [this message]
2021-07-30 7:29 ` David Edmondson
2021-07-29 13:39 ` [PATCH v3 2/3] KVM: x86: On emulation failure, convey the exit reason, etc. to userspace David Edmondson
2021-07-30 22:14 ` Sean Christopherson
2021-08-02 7:28 ` David Edmondson
2021-08-02 16:58 ` Sean Christopherson
2021-08-02 17:23 ` David Edmondson
2021-08-07 0:59 ` Sean Christopherson
2021-07-29 13:39 ` [PATCH v3 3/3] KVM: x86: SGX must obey the KVM_INTERNAL_ERROR_EMULATION protocol David Edmondson
2021-07-30 22:17 ` Sean Christopherson
2021-08-02 7:18 ` David Edmondson
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=YQMrUOjZMD1eiIeE@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=david.edmondson@oracle.com \
--cc=dmatlack@google.com \
--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=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;
as well as URLs for NNTP newsgroup(s).