From owner-cvs-src@FreeBSD.ORG Wed Dec 20 12:42:36 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F81716A416 for ; Wed, 20 Dec 2006 12:42:36 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E84443CAF for ; Wed, 20 Dec 2006 12:41:28 +0000 (GMT) (envelope-from asmrookie@gmail.com) Received: by nf-out-0910.google.com with SMTP id n28so2070380nfc for ; Wed, 20 Dec 2006 04:41:18 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=sTay6HXN/bqzlMUGwsfuQqJNQVx6ezfdv3fGRscO5qVd8zEsqdHl6a0D9X38iKujIafIznaK5LBHEcB9i3gcmldPNUjl2l9VWOlW+n04tp3XsBL8oYUzpAskm6gxtwQSBUiIymItzYVtum6z7slUtpqZyh+onPEOkYaI8M2POHE= Received: by 10.82.190.2 with SMTP id n2mr1481606buf.1166618475903; Wed, 20 Dec 2006 04:41:15 -0800 (PST) Received: by 10.82.178.4 with HTTP; Wed, 20 Dec 2006 04:41:15 -0800 (PST) Message-ID: <3bbf2fe10612200441i2f658b59i83de7c21c7290ab1@mail.gmail.com> Date: Wed, 20 Dec 2006 13:41:15 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "Martin Blapp" In-Reply-To: <20061220120419.M53548@godot.imp.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200612192234.kBJMYYo0055529@repoman.freebsd.org> <3bbf2fe10612191850y3a546fcew486575385b1400df@mail.gmail.com> <20061220120419.M53548@godot.imp.ch> X-Google-Sender-Auth: fddd673dbf9f75a0 Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern tty.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Dec 2006 12:42:36 -0000 2006/12/20, Martin Blapp : > > Hi, > > > Since proctree_lock is a sx lock which uses 2 condition variables, > > they alredy drop Giant (DROP_GIANT()) before sleeping. Are you secure > > it is the right thing to do here? > > Yes I am. > > sx_slock() can call cv_wait() which later can call cv_wait_unlock ... > if there is already a lock we need to share ... After a possible > sleep cv_wait_unlock looks like: > > cv_wait_unlock(struct cv *cvp, struct mtx *mp) > > [...] > sleepq_lock(cvp); > > cvp->cv_waiters++; > DROP_GIANT(); > mtx_unlock(mp); > > [...] > > It can call DROP_GIANT for a short amount of time. This was the race. No, it drops Giant for all the time it sleeps. Maybe the race is somewhere else. Attilio -- Peace can only be achieved by understanding - A. Einstein