From owner-freebsd-hackers Mon Feb 3 07:56:58 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id HAA04446 for hackers-outgoing; Mon, 3 Feb 1997 07:56:58 -0800 (PST) Received: from eldorado.net-tel.co.uk ([193.122.171.253]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id HAA04435 for ; Mon, 3 Feb 1997 07:56:52 -0800 (PST) From: Andrew.Gordon@net-tel.co.uk Received: (from root@localhost) by eldorado.net-tel.co.uk (8.6.12/8.6.10) id PAA25467; Mon, 3 Feb 1997 15:55:34 GMT Received: from "/PRMD=NET-TEL/ADMD=GOLD 400/C=GB/" by net-tel.co.uk (Route400-RFCGate); Mon, 3 Feb 97 15:53:27 +0000 X400-Received: by mta "eldorado" in "/PRMD=net-tel/ADMD=gold 400/C=gb/"; Relayed; Mon, 3 Feb 97 15:53:27 +0000 X400-Received: by mta "net-tel cambridge" in "/PRMD=net-tel/ADMD=gold 400/C=gb/"; Relayed; Mon, 3 Feb 97 15:53:25 +0000 X400-Received: by "/PRMD=NET-TEL/ADMD=Gold 400/C=GB/"; Relayed; Mon, 3 Feb 97 15:53:25 +0000 X400-MTS-Identifier: ["/PRMD=NET-TEL/ADMD=Gold 400/C=GB/";hst:8655-970203155325-43F7] X400-Content-Type: P2-1984 (2) X400-Originator: Andrew.Gordon@net-tel.co.uk Original-Encoded-Information-Types: IA5-Text X400-Recipients: non-disclosure:; Date: Mon, 3 Feb 97 15:53:25 +0000 X400-Content-Identifier: Re: OK, here goe Message-Id: <"3a14-970203154823-6178*/G=Andrew/S=Gordon/O=NET-TEL Computer Systems Ltd/PRMD=NET-TEL/ADMD=Gold 400/C=GB/"@MHS> To: rminnich@Sarnoff.COM Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: Subject: Re: OK, here goes fastlock: (fwd) Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk [debug ifdefs removed from quoted section for brevity] > fastunlock(int *address, int unlockval) > { > int dosyscall = 0; > static int syscallnum = -1; /* this is really in the file */ > if (*address & 0x80000000) /***/ > dosyscall = 1; > *address = unlockval; > if (dosyscall) > syscall(syscallnum, 0, address, unlockval); > } Isn't there a race here? If the process holding the lock happens to get descheduled at the point marked /***/ and another process blocks waiting for the lock, the syscall doesn't get called and the second process continues to block until the 10 second timeout in the syscall. This can no doubt be fixed with another tset of some sort when releasing the lock. > 2) The 'address' argument does NOT NEED TO BE AN ADDRESS. it's a number > that all the procs have to agree on, that is all. You seem to be assuming that it _is_ an address in this implementation however: > int curval = fuword((void *) uap->address); > if (curval == uap->unlocked) > return;