public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Suresh Siddha <suresh.b.siddha@intel.com>
To: yhlu.kernel@gmail.com, mingo@elte.hu
Cc: linux-kernel@vger.kernel.org, ebiederm@xmission.com, x86@kernel.org
Subject: [patch] fix intr-remap with dyn_array/nr_irqs changes
Date: Tue, 19 Aug 2008 11:54:41 -0700	[thread overview]
Message-ID: <20080819185441.GC1152@linux-os.sc.intel.com> (raw)

I didn't find time to closely review the dyn_array/nr_irqs changes. But
the appended patch is needed to fix the broken intr-remapping support on
x86/tip

And also, I don't see any locks used in to_irq_desc_with_new(). How are
we handling the concurrent usage scenarios. And also, this code can use
some cleanups (like the names, to_irq_desc_with_new()?) etc.

thanks,
suresh
---

In irq_2_iommu_with_new() and set_irte_irq(), irq_desc or
irq_2_iommu pointers may not be allocated. So use the routines which
will allocate them if they are not already allocated.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---

diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index 3593f0f..fbd82ff 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -76,7 +76,10 @@ static struct irq_2_iommu *irq_2_iommu_with_new(unsigned int irq)
 	struct irq_desc *desc;
 	struct irq_2_iommu *irq_iommu;
 
-	desc = to_irq_desc(irq);
+	/*
+	 * alloc irq desc if not allocated already.
+	 */
+	desc = to_irq_desc_with_new(irq);
 
 	BUG_ON(!desc);
 
@@ -255,11 +258,7 @@ int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)
 	struct irq_2_iommu *irq_iommu;
 
 	spin_lock(&irq_2_ir_lock);
-	irq_iommu = valid_irq_2_iommu(irq);
-	if (!irq_iommu) {
-		spin_unlock(&irq_2_ir_lock);
-		return -1;
-	}
+	irq_iommu = irq_2_iommu_with_new(irq);
 
 	irq_iommu->iommu = iommu;
 	irq_iommu->irte_index = index;

             reply	other threads:[~2008-08-19 18:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19 18:54 Suresh Siddha [this message]
2008-08-19 19:40 ` [patch] fix intr-remap with dyn_array/nr_irqs changes Yinghai Lu

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=20080819185441.GC1152@linux-os.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=x86@kernel.org \
    --cc=yhlu.kernel@gmail.com \
    /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