[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2] x86/apicv: enhance posted-interrupt processing



>From 6b5f702927d832513d270a2bca4634b271f4df47 Mon Sep 17 00:00:00 2001
From: Quan Xu <xuquan8@xxxxxxxxxx>
Date: Tue, 28 Feb 2017 02:48:29 +0800
Subject: [PATCH v2] x86/apicv: enhance posted-interrupt processing

If guest is already in non-root mode, an posted interrupt will
be directly delivered to guest (leaving softirq being set without
actually incurring a VM-Exit - breaking desired softirq behavior).
Then further posted interrupts will skip the IPI, stay in PIR and
not noted until another VM-Exit happens.

When target vCPU is in non-root mode and running on remote CPU,
posted way is triggered to inject interrupt without VM-Exit.
Otherwise, set VCPU_KICK_SOFTIRQ bit to inject interrupt until
another VM-Entry as a best effort.

Signed-off-by: Quan Xu <xuquan8@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmx.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 61925cf..ecdfbbb 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1839,17 +1839,14 @@ static void vmx_process_isr(int isr, struct vcpu *v)

 static void __vmx_deliver_posted_interrupt(struct vcpu *v)
 {
-    bool_t running = v->is_running;
+    unsigned int cpu = v->processor;

     vcpu_unblock(v);
-    if ( running && (in_irq() || (v != current)) )
-    {
-        unsigned int cpu = v->processor;
-
-        if ( !test_and_set_bit(VCPU_KICK_SOFTIRQ, &softirq_pending(cpu))
-             && (cpu != smp_processor_id()) )
-            send_IPI_mask(cpumask_of(cpu), posted_intr_vector);
-    }
+    if ( v->is_running && (in_irq() || (v != current)) &&
+         (cpu != smp_processor_id()) )
+        send_IPI_mask(cpumask_of(cpu), posted_intr_vector);
+    else
+        set_bit(VCPU_KICK_SOFTIRQ, &softirq_pending(cpu));
 }

 static void vmx_deliver_posted_intr(struct vcpu *v, u8 vector)
--
1.8.3.1

Attachment: 0001-x86-apicv-enhance-posted-interrupt-processing.patch
Description: 0001-x86-apicv-enhance-posted-interrupt-processing.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.