xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xenproject.org, ian.campbell@citrix.com,
	ian.jackson@eu.citrix.com, jbeulich@suse.com, keir@xen.org,
	tim@xen.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v5 for-xen-4.5 3/3] dpci: In hvm_dirq_assist stop using pt_pirq_iterate
Date: Fri, 19 Sep 2014 14:51:37 -0400	[thread overview]
Message-ID: <1411152697-13765-4-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1411152697-13765-1-git-send-email-konrad.wilk@oracle.com>

As we are now called from dpci_softirq with the outstanding
'struct hvm_pirq_dpci' there is no need to call pt_pirq_iterate
which will iterate over all of the PIRQs and call us with every
one that is mapped. And then _hvm_dirq_assist figuring out
which one to execute.

We know which one to execute as 'schedule_dpci_for' is called
for the specific 'struct hvm_pirq_dpci' that has an outstanding
interrupt.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/drivers/passthrough/io.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 13433a5..62fdca9 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -621,9 +621,13 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector)
     spin_unlock(&d->event_lock);
 }
 
-static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
-                            void *arg)
+static int hvm_dirq_assist(struct hvm_pirq_dpci *pirq_dpci)
 {
+    struct domain *d = pirq_dpci->dom;
+
+    ASSERT(d && d->arch.hvm_domain.irq.dpci);
+
+    spin_lock(&d->event_lock);
     if ( test_and_clear_bool(pirq_dpci->masked) )
     {
         struct pirq *pirq = dpci_pirq(pirq_dpci);
@@ -634,13 +638,13 @@ static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
             send_guest_pirq(d, pirq);
 
             if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-                return 0;
+                goto out;
         }
 
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
         {
             vmsi_deliver_pirq(d, pirq_dpci);
-            return 0;
+            goto out;
         }
 
         list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
@@ -653,7 +657,7 @@ static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
         {
             /* for translated MSI to INTx interrupt, eoi as early as possible */
             __msi_pirq_eoi(pirq_dpci);
-            return 0;
+            goto out;
         }
 
         /*
@@ -666,21 +670,12 @@ static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
         ASSERT(pt_irq_need_timer(pirq_dpci->flags));
         set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
+ out:
+    spin_unlock(&d->event_lock);
 
     return 0;
 }
 
-static void hvm_dirq_assist(struct hvm_pirq_dpci *pirq_dpci)
-{
-    struct domain *d = pirq_dpci->dom;
-
-    ASSERT(d && d->arch.hvm_domain.irq.dpci);
-
-    spin_lock(&d->event_lock);
-    pt_pirq_iterate(d, _hvm_dirq_assist, NULL);
-    spin_unlock(&d->event_lock);
-}
-
 static void __hvm_dpci_eoi(struct domain *d,
                            const struct hvm_girq_dpci_mapping *girq,
                            const union vioapic_redir_entry *ent)
-- 
1.9.3

      parent reply	other threads:[~2014-09-19 18:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-19 18:51 [PATCH v5] Fix interrupt latency of HVM PCI passthroughdevices Konrad Rzeszutek Wilk
2014-09-19 18:51 ` [PATCH v5 for-xen-4.5 1/3] dpci: Replace tasklet with an softirq (v5) Konrad Rzeszutek Wilk
2014-09-22 11:58   ` Jan Beulich
2014-09-22 14:31     ` Konrad Rzeszutek Wilk
2014-09-22 15:31       ` Jan Beulich
2014-09-19 18:51 ` [PATCH v5 for-xen-4.5 2/3] dpci: Safeguard against race with hvm_dirq_assist crashing and pt_irq_[create|destroy]_bind Konrad Rzeszutek Wilk
2014-09-19 18:51 ` Konrad Rzeszutek Wilk [this message]

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=1411152697-13765-4-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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).