Subject: Re: changing the spinlockmgr() "not used" case
To: Simon Burge <simonb@wasabisystems.com>
From: Alfred Perlstein <bright@mu.org>
List: tech-kern
Date: 10/17/2001 13:15:33
* Simon Burge <simonb@wasabisystems.com> [011017 08:52] wrote:
> Folks,
> 
> If you don't assign the value returned by spinlockmgr() and don't have
> either of the "MULTIPROCESSOR" or "LOCKDEBUG" options, you get the
> following warnings:
> 
> 	/sys/kern/kern_proc.c: In function `proclist_lock_read':
> 	/sys/kern/kern_proc.c:212: warning: statement with no effect
> 	/sys/kern/kern_proc.c: In function `proclist_lock_write':
> 	/sys/kern/kern_proc.c:244: warning: statement with no effect
> 
> The definition in the !(MULTIPROCESSOR || LOCKDEBUG) case is
> 
> 	#define spinlockmgr(lkp, flags, intrlk)         (0)
> 
> Using
> 
> 	(void)spinlockmgr(args, ...)
> 
> quells the warning, but I don't want to have to use the (void) prefix
> (and not for reasons that started another ... "discussion" recently).
> 
> Is there any other ways around this?

Remove the (0).

Honestly this worries me, the point of a spinlock may be to protect
a reasource accessed at interrupt time, traditionally kernel spinlocks
either implicitly mask all interrupts, or take an interrupt mask
to block (possibly an empty mask if there's no driver interaction).

How does one utilize spinlocks within drivers without an interrupt
masking mechinism?  And how does one avoid an interrupt causing
a deadlock against the same CPU without an interrupt mask?

-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
                           http://www.morons.org/rants/gpl-harmful.php3