Skip to contentSkip to conversation

PowerPC: MPIC ack interrupts at mpic_teardown_this_cpu()

PATCH In review Valentine Barshak 4 participants 8 messages Apr 3, 2008 – Apr 7, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PowerPC: MPIC ack interrupts at mpic_teardown_this_cpu()

We really need to ack interrupts at mpic_teardown, since not all platforms reset mpic at kernel start-up. For example, kexec'ed kernel hangs on P.A. Semi if mpic_eoi() isn't called.

---
 arch/powerpc/sysdev/mpic.c |    6 +-----
 1 files changed, 1 insertion(+), 5 deletions(-)
arch/powerpc/sysdev/mpic.c +1 -5
@@ -1410,11 +1410,6 @@ void mpic_cpu_set_priority(int prio)
 	mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), prio);
 }
 
-/*
- * XXX: someone who knows mpic should check this.
- * do we need to eoi the ipi including for kexec cpu here (see xics comments)?
- * or can we reset the mpic in the new kernel?
- */
 void mpic_teardown_this_cpu(int secondary)
 {
 	struct mpic *mpic = mpic_primary;
@@ -1434,6 +1429,7 @@ void mpic_teardown_this_cpu(int secondar
 
 	/* Set current processor priority to max */
 	mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0xf);
+	mpic_eoi(mpic);
 
 	spin_unlock_irqrestore(&mpic_lock, flags);
 }
#1 lore raw
Quoted 6 lines · Valentine Barshak

We really need to ack interrupts at mpic_teardown, since not all platforms reset mpic at kernel start-up. For example, kexec'ed kernel hangs on P.A. Semi if mpic_eoi() isn't called.

---

Would be interesting to find out why it hangs tho... it shouldn't .

Ben.

Quoted 29 lines
 arch/powerpc/sysdev/mpic.c |    6 +-----
 1 files changed, 1 insertion(+), 5 deletions(-)
arch/powerpc/sysdev/mpic.c +1 -5
@@ -1410,11 +1410,6 @@ void mpic_cpu_set_priority(int prio)
 	mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), prio);
 }
 
-/*
- * XXX: someone who knows mpic should check this.
- * do we need to eoi the ipi including for kexec cpu here (see xics comments)?
- * or can we reset the mpic in the new kernel?
- */
 void mpic_teardown_this_cpu(int secondary)
 {
 	struct mpic *mpic = mpic_primary;
@@ -1434,6 +1429,7 @@ void mpic_teardown_this_cpu(int secondar
 
 	/* Set current processor priority to max */
 	mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0xf);
+	mpic_eoi(mpic);
 
 	spin_unlock_irqrestore(&mpic_lock, flags);
 }

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#2 lore raw
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 6 lines · Valentine Barshak

We really need to ack interrupts at mpic_teardown, since not all platforms reset mpic at kernel start-up. For example, kexec'ed kernel hangs on P.A. Semi if mpic_eoi() isn't called.

---

Would be interesting to find out why it hangs tho... it shouldn't .

I haven't reproduced the problem and looked at hardware state yet, but I would expect it to be because the openpic won't send another interrupt until the previous is EOI'd, and the IPI is never EOI'd as far as I can tell.

The XICS code does it explicitly already. I'm surprised it doesn't break on the 970-based platforms actually...

-Olof

#3 lore raw
Quoted 9 lines
Quoted 8 lines
Quoted 6 lines

We really need to ack interrupts at mpic_teardown, since not all platforms reset mpic at kernel start-up. For example, kexec'ed kernel hangs on P.A. Semi if mpic_eoi() isn't called.

---

Would be interesting to find out why it hangs tho... it shouldn't .

Quoted 7 lines

I haven't reproduced the problem and looked at hardware state yet, but I would expect it to be because the openpic won't send another interrupt until the previous is EOI'd, and the IPI is never EOI'd as far as I can tell.

The XICS code does it explicitly already. I'm surprised it doesn't break on the 970-based platforms actually...

