[OpenAFS-devel] lwp PRE_Block on linux

Chaskiel M Grundman cg2v+@andrew.cmu.edu
Fri, 13 Apr 2001 16:24:16 -0400 (EDT)


Excerpts from internet.computing.openafs.devel: 12-Apr-101 Re:
[OpenAFS-devel] lwp PRE.. by Adam Thornton@sinenomine 
  
> *Why* is PRE_Block defined differently on different architectures?  As
> far as I can tell, it's a boolean.  In fact, as far as I can tell, it's
> being used as a mutex and it makes me nervous that it isn't a mutex, but
> that's a whole 'nother issue.
It is a mutex, sort of. It doesn't protect a critical section the same
way a normal mutex does. All it's doing is preventing asynchronus
context switches (as would be done in preempt.c:AlarmHandler) while any
context switch or thread setup operations is occuring. Since LWP is not
otherwise pre-emptive, it doesn't need a stronger mutex than that 

> It broke between 1.0.2 and 1.0.3 and I had to change the process.s
> source for S/390.  It looks like this patch will break my workaround
> again.
It looks to me like all non-osf architectures accessed PRE_Block as a
char, until this delta was commited:
http://www.openafs.org/cgi-bin/cvsweb.cgi/openafs/src/lwp/process.c.diff?r1=1.4
&r2=1.5

Admitedly, PRE_Block was *defined* as an int in preempt.c, but it was
always accessed as a char. As to why it it was that way, it's hard to
tell. It seems as though when LWP preemption was disabled for linux
(it's not actually used by afs after all, and at one time, linux did not
support 3 argument signal handlers, or siginfo_t/ucontext_t's), whoever
did so copied the wrong definition of PRE_Block.