Patch - Sun4d SMP now boots
I have now applied the patch posted to the list by Pasi Pirhonen on 19Nov2003. This needs to be applied AFTER the patches from Thomas.
More work is needed to get rid of the previously reported compiler warnings in the same function before this is fit to be submitted, but I will have to leave that to those who understand what they are doing <B-).
This now boots and runs, but is horribly unstable.
==== BEGIN INCLUDE
root@phobos:~# cd /usr/src/linux/arch/sparc/kernel root@phobos:/usr/src/linux/arch/sparc/kernel# diff -ru sun4d_smp.csaved sun4d_s mp.c
sun4d_smp.c renamed from sun4d_smp.csaved +8 -3
@@ -340,7 +340,8 @@ registerint high = smp_highest_cpu;unsigned long flags; -spin_lock_irqsave (&cross_call_lock, flags); +//spin_lock_irqsave(&cross_call_lock, flags); +spin_lock_bh (&cross_call_lock); {/* If you make changes here, make sure gcc generates proper code... */
@@ -373,6 +374,8 @@ } } } +/* first run local copy */ +func (arg1, arg2, arg3, arg4, arg5); { registerint i;
@@ -390,8 +393,10 @@ }while (++i <= high); } -spin_unlock_irqrestore (&cross_call_lock, flags); - } +//spin_unlock_irqrestore(&cross_call_lock, flags); +spin_unlock_bh (&cross_call_lock); + }else +func (arg1, arg2, arg3, arg4, arg5);/* just need to run local copy */ }/* Running cross calls. */
===== END INCLUDE
Quoted 7 lines · Chris Newport
I have now applied the patch posted to the list by Pasi Pirhonen on 19Nov2003. This needs to be applied AFTER the patches from Thomas. More work is needed to get rid of the previously reported compiler warnings in the same function before this is fit to be submitted, but I will have to leave that to those who understand what they are doing <B-).
This now boots and runs, but is horribly unstable.
Okay, this is great news. I know the spin_lock_bh() is wrong, but it gets us to a point where we can actually do something and we actually have enough to reproduce all this.
One major question is *WHY* spin_lock_bh() vs. spin_lock_irqsave() works. Only trouble there is that we can't see what happens after spin_lock_irqsave() very easily. One rather large possibility is that since disabling bh's doesn't disable interrupts, some smp_call_function() or similar that would deadlock if interrupts weren't disabled suddenly appears to work and/or works for some limited cases...
This is in my queue also, though preferably some explanation of what's going on with this (e.g. the real issue, maybe a better fix) will happen instead.
-- wli
Quoted 10 lines · On Thu, 19 Aug 2004 07:12:13 -0700 William Lee Irwin III <[email protected]>…
One major question is *WHY*
spin_lock_bh()vs.spin_lock_irqsave()works. Only trouble there is that we can't see what happens afterspin_lock_irqsave()very easily. One rather large possibility is that since disabling bh's doesn't disable interrupts, somesmp_call_function()or similar that would deadlock if interrupts weren't disabled suddenly appears to work and/or works for some limited cases...This is in my queue also, though preferably some explanation of what's going on with this (e.g. the real issue, maybe a better fix) will happen instead.
Another thing to keep in mind on sparc32 is that %psr writes have a 3 instruction latency, which is why we usually put 3 nops after it. Also, writing garbage into the %psr can easily wedge the chip or cause it to take a fatal trap.
Quoted 8 lines · William Lee Irwin III
On Thu, Aug 19, 2004 at 02:32:47PM +0100, Chris Newport wrote:
One major question is *WHY*
spin_lock_bh()vs.spin_lock_irqsave()works. Only trouble there is that we can't see what happens afterspin_lock_irqsave()very easily. One rather large possibility is that since disabling bh's doesn't disable interrupts, somesmp_call_function()or similar that would deadlock if interrupts weren't disabled suddenly appears to work and/or works for some limited cases...
Two possible clues :-
Other architectures have 2 sets of functions here, one for use before it is safe to allow SMP with IRQs.
sun4d_irq.c is almost certainly involved, and does not appear to deal with SMP in a sane manner. Compare with sun4m_irq.c which is much newer. This is consistent with the observed failure, the system locks as soon as a write to disk happens. Pasi also noted failures as soon as interrupts happen.
Quoted 6 lines · William Lee Irwin III
Quoted 6 lines
One major question is *WHY*
spin_lock_bh()vs.spin_lock_irqsave()works. Only trouble there is that we can't see what happens afterspin_lock_irqsave()very easily. One rather large possibility is that since disabling bh's doesn't disable interrupts, somesmp_call_function()or similar that would deadlock if interrupts weren't disabled suddenly appears to work and/or works for some limited cases...
Quoted 8 lines · C.Newport
Two possible clues :-
Other architectures have 2 sets of functions here, one for use before it is safe to allow SMP with IRQs.sun4d_irq.cis almost certainly involved, and does not appear to deal with SMP in a sane manner. Compare withsun4m_irq.cwhich is much newer. This is consistent with the observed failure, the system locks as soon as a write to disk happens. Pasi also noted failures as soon as interrupts happen.
Sounds like the analogous rewrite must happen for sun4d, then. I'll look into that... some kind of sun4d hacking-level access may need to happen, or someone may have to look into this on my behalf.
-- wli
Quoted 4 lines · William Lee Irwin III
Sounds like the analogous rewrite must happen for sun4d, then. I'll look into that... some kind of sun4d hacking-level access may need to happen, or someone may have to look into this on my behalf.
How long before you get your machine ?.
You can have both telnet and serial console access to my SS1000E but we will probably need to keep an IRC channel open so that I can pull the plug every time you wedge it to the point where <break> will not help.
Quoted 3 lines · William Lee Irwin III
Quoted 3 lines
Sounds like the analogous rewrite must happen for sun4d, then. I'll look into that... some kind of sun4d hacking-level access may need to happen, or someone may have to look into this on my behalf.
Quoted 5 lines · C.Newport
How long before you get your machine ?.
You can have both telnet and serial console access to my SS1000E but we will probably need to keep an IRC channel open so that I can pull the plug every time you wedge it to the point where <break> will not help.
It looks months out. I've been reluctant to cash in on this as this sort of arrangement is rather awkward, but I probably should cash in on it soon.
-- wli