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

Re: [Xen-devel] [PATCH 14/17] ARM: Implement vcpu_kick()



Hi Andre,

On 09/03/18 15:11, Andre Przywara wrote:
If we change something in a vCPU that affects its runnability or
otherwise needs the vCPU's attention, we might need to tell the scheduler
about it.
We are using this in one place (vIRQ injection) at the moment, but will
need this at more places soon.
So let's factor out this functionality, using the already existing
vcpu_kick() prototype (used in x86 only so far), to make this available
to the rest of the Xen code.

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxxxxx>
---
- Rename to vcpu_kick(), to blend in with existing (x86) prototype

  xen/arch/arm/domain.c | 12 ++++++++++++
  xen/arch/arm/vgic.c   | 11 +++--------
  2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index bc10f412ba..650712e0f2 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -967,6 +967,18 @@ void vcpu_block_unless_event_pending(struct vcpu *v)
          vcpu_unblock(current);
  }
+void vcpu_kick(struct vcpu *vcpu)
+{
+    bool running = vcpu->is_running;
+
+    vcpu_unblock(vcpu);
+    if ( running && vcpu != current )
+    {
+        perfc_incr(vgic_cross_cpu_intr_inject);

Sorry, it looks like I forgot to mention that in the previous version. The perfcounter should at least be renamed to match the new function.

+        smp_send_event_check_mask(cpumask_of(vcpu->processor));
+    }
+}
+
  /*
   * Local variables:
   * mode: C
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index eb09d9ca54..3fafdd0b66 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -26,6 +26,7 @@
  #include <xen/sched.h>
  #include <xen/perfc.h>
+#include <asm/event.h>
  #include <asm/current.h>
#include <asm/mmio.h>
@@ -530,7 +531,6 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, 
unsigned int virq,
      uint8_t priority;
      struct pending_irq *iter, *n;
      unsigned long flags;
-    bool running;
/*
       * For edge triggered interrupts we always ignore a "falling edge".
@@ -590,14 +590,9 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, 
unsigned int virq,
      list_add_tail(&n->inflight, &v->arch.vgic.inflight_irqs);
  out:
      spin_unlock_irqrestore(&v->arch.vgic.lock, flags);
+
      /* we have a new higher priority irq, inject it into the guest */
-    running = v->is_running;
-    vcpu_unblock(v);
-    if ( running && v != current )
-    {
-        perfc_incr(vgic_cross_cpu_intr_inject);
-        smp_send_event_check_mask(cpumask_of(v->processor));
-    }
+    vcpu_kick(v);
return;
  }


Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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