NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/38637: pppoe fails to reconnect sometimes



On Tue, May 05, 2009 at 08:52:45PM +0000, Andrew Doran wrote:
> > I think I found the reason for this (or at last a possible reason).
> > In sys/kern/kern_softint.c, sh_flags should be declared volatile.
> > Without it, on ports where splhigh() is inline, the compiler will optimise
> > the second SOFTINT_PENDING test in softint_schedule(). A dissasembly
> > of softint_schedule() with and without the volatile sh_flags confirm this
> > on sparc.
> > Because of this there is a race that could lead to the softhand_t
> > being enqueued twice on si_q, leading to a corrupted queue and
> > some handler being SOFTINT_PENDING but never called.
> 
> Nice diagnosis! However the softint code is correct.
> 
> splhigh/splx on sparc64 should be real functions, or if one believes there
> is a performance advantage, should be inlines with __insn_barrier in the
> correct spots. Consider the potential effects elsewhere. I pointed this
> issue out to Martin or Matthew a couple of years ago and then promptly
> forgot about it.

Yes, it seems __insn_barrier() would do it too. All ports needs to be audited
then; I've seen this on sparc not sparc64 (I don't know if they share
their spl functions) and macallan@ reported this could be an issue on
macppc too.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index