From patchwork Wed Aug 31 03:56:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Feng" X-Patchwork-Id: 9306311 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 8EA2D607D2 for ; Wed, 31 Aug 2016 04:28:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BB8628B87 for ; Wed, 31 Aug 2016 04:28:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 707FB28C14; Wed, 31 Aug 2016 04:28:05 +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=-4.2 required=2.0 tests=BAYES_00, 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 22F0B28B87 for ; Wed, 31 Aug 2016 04:28:05 +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 1bex5b-00016s-G8; Wed, 31 Aug 2016 04:25:27 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bex5Z-00016M-Pp for xen-devel@lists.xen.org; Wed, 31 Aug 2016 04:25:25 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id 68/B6-29421-53C56C75; Wed, 31 Aug 2016 04:25:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRWlGSWpSXmKPExsXS1tYhomsacyz c4PVWboslHxezODB6HN39mymAMYo1My8pvyKBNePo/Ca2gk18Ff82P2dpYGzh6WLk5BASqJS4 NecJM4gtIcArcWTZDFYI21dizZpZrBA19RLfZq9kA7HZBBQlDl48BBYXEZCWuPb5MmMXIxcHs 8ACRonGi0fBBgkLWEusbjoDZrMIqEpMmt8C1sAr4CDRcuYeE8QCOYkNu/8zgticAo4SP44/BF rAAbTMQWLHPeMJjLwLGBlWMaoXpxaVpRbpWuolFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFes l5+duYgSGAgMQ7GC8uyngEKMkB5OSKG/436PhQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR47aKP hQsJFqWmp1akZeYAgxImLcHBoyTCKwGS5i0uSMwtzkyHSJ1iVJQS530XBZQQAElklObBtcEi4 RKjrJQwLyPQIUI8BalFuZklqPKvGMU5GJWEeQ+BTOHJzCuBm/4KaDET0OKCO4dBFpckIqSkGh gnhfwOv3f46rJyYdn615P2f54UvjbdjpFTjsH8mW3speoGydI1UvMXefGuDOibV/J/2owr25b nL5J53/4+dF3HktM+vatup99KSNz5OdD448/6P/wvBa9nGM+pnl8/sbal79T1hwvzs8RYbp5u rjuzUTyFu/FA23Ob7B2efa+i9do8a1d/vrBWiaU4I9FQi7moOBEA5+QpK38CAAA= X-Env-Sender: feng.wu@intel.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1472617522!30750590!2 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31601 invoked from network); 31 Aug 2016 04:25:24 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-10.tower-21.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 31 Aug 2016 04:25:24 -0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP; 30 Aug 2016 21:25:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,260,1470726000"; d="scan'208";a="2931010" Received: from feng-bdw-de-pi.bj.intel.com ([10.238.154.74]) by fmsmga005.fm.intel.com with ESMTP; 30 Aug 2016 21:25:21 -0700 From: Feng Wu To: xen-devel@lists.xen.org Date: Wed, 31 Aug 2016 11:56:26 +0800 Message-Id: <1472615791-8664-2-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1472615791-8664-1-git-send-email-feng.wu@intel.com> References: <1472615791-8664-1-git-send-email-feng.wu@intel.com> Cc: kevin.tian@intel.com, Feng Wu , george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, jbeulich@suse.com Subject: [Xen-devel] [PATCH v3 1/6] VMX: Statically assign two PI hooks 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP PI hooks: vmx_pi_switch_from() and vmx_pi_switch_to() are needed even all the assigned devices were dettached from the domain. We change the state of SN bit in these two functions, and evaluate this bit in vmx_deliver_posted_intr() when trying to deliver the interrupt in posted way via software. The problem is if we deassign the hooks while the vCPU is runnable in the runqueue with 'SN' set, all the furture notificaton event will be suppressed. This patch makes these two hooks statically assigned. Signed-off-by: Feng Wu --- xen/arch/x86/hvm/vmx/vmx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 3d330b6..f5d2d3c 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -207,8 +207,6 @@ void vmx_pi_hooks_assign(struct domain *d) ASSERT(!d->arch.hvm_domain.vmx.vcpu_block); d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block; - d->arch.hvm_domain.vmx.pi_switch_from = vmx_pi_switch_from; - d->arch.hvm_domain.vmx.pi_switch_to = vmx_pi_switch_to; d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume; } @@ -221,8 +219,6 @@ void vmx_pi_hooks_deassign(struct domain *d) ASSERT(d->arch.hvm_domain.vmx.vcpu_block); d->arch.hvm_domain.vmx.vcpu_block = NULL; - d->arch.hvm_domain.vmx.pi_switch_from = NULL; - d->arch.hvm_domain.vmx.pi_switch_to = NULL; d->arch.hvm_domain.vmx.pi_do_resume = NULL; } @@ -236,6 +232,12 @@ static int vmx_domain_initialise(struct domain *d) if ( (rc = vmx_alloc_vlapic_mapping(d)) != 0 ) return rc; + if ( iommu_intpost ) + { + d->arch.hvm_domain.vmx.pi_switch_from = vmx_pi_switch_from; + d->arch.hvm_domain.vmx.pi_switch_to = vmx_pi_switch_to; + } + return 0; }