platforms/maple/setup.c and platforms/powermac/pic.c use MPIC_WANTS_RESET. Is there a reason why we don't do that on every MPIC? If there is such a reason, the default should be to reset, only pseries and chrp and cell and now pasemi do not use it. It's the only sane way to get an MPIC into a sane known state starting from <whatever> state.

Segher

#4 lore raw
Quoted 19 lines · Segher Boessenkool
Quoted 15 lines
Quoted 8 lines
Quoted 6 lines

We really need to ack interrupts at mpic_teardown, since not all platforms reset mpic at kernel start-up. For example, kexec'ed kernel hangs on P.A. Semi if mpic_eoi() isn't called.

---

Would be interesting to find out why it hangs tho... it shouldn't .

I haven't reproduced the problem and looked at hardware state yet, but I
would expect it to be because the openpic won't send another interrupt until the previous is EOI'd, and the IPI is never EOI'd as far as I can tell.

Quoted 3 lines

The XICS code does it explicitly already. I'm surprised it doesn't break
on the 970-based platforms actually...

Quoted 7 lines

platforms/maple/setup.c and platforms/powermac/pic.c use MPIC_WANTS_RESET.
Is there a reason why we don't do that on every MPIC? If there is such a reason, the default should be to reset, only pseries and chrp and cell and now pasemi do not use it. It's the only sane way to get an MPIC into
a sane known state starting from <whatever> state.

I used to have the reset there on pasemi but due to some other issues I ended up taking it out.

It's not like doing a final EOI is a big deal, I really don't see why there's hassle about this patch.

-Olof

#5 lore raw
Quoted 8 lines
Quoted 7 lines

platforms/maple/setup.c and platforms/powermac/pic.c use MPIC_WANTS_RESET.
Is there a reason why we don't do that on every MPIC? If there is such a reason, the default should be to reset, only pseries and chrp and cell and now pasemi do not use it. It's the only sane way to get an MPIC into
a sane known state starting from <whatever> state.

Quoted 5 lines

I used to have the reset there on pasemi but due to some other issues I ended up taking it out.

It's not like doing a final EOI is a big deal, I really don't see why there's hassle about this patch.

The patch is fine, don't get me wrong. I'm just saying MPIC_WANTS_RESET should be the default since pretty much everything wants it. The few platforms that don't can document why; with the current code, we cannot see if you just forgot it or not.

Segher

#6 lore raw
Quoted 13 lines · Segher Boessenkool
Quoted 13 lines
Quoted 9 lines

platforms/maple/setup.c and platforms/powermac/pic.c use MPIC_WANTS_RESET.
Is there a reason why we don't do that on every MPIC? If there is such
a reason, the default should be to reset, only pseries and chrp and cell
and now pasemi do not use it. It's the only sane way to get an MPIC into
a sane known state starting from <whatever> state.

I used to have the reset there on pasemi but due to some other issues I ended up taking it out.

Quoted 7 lines
Quoted 2 lines

It's not like doing a final EOI is a big deal, I really don't see why there's hassle about this patch.

The patch is fine, don't get me wrong. I'm just saying MPIC_WANTS_RESET should be the default since pretty much everything wants it. The few platforms that don't can document why; with the current code, we cannot see if you just forgot it or not.

It was documented in the changeset, see de0c74e7f98d8a06b784e120103eb388da8194f6.

But yeah, that's hard to tell at some point later in time, a short comment by the call could be useful. I'll add one next time I touch that code.

-Olof

#7 lore raw
In reply to Valentine Barshak
Quoted 5 lines · Valentine Barshak

We really need to ack interrupts at mpic_teardown, since not all platforms reset mpic at kernel start-up. For example, kexec'ed kernel hangs on P.A. Semi if mpic_eoi() isn't called.

I have applied this to pasemi.git for-2.6.26 with the following comment added before the mpic_eoi call:

        /* We need to EOI the IPI since not all platforms reset the MPIC
         * on boot and new interrupts wouldn't get delivered otherwise.
         */
	mpic_eoi(mpic);

Thanks,

-Olof