Subject: Re: mutex fault
To: Andrew Doran <>
From: Manuel Bouyer <>
List: tech-kern
Date: 12/07/2007 16:51:55
On Fri, Dec 07, 2007 at 01:45:48PM +0000, Andrew Doran wrote:
> On Fri, Dec 07, 2007 at 12:11:23PM +0100, Manuel Bouyer wrote:
> > [ moved to tech-kern to get wider audience ]
> > 
> > Hi,
> > does anyone with some clues about locking have some comments about this ?
> > I've also seen this on a xenamd64 system. This system has raidframe
> > and LFS (the LFS is not on a RAID partition) if that matters.
> I saw similar problems on i386 when the compiler was reordering the
> statements in MUTEX_SPIN_SPLRAISE/SPLRESTORE in kern_mutex.c, however that
> was fixed a very long time ago. splraise/spllower are function calls on xen
> so there should be no problems, and reading the disassembly it looks OK.
> It may be something to do with the SPL, because on a single processor system
> there is no other race than can occur in that path. Can an interrupt on Xen
> access the scheduler at IPL_HIGH?

Hum, I may have a clue. The xenevt (src/sys/arch/xen/xen/xenevt.c) bypass
the SPL system. It shouldn't deal directly with the scheduler when
ci->ci_ilevel >= IPL_SOFTSERIAL, but call softint_schedule().

The code is sys/arch/xen/xen/xenevt.c. The interrupt handler will call

Manuel Bouyer, LIP6, Universite Paris VI. 
     NetBSD: 26 ans d'experience feront toujours la difference