From patchwork Tue Oct 11 00:57:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Feng" X-Patchwork-Id: 9370051 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 B9BD960487 for ; Tue, 11 Oct 2016 01:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B348028CB1 for ; Tue, 11 Oct 2016 01:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A75A428D2F; Tue, 11 Oct 2016 01:30:59 +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 53F8F28CB1 for ; Tue, 11 Oct 2016 01:30:59 +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 1btls5-0005vC-D9; Tue, 11 Oct 2016 01:28:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btls4-0005un-IH for xen-devel@lists.xen.org; Tue, 11 Oct 2016 01:28:44 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 90/46-01767-B404CF75; Tue, 11 Oct 2016 01:28:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRWlGSWpSXmKPExsVywNxEW9fb4U+ 4wYkXwhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8ba03PYCt7zVnyb/ZixgfEydxcjJ4eQQKXE 353LmUFsCQFeiSPLZrBC2P4SE6ddZ4eoqZfYe3wxmM0moChx8OIhsBoRAWmJa58vM3YxcnEwC yxglGi8eBRoEAeHsIC1xI1tBiAmi4CqxIkesFZeAUeJPSdeMEGMl5PYsPs/I4jNKeAkMfntVD aQciGgmo797BMYeRcwMqxiVC9OLSpLLdI11UsqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kv Oz93ECAwDBiDYwTj9sv8hRkkOJiVR3iKjP+FCfEn5KZUZicUZ8UWlOanFhxhlODiUJHj17IFy gkWp6akVaZk5wICESUtw8CiJ8OaDpHmLCxJzizPTIVKnGBWlxHk5QRICIImM0jy4NlgUXGKUl RLmZQQ6RIinILUoN7MEVf4VozgHo5IwrwnIFJ7MvBK46a+AFjMBLWZZ/ANkcUkiQkqqgTGy5f fUV5NYZqYrZ0bsdj+5syhUcRn7wXX7bA4Fd102nFgxTafcIFzz7Z4zNx96KM7Z+YvxWX6s+ef 7ijqsL04UVDguVXp//eJUR1mp7ZN9y3/k5UY15652nv+iyenOjXWG2x5l38r/nyZznf97hOmL 2K0sjld5nGbaFx4Wc3pUHznFO57jlJoSS3FGoqEWc1FxIgCoksumfQIAAA== X-Env-Sender: feng.wu@intel.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1476149320!30791318!2 X-Originating-IP: [192.55.52.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54320 invoked from network); 11 Oct 2016 01:28:43 -0000 Received: from mga05.intel.com (HELO mga05.intel.com) (192.55.52.43) by server-10.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 11 Oct 2016 01:28:43 -0000 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 10 Oct 2016 18:28:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,327,1473145200"; d="scan'208";a="178535709" Received: from feng-bdw-de-pi.bj.intel.com ([10.238.154.57]) by fmsmga004.fm.intel.com with ESMTP; 10 Oct 2016 18:28:40 -0700 From: Feng Wu To: xen-devel@lists.xen.org Date: Tue, 11 Oct 2016 08:57:47 +0800 Message-Id: <1476147473-30970-2-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1476147473-30970-1-git-send-email-feng.wu@intel.com> References: <1476147473-30970-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 v5 1/7] 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 when any previously assigned device is detached from the domain. Since 'SN' bit is also used to control the CPU side PI and we change the state of SN bit in these two functions, then 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 --- v5: - Zap "pi_switch_from" hook xen/arch/x86/hvm/vmx/vmx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 3d330b6..623d5bc 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -147,6 +147,11 @@ static void vmx_pi_switch_from(struct vcpu *v) pi_set_sn(pi_desc); } +/* + * In fact, we can remove this hooks inside itself if no new device is in the + * process of getting assigned and "from" hook is NULL. However, it is not + * straightforward to find a clear solution, so just leave it here. + */ static void vmx_pi_switch_to(struct vcpu *v) { struct pi_desc *pi_desc = &v->arch.hvm_vmx.pi_desc; @@ -221,9 +226,8 @@ 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; + d->arch.hvm_domain.vmx.pi_switch_from = NULL; } static int vmx_domain_initialise(struct domain *d)