Skip to contentSkip to conversation

fix PCI interrupt setting for ia64

PATCH In review Kenji Kaneshige 4 participants 9 messages Mar 8, 2004 – Mar 11, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix PCI interrupt setting for ia64

Hi,

In ia64 kernel, IOSAPIC's RTEs for PCI interrupts are unmasked at the boot time before installing device drivers. I think it is very dangerous. If some PCI devices without device driver generate interrupts, interrupts are generated repeatedly because these interrupt requests are never cleared. I think RTEs for PCI interrupts should be unmasked by device driver.

A following patch fixes this issue.

Regards,
Kenji Kaneshige

diff -Naur linux-2.6.4-rc2/arch/ia64/kernel/iosapic.c linux-2.6.4-rc2-changed/arch/ia64/kernel/iosapic.c
--- linux-2.6.4-rc2/arch/ia64/kernel/iosapic.c 2004-03-05 15:13:53.155237277 +0900
+++ linux-2.6.4-rc2-changed/arch/ia64/kernel/iosapic.c 2004-03-05 16:48:31.856142526 +0900
@@ -170,7 +170,7 @@
}

static void
-set_rte (unsigned int vector, unsigned int dest) +set_rte (unsigned int vector, unsigned int dest, int mask)

 {
        unsigned long pol, trigger, dmode;
        u32 low32, high32;

@@ -205,6 +205,7 @@
low32 = ((pol << IOSAPIC_POLARITY_SHIFT) |
(trigger << IOSAPIC_TRIGGER_SHIFT) | (dmode << IOSAPIC_DELIVERY_SHIFT) |
+ ((mask ? 1 : 0) << IOSAPIC_MASK_SHIFT) |

                 vector);

        /* dest contains both id and eid */
@@ -509,7 +510,7 @@
               (trigger == IOSAPIC_EDGE ? "edge" : "level"), dest, vector);

        /* program the IOSAPIC routing table */
-       set_rte(vector, dest);
+       set_rte(vector, dest, 0);
        return vector;

}

@@ -557,7 +558,7 @@

               (trigger == IOSAPIC_EDGE ? "edge" : "level"), dest, vector);

        /* program the IOSAPIC routing table */
-       set_rte(vector, dest);
+       set_rte(vector, dest, 0);
        return vector;

}

@@ -583,7 +584,7 @@

            trigger == IOSAPIC_EDGE ? "edge" : "level", dest, vector);

        /* program the IOSAPIC routing table */

- set_rte(vector, dest);
+ set_rte(vector, dest, 0);
}

void __init
@@ -669,7 +670,7 @@

        /* direct the interrupt vector to the running cpu id */
        dest = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff;

#endif
- set_rte(vector, dest);
+ set_rte(vector, dest, 1);

        printk(KERN_INFO "IOSAPIC: vector %d -> CPU 0x%04x, enabled\n",
               vector, dest);
#1 lore raw
Quoted 2 lines · Kenji Kaneshige

In ia64 kernel, IOSAPIC's RTEs for PCI interrupts are unmasked at the boot time before installing device drivers. I think it is very dangerous.

Hi Kenji,
I think this behavior exists to support "legacy" IRQ probing. I'm wondering if it would be sufficient to wrap the patch in "#ifndef CONFIG_ISA" or something like that.

grant

#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Grant Grundler

Grant> Hi Kenji, I think this behavior exists to support "legacy" Grant> IRQ probing.

I don't think so. probe_irq_on() calls the "startup" callback which should do an unmask_irq() for I/O SAPIC. Can somebody confirm that a Merced box (without Bjorn's patch) will boot fine with Kenji Kaneshige's patch applied?

	--david
#3 lore raw
In reply to Kenji Kaneshige

Kenji,

Sorry, I lost track of the status of this patch. Has it been checked out OK with respect to interrupt probing?

	--david
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Kenji Kaneshige

Kenji> Hi, In ia64 kernel, IOSAPIC's RTEs for PCI interrupts are Kenji> unmasked at the boot time before installing device drivers. I Kenji> think it is very dangerous. If some PCI devices without Kenji> device driver generate interrupts, interrupts are generated Kenji> repeatedly because these interrupt requests are never Kenji> cleared. I think RTEs for PCI interrupts should be unmasked Kenji> by device driver.

#4 lore raw

Hi,

I'm sorry that the report falls behind. I wanted to check out by using real device driver which uses a probe_irq_on(), but I don't have appropriate environment now.

Though I didn't check out on a real machine yet, I believe my patch doesn't have any influence on probe_irq_on() because current probe_irq_on() calls startup callback to unmask the RTEs as you said before.

Regards,
Kenji Kaneshige

Quoted 30 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of David Mosberger
Sent: Thursday, March 11, 2004 5:10 AM
To: Kenji Kaneshige
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] fix PCI interrupt setting for ia64

Kenji,

Sorry, I lost track of the status of this patch. Has it been checked out OK with respect to interrupt probing?

	--david
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

On Mon, 08 Mar 2004 11:49:10 +0900, Kenji Kaneshige

<[email protected]> said:

Kenji> Hi, In ia64 kernel, IOSAPIC's RTEs for PCI interrupts are Kenji> unmasked at the boot time before installing device drivers. I Kenji> think it is very dangerous. If some PCI devices without Kenji> device driver generate interrupts, interrupts are generated Kenji> repeatedly because these interrupt requests are never Kenji> cleared. I think RTEs for PCI interrupts should be unmasked Kenji> by device driver.
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Hi,

From: Kenji Kaneshige <[email protected]>
Subject: RE: [PATCH] fix PCI interrupt setting for ia64
Date: Thu, 11 Mar 2004 09:34:06 +0900

Quoted 9 lines

Hi,

I'm sorry that the report falls behind. I wanted to check out by using real device driver which uses a probe_irq_on(), but I don't have appropriate environment now.

Though I didn't check out on a real machine yet, I believe my patch doesn't have any influence on probe_irq_on() because current probe_irq_on() calls startup callback to unmask the RTEs as you said before.

My concern was that if there's a buggy PCI device that raises interrupts all the time until it's initialized by some device driver, probe_irq_on() would not work as expected regardless of whether your patch is applied or not. I thought masking the interrupt line doesn't work around this case.

---
Takayoshi Kochi <[email protected]>

#6 lore raw

Hi,

Sorry, I misunderstood your concern.

I think you are right. Probe_irq_on() still have another problems even if my patch
is applied. For example, if buggy PCI device generates interrupts during its device
driver calls probe_irq_on(), these interrupts might be considered as spurious and
IRQ probing will fail. I think this is another problem than I pointed out.

In addition to this, if probe_irq_on() is used for PCI interrupts (level triggered),
interrupts are generated repeatedly because there are no handlers which clears
these interrupt request. But I think this is not a problem, because these interrupts
will be masked by probe_irq_on() or probe_irq_off() soon. If this is a problem, I think
probe_irq_on() should never be used for PCI (level triggered) interrupt probing.

Regards,
Kenji Kaneshige

Quoted 41 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Takayoshi Kochi
Sent: Thursday, March 11, 2004 10:35 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] fix PCI interrupt setting for ia64

Hi,

From: Kenji Kaneshige <[email protected]>
Subject: RE: [PATCH] fix PCI interrupt setting for ia64
Date: Thu, 11 Mar 2004 09:34:06 +0900

Quoted 4 lines

Hi,

I'm sorry that the report falls behind. I wanted to check out by using real device driver which uses a probe_irq_on(), but I don't

have appropriate

Quoted 3 lines

environment now.

Though I didn't check out on a real machine yet, I believe my

patch doesn't

Quoted 1 line

have any influence on probe_irq_on() because current

probe_irq_on() calls

Quoted 1 line

startup callback to unmask the RTEs as you said before.

My concern was that if there's a buggy PCI device that raises interrupts all the time until it's initialized by some device driver, probe_irq_on() would not work as expected regardless of whether your patch is applied or not. I thought masking the interrupt line doesn't work around this case.

---
Takayoshi Kochi <[email protected]>
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Kenji,

Your patch failed to apply apparently because all tabs got replaced by blanks. I fixed it by hand for now, but in the future, I'd appreciate it if you could either fix your mailer config so it doesn't muck with whitespace (or don't paste & cut patches if that's how the patch got mangled). As a last resort, send patches as a MIME attachment.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Kenji Kaneshige

Kenji> I think you are right. Probe_irq_on() still have another Kenji> problems even if my patch is applied. For example, if buggy Kenji> PCI device generates interrupts during its device driver Kenji> calls probe_irq_on(), these interrupts might be considered as Kenji> spurious and IRQ probing will fail. I think this is another Kenji> problem than I pointed out.

That should be OK. The probe_irq_on() interface never was guaranteed to work under all circumstances.

Kenji> In addition to this, if probe_irq_on() is used for PCI Kenji> interrupts (level triggered), interrupts are generated Kenji> repeatedly because there are no handlers which clears these Kenji> interrupt request. But I think this is not a problem, because Kenji> these interrupts will be masked by probe_irq_on() or Kenji> probe_irq_off() soon. If this is a problem, I think Kenji> probe_irq_on() should never be used for PCI (level triggered) Kenji> interrupt probing.

That's a good point but I doubt it's going to cause trouble because of the history behind this interface (it's mostly needed for ISA devices). If it did, it wouldn't be hard to fix, but I'm not sure it's worth bothering. Perhaps it would be a good idea to get rid of the interface altogether in the 2.7 timeframe (for ia64 and other ISA-free platforms at least; I don't think it can be gotten rid of for x86).

	--david
#8 lore raw
In reply to Kenji Kaneshige
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Kenji Kaneshige

Kenji> Hi, I'm sorry that the report falls behind. I wanted to check Kenji> out by using real device driver which uses a probe_irq_on(), Kenji> but I don't have appropriate environment now.

Kenji> Though I didn't check out on a real machine yet, I believe my Kenji> patch doesn't have any influence on probe_irq_on() because Kenji> current probe_irq_on() calls startup callback to unmask the Kenji> RTEs as you said before.

OK, I agree.

Thanks,

	--david