linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: rkrcmar@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org
Subject: Re: [PATCH] kvm/x86/vmx: report KVM_SYSTEM_EVENT_CRASH on triple fault
Date: Tue, 28 Mar 2017 03:51:01 -0400 (EDT)	[thread overview]
Message-ID: <2101391670.8452799.1490687461888.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <f6ad65ee00ce0207701293200f6aa4d691cac3f8.1490642724.git.jpoimboe@redhat.com>


> While debugging a kernel issue, I found that QEMU always reboots when an
> x86 triple fault occurs, which complicates debugging.  QEMU and libvirt
> have a facility for creating a dump when KVM reports
> KVM_SYSTEM_EVENT_CRASH.  So change the VMX triple fault handler to do
> that.  This gives user space the ability to decide whether to dump,
> pause, shutdown, or reboot.

You probably want QEMU's -no-reboot option.

Triple faults are already reported to userspace with KVM_EXIT_SHUTDOWN,
and it's up to userspace to decide what to do with it.  This patch cannot
be applied, because there are guests that do a triple-fault intentionally
in order to reset the machine.

Paolo

> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  arch/x86/kvm/vmx.c         | 3 ++-
>  include/trace/events/kvm.h | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 3acde66..1f2694c 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5731,7 +5731,8 @@ static int handle_external_interrupt(struct kvm_vcpu
> *vcpu)
>  
>  static int handle_triple_fault(struct kvm_vcpu *vcpu)
>  {
> -	vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN;
> +	vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
> +	vcpu->run->system_event.type = KVM_SYSTEM_EVENT_CRASH;
>  	return 0;
>  }
>  
> diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
> index 8ade3eb..200a3d7 100644
> --- a/include/trace/events/kvm.h
> +++ b/include/trace/events/kvm.h
> @@ -14,7 +14,8 @@
>  	ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR),	\
>  	ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
>  	ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL),	\
> -	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH)
> +	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH),		\
> +	ERSN(SYSTEM_EVENT)
>  
>  TRACE_EVENT(kvm_userspace_exit,
>  	    TP_PROTO(__u32 reason, int errno),
> --
> 2.7.4
> 
> 

  reply	other threads:[~2017-03-28  7:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 19:25 [PATCH] kvm/x86/vmx: report KVM_SYSTEM_EVENT_CRASH on triple fault Josh Poimboeuf
2017-03-28  7:51 ` Paolo Bonzini [this message]
2017-03-28 11:46   ` Josh Poimboeuf
2017-03-28 12:39     ` Paolo Bonzini
2017-03-28 15:51       ` Josh Poimboeuf

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=2101391670.8452799.1490687461888.JavaMail.zimbra@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.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).