Subject: Return value of cpu_switchto(9)
To: None <tech-kern@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 05/20/2007 22:22:00
Hi folks,

reading cpu_switchto(9) I got the impression that, whatever the first arg
to the function is, it should always return curlwp before the switch:

RETURN VALUES
     cpu_switchto() does not return until another LWP calls cpu_switchto() to
     switch to us.  It returns an lwp from which we have been switched, i.e.,
     an LWP which called cpu_switchto to switch to us.

Now from experiments with sparc64 it seems that this is wrong: it always
needs to return it's first arg, otherwise we'll hit a lockdebug assertion
because we try to unlock an lwp twice.

Is the man page wrong, or is this papering over a different bug?

Martin