From patchwork Mon Aug 25 07:58:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 4773071 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7D017C0338 for ; Mon, 25 Aug 2014 07:56:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9BD29200CF for ; Mon, 25 Aug 2014 07:56:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B90952012E for ; Mon, 25 Aug 2014 07:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754652AbaHYH4M (ORCPT ); Mon, 25 Aug 2014 03:56:12 -0400 Received: from mga09.intel.com ([134.134.136.24]:44155 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753889AbaHYH4K (ORCPT ); Mon, 25 Aug 2014 03:56:10 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 25 Aug 2014 00:50:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,395,1406617200"; d="scan'208";a="562977832" Received: from unknown (HELO vt-ivt2.tsp.org) ([10.239.48.107]) by orsmga001.jf.intel.com with ESMTP; 25 Aug 2014 00:56:05 -0700 From: Wanpeng Li To: Paolo Bonzini Cc: Marcelo Tosatti , Gleb Natapov , Zhang Yang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH] KVM: x86: fix xen guest panic due to lack of KVM_REQ_EVENT Date: Mon, 25 Aug 2014 15:58:26 +0800 Message-Id: <1408953506-7289-1-git-send-email-wanpeng.li@linux.intel.com> X-Mailer: git-send-email 1.7.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)