From owner-cvs-all@FreeBSD.ORG Tue Feb 27 16:51:12 2007 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3228216A402; Tue, 27 Feb 2007 16:51:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 029AC13C4A8; Tue, 27 Feb 2007 16:51:11 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 90AA347FD1; Tue, 27 Feb 2007 11:51:11 -0500 (EST) Date: Tue, 27 Feb 2007 16:51:11 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kostik Belousov In-Reply-To: <20070227113338.GA30955@deviant.kiev.zoral.com.ua> Message-ID: <20070227164537.P46064@fledge.watson.org> References: <200702270251.l1R2pfaT072096@repoman.freebsd.org> <20070227113338.GA30955@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Greg Lehey , cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/share/man/man9 sleep.9 X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2007 16:51:12 -0000 On Tue, 27 Feb 2007, Kostik Belousov wrote: > On Tue, Feb 27, 2007 at 02:51:41AM +0000, Greg Lehey wrote: >> grog 2007-02-27 02:51:41 UTC >> >> FreeBSD src repository >> >> Modified files: >> share/man/man9 sleep.9 >> Log: >> Add warning about deadlocks created by use of wakeup_one. > > +.Fn wakeup_one > +does not work reliably if more than one process is sleeping on the same > +address; > +in this case it is possible for an unrelated process to be woken. > +This process will ignore the wakeup, and the correct process will never be > +woken. > +.Pp > > Is this a bug (that should be fixed), or some fundamental issue with > wakeup_one() ? I'm also confused about this addition to the man page -- the sleep/wakeup model is premised on using a synchronization name space that we, for convenience, align with the possible pointer value name space. In general, the approach works because we tie memory ownership to use of a synchronization address. It sounds like wakeup_one() works entirely reliably, but that some piece of kernel code is sleeping on an address associated with memory it doesn't own. This is not a bug on wakeup_one(), it is a bug in a consumer of the sleep(9) APIs. I'd like to see this change backed out, and replaced with a note explicitly describing how the uniqueness of sleep/wakeup addresses is tied to memory allocation, and that improper use of the APIs can result in consumers behaving unreliably. Robert N M Watson Computer Laboratory University of Cambridge