public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Wanpeng Li <wanpeng.li@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Gleb Natapov <gleb@kernel.org>,
	Zhang Yang <yang.z.zhang@intel.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wanpeng Li <wanpeng.li@linux.intel.com>
Subject: [PATCH] KVM: x86: fix xen guest panic due to lack of KVM_REQ_EVENT
Date: Mon, 25 Aug 2014 15:58:26 +0800	[thread overview]
Message-ID: <1408953506-7289-1-git-send-email-wanpeng.li@linux.intel.com> (raw)

This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=82211

(XEN) ..MP-BIOS bug: 8254 timer not connected to IO-APIC
(XEN) ...trying to set up timer (IRQ0) through the 8259A ...  failed.
(XEN) ...trying to set up timer as Virtual Wire IRQ... failed.
(XEN) ...trying to set up timer as ExtINT IRQ... failed :(.
(XEN) 
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) IO-APIC + timer doesn't work!  Boot with apic_verbosity=debug and send a report.
(XEN) ****************************************

Commit 6addfc42992b ("KVM: x86: avoid useless set of KVM_REQ_EVENT after 
emulation") sets a KVM_REQ_EVENT if an interrupt could be injected, which 
happens a) if an interrupt shadow bit (STI or MOV SS) has gone away; b) 
if the interrupt flag has just been set. However, a KVM_REQ_EVENT should 
be set if there is no sti sequence. This patch fix it by set a KVM_REQ_EVENT 
if both the first and the second instructions are not sti.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 arch/x86/kvm/x86.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c10408e..b7c0073 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4928,6 +4928,8 @@ static void toggle_interruptibility(struct kvm_vcpu *vcpu, u32 mask)
 		if (!mask)
 			kvm_make_request(KVM_REQ_EVENT, vcpu);
 	}
+	if (!(int_shadow || mask))
+		kvm_make_request(KVM_REQ_EVENT, vcpu);
 }
 
 static void inject_emulated_exception(struct kvm_vcpu *vcpu)
-- 
1.9.1


             reply	other threads:[~2014-08-25  7:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25  7:58 Wanpeng Li [this message]
2014-08-25  9:01 ` [PATCH] KVM: x86: fix xen guest panic due to lack of KVM_REQ_EVENT Paolo Bonzini
2014-08-25  9:08   ` Wanpeng Li
2014-08-25  9:16     ` Paolo Bonzini
2014-08-25  9:40       ` Wanpeng Li
2014-08-26  4:07       ` Wanpeng Li

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=1408953506-7289-1-git-send-email-wanpeng.li@linux.intel.com \
    --to=wanpeng.li@linux.intel.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=yang.z.zhang@intel.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