From: Feng Wu <feng.wu@intel.com>
To: xen-devel@lists.xen.org
Cc: Keir Fraser <keir@xen.org>, Kevin Tian <kevin.tian@intel.com>,
Feng Wu <feng.wu@intel.com>, Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v10 2/7] vmx: Suppress posting interrupts when 'SN' is set
Date: Thu, 3 Dec 2015 16:35:29 +0800 [thread overview]
Message-ID: <1449131734-3578-3-git-send-email-feng.wu@intel.com> (raw)
In-Reply-To: <1449131734-3578-1-git-send-email-feng.wu@intel.com>
Currently, we don't support urgent interrupt, all interrupts
are recognized as non-urgent interrupt, so we cannot send
posted-interrupt when 'SN' is set.
CC: Kevin Tian <kevin.tian@intel.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Feng Wu <feng.wu@intel.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: <kevin.tian@intel.com>
---
v10:
- Changed some comments to make them clear.
v8:
- Parenthesize '1 << POSTED_INTR_ON' and '1 << POSTED_INTR_SN'
v7:
- Coding style
- Read the current pi_desc.control as the intial value of prev.control
v6:
- Add some comments
v5:
- keep the vcpu_kick() at the end of vmx_deliver_posted_intr()
- Keep the 'return' after calling __vmx_deliver_posted_interrupt()
v4:
- Coding style.
- V3 removes a vcpu_kick() from the eoi_exitmap_changed path
incorrectly, fix it.
v3:
- use cmpxchg to test SN/ON and set ON
xen/arch/x86/hvm/vmx/vmx.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 9ad6d82..91d80b3 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1718,8 +1718,35 @@ static void vmx_deliver_posted_intr(struct vcpu *v, u8 vector)
*/
pi_set_on(&v->arch.hvm_vmx.pi_desc);
}
- else if ( !pi_test_and_set_on(&v->arch.hvm_vmx.pi_desc) )
+ else
{
+ struct pi_desc old, new, prev;
+
+ prev.control = v->arch.hvm_vmx.pi_desc.control;
+
+ do {
+ /*
+ * Currently, we don't support urgent interrupt, all
+ * interrupts are recognized as non-urgent interrupt,
+ * Besides that, if 'ON' is already set, no need to
+ * sent posted-interrupts notification event as well,
+ * according to hardware behavior.
+ */
+ if ( pi_test_sn(&prev) || pi_test_on(&prev) )
+ {
+ vcpu_kick(v);
+ return;
+ }
+
+ old.control = v->arch.hvm_vmx.pi_desc.control &
+ ~((1 << POSTED_INTR_ON) | (1 << POSTED_INTR_SN));
+ new.control = v->arch.hvm_vmx.pi_desc.control |
+ (1 << POSTED_INTR_ON);
+
+ prev.control = cmpxchg(&v->arch.hvm_vmx.pi_desc.control,
+ old.control, new.control);
+ } while ( prev.control != old.control );
+
__vmx_deliver_posted_interrupt(v);
return;
}
--
2.1.0
next prev parent reply other threads:[~2015-12-03 8:35 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 8:35 [PATCH v10 0/7] Add VT-d Posted-Interrupts support Feng Wu
2015-12-03 8:35 ` [PATCH v10 1/7] VT-d Posted-intterrupt (PI) design Feng Wu
2015-12-03 8:35 ` Feng Wu [this message]
2015-12-03 8:35 ` [PATCH v10 3/7] vt-d: Add API to update IRTE when VT-d PI is used Feng Wu
2015-12-10 10:52 ` Tian, Kevin
2015-12-03 8:35 ` [PATCH v10 4/7] Update IRTE according to guest interrupt config changes Feng Wu
2015-12-10 10:53 ` Tian, Kevin
2015-12-03 8:35 ` [PATCH v10 5/7] vmx: Properly handle notification event when vCPU is running Feng Wu
2015-12-03 8:35 ` [PATCH v10 6/7] vmx: VT-d posted-interrupt core logic handling Feng Wu
2015-12-10 11:40 ` Tian, Kevin
2015-12-11 1:58 ` Wu, Feng
2015-12-11 2:27 ` Tian, Kevin
2015-12-11 3:12 ` Wu, Feng
2015-12-21 6:43 ` Wu, Feng
2015-12-21 9:03 ` Dario Faggioli
2015-12-21 9:26 ` Wu, Feng
2015-12-23 2:21 ` Dario Faggioli
2015-12-23 2:28 ` Wu, Feng
2015-12-23 5:16 ` Tian, Kevin
2015-12-23 5:18 ` Wu, Feng
2015-12-23 4:58 ` Wu, Feng
2015-12-23 10:09 ` Jan Beulich
2016-01-18 1:20 ` Wu, Feng
2016-01-18 8:40 ` Jan Beulich
2016-01-18 8:45 ` Wu, Feng
2016-01-18 9:03 ` Jan Beulich
2016-01-19 8:48 ` Wu, Feng
2016-01-18 15:14 ` Jan Beulich
2016-01-20 7:49 ` Wu, Feng
2016-01-20 8:35 ` Jan Beulich
2016-01-20 11:12 ` Dario Faggioli
2016-01-20 11:18 ` Wu, Feng
2016-01-20 11:20 ` Wu, Feng
2016-01-20 11:35 ` Jan Beulich
2016-01-20 13:30 ` Dario Faggioli
2016-01-20 13:42 ` Wu, Feng
2016-01-25 5:26 ` Wu, Feng
2016-01-25 13:59 ` Jan Beulich
2016-01-20 13:48 ` Wu, Feng
2016-01-20 14:03 ` Jan Beulich
2016-01-21 9:05 ` Wu, Feng
2016-01-21 10:34 ` Jan Beulich
2015-12-03 8:35 ` [PATCH v10 7/7] Add a command line parameter for VT-d posted-interrupts Feng Wu
2015-12-03 11:19 ` [PATCH v10 0/7] Add VT-d Posted-Interrupts support Jan Beulich
2015-12-03 13:54 ` Wu, Feng
2015-12-10 10:48 ` Tian, Kevin
2015-12-10 13:40 ` Wu, Feng
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=1449131734-3578-3-git-send-email-feng.wu@intel.com \
--to=feng.wu@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.org \
/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;
as well as URLs for NNTP newsgroup(s).