[OpenAFS-devel] locks

Nickolai Zeldovich kolya@MIT.EDU
Mon, 28 Oct 2002 16:18:34 -0500


> Can anyone offer any guidance on kernel locks for the client?  I'm using
> FreeBSD as a model for my OpenBSD port, but I'm not even sure it's right.

Here's my understanding of these macros:

> AFS_GLOBAL_SUNLOCK

AFAICT, this means you use explicit mutex locks instead of splnet et al.
You probably want this.

> RX_ENABLE_LOCKS

Fine-grained locking in Rx, as opposed to assuming non-preemptive threads.
I think you could actually have AFS_GLOBAL_SUNLOCK and no RX_ENABLE_LOCKS,
and all the Rx code would simply run under the AFS global lock (GLOCK).
But you probably want this as well.

> AFS_GLOBAL_RXLOCK_KERNEL

I'm somewhat puzzled by this one.  Seems to be some synchronization between
rxi_Start and the rest of the code over the transmit queue for a call.  It
seems like all other platforms declare it (in the kernel)..

> MUTEX_INIT (and friends)

These are the Rx mutex lock wrappers, if RX_ENABLE_LOCKS is set.
This also includes CV_* for condvars.

> HEAVY_LOCKS
> NULL_LOCKS

This seems to be just some FreeBSD-specific thing, which lets you
choose real locks (HEAVY_LOCKS) or fake locks (NULL_LOCKS) which
assume that you have no concurrency whatsoever.

-- kolya