From patchwork Mon Feb 6 23:32:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Gao X-Patchwork-Id: 9559273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5805160216 for ; Tue, 7 Feb 2017 06:36:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47EF3269DA for ; Tue, 7 Feb 2017 06:36:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CA9427FC0; Tue, 7 Feb 2017 06:36:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 47947269DA for ; Tue, 7 Feb 2017 06:36:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cazLz-0007ae-0A; Tue, 07 Feb 2017 06:34:14 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cazLy-0007aM-3W for xen-devel@lists.xenproject.org; Tue, 07 Feb 2017 06:34:14 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 53/6F-21675-56A69985; Tue, 07 Feb 2017 06:34:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsXS1taRopuSNTP C4NQrK4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNePhWfOCfRIV91pjGhiXCHQxcnIICVRI/Dv5 lRHElhDglTiybAZrFyMHkO0vcWOHI0RJucTyNz2sIDaLgIrEu8V/mUBsNgFliYtfe9lAbBEBJ Yl7qyYDxbk4mAWOMkpsWvkfbKawgLXEhp8QDbwCFhIbJh5lBCniFfjCKPFy2zGohKDEyZlPWE BsZgEtiRv/XjKBHMEsIC2x/B8HSFgUaPGUk9vYJjDyz0LSMQtJxyyEjgWMzKsYNYpTi8pSi3S NjfSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQLDjwEIdjCeXhd4iFGSg0lJlLfQ a2aEEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneiEygnGBRanpqRVpmDjASYNISHDxKIryzMoDSv MUFibnFmekQqVOMuhynbpx+ySTEkpeflyolzhsKMkMApCijNA9uBCwqLzHKSgnzMgIdJcRTkF qUm1mCKv+KUZyDUUmYNwZkCk9mXgncpldARzABHbHtyjSQI0oSEVJSDYzi6m8yThmnq+ixTWP /e9pp09R3DwMYp0wQuZu+Nl0i8ZFavm76LuXLAifXvov4ND3nq+bntKD8y9rXAnT4c2K3Rrxf Ei7rKP7u1fcncvvSTz80vjbHN3gjYxTHqSNVBt9XtDE9TllrWslyI7pz232P4PilP6d8Lqx6l HFWfNIehl1znlyfXsStxFKckWioxVxUnAgAAwH1w8UCAAA= X-Env-Sender: chao.gao@intel.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1486449250!56311079!1 X-Originating-IP: [134.134.136.100] X-SpamReason: No, hits=0.8 required=7.0 tests=DATE_IN_PAST_06_12 X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20937 invoked from network); 7 Feb 2017 06:34:12 -0000 Received: from mga07.intel.com (HELO mga07.intel.com) (134.134.136.100) by server-8.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Feb 2017 06:34:12 -0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 06 Feb 2017 22:34:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,345,1477983600"; d="scan'208";a="930967882" Received: from skl-2s3.sh.intel.com ([10.239.48.35]) by orsmga003.jf.intel.com with ESMTP; 06 Feb 2017 22:34:08 -0800 Date: Tue, 7 Feb 2017 07:32:47 +0800 From: Chao Gao To: xen-devel@lists.xenproject.org Message-ID: <20170206233245.GA8766@skl-2s3.sh.intel.com> Mail-Followup-To: xen-devel@lists.xenproject.org, Kevin Tian , Jan Beulich , Andrew Cooper , Jun Nakajima , xuquan8@huawei.com, tianyu.lan@intel.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: tianyu.lan@intel.com, Kevin Tian , Jan Beulich , Andrew Cooper , xuquan8@huawei.com, Jun Nakajima Subject: [Xen-devel] [PATCH] X86/vmx: Dump PIR and vIRR before ASSERT() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit c7bdecae42 ("x86/apicv: fix RTC periodic timer and apicv issue") has added a assertion that intack.vector is the highest priority vector. But according to the osstest, the assertion failed sometimes. More discussion can be found in the thread (https://lists.xenproject.org/archives/html/xen-devel/2017-01/msg01019.html). The assertion failure is hard to reproduce. In order to root cause issue, this patch is to add logs to dump PIR and vIRR when failure takes place. It should be reverted once the root cause is found. Signed-off-by: Chao Gao Reviewed-by: Jan Beulich Acked-by: Kevin Tian --- xen/arch/x86/hvm/vmx/intr.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index 24e4505..5e5b37a 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -318,6 +319,48 @@ void vmx_intr_assist(void) */ if ( pt_vector != -1 ) { + /* + * We assert that intack.vector is the highest priority vector for + * only an interrupt from vlapic can reach this point and the + * highest vector is chosen in hvm_vcpu_has_pending_irq(). + * But, in fact, the assertion failed sometimes. It is suspected + * that PIR is not synced to vIRR which makes pt_vector is left in + * PIR. In order to verify this suspicion, dump some information + * when the assertion fails. + */ + if ( unlikely(intack.vector < pt_vector) ) + { + struct vlapic *vlapic; + struct pi_desc *pi_desc; + uint32_t *word; + int i; + + printk("Assertion failed on %pv. Some info are below.\n", + current); + printk("intack info: vector 0x%2x, source %x\n", intack.vector, + intack.source); + printk("pt_vector info: vector 0x%2x\n", pt_vector); + + vlapic = vcpu_vlapic(v); + if ( vlapic && vlapic->regs->data ) + { + word = (void *)&vlapic->regs->data[APIC_IRR]; + printk("vIRR:"); + for ( i = NR_VECTORS / 32 - 1; i >= 0 ; i-- ) + printk(" %08x", word[i*4]); + printk("\n"); + } + + pi_desc = &v->arch.hvm_vmx.pi_desc; + if ( pi_desc && pi_desc->pir ) + { + word = (void *)&pi_desc->pir; + printk(" PIR:"); + for ( i = NR_VECTORS / 32 - 1; i >= 0 ; i-- ) + printk(" %08x", word[i]); + printk("\n"); + } + } ASSERT(intack.vector >= pt_vector); vmx_set_eoi_exit_bitmap(v, intack.vector); }