From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 16:01:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB27910656A2 for ; Fri, 24 Oct 2008 16:01:16 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.236]) by mx1.freebsd.org (Postfix) with ESMTP id 84EBF8FC3B for ; Fri, 24 Oct 2008 16:01:16 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by wr-out-0506.google.com with SMTP id c8so102099wra.27 for ; Fri, 24 Oct 2008 09:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received: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; bh=MM8bYIndOiQtRtjFVTqYOboj2BojHmfyijmEjYeCj2E=; b=alJ7jIUktf2M/pxxpHxapHny56h1je1Lp9oXxp9efAUh8H9ZBe7yEBXuxeVumw8XwS FtySEYxkFgCNTKDK6Vdag+JUoNGxqcF5w/MkXiRzjHJCJnH+XgI7L+GQmHwyqiEOOSGS TEMDmm44gtmrMZCmHoZCxhbcfJRcqRvfzuH38= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=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=SlNihARdN1tJESbDnuMslWNTbtqZgFLlv6JyJl6UvLM1EZEf3MS60VLV4aiQfnVffu UFiUfPZuguni1d61TBMtVnqQlTTcuz6KVba1FHbJSyn2NBmrrXpcAppfr9z1pyDDE9jL L5fjKxarh+jv+YgjoxxmV2zg2eCnfy5/mY/Lo= Received: by 10.103.218.9 with SMTP id v9mr1129573muq.91.1224864074596; Fri, 24 Oct 2008 09:01:14 -0700 (PDT) Received: by 10.103.239.14 with HTTP; Fri, 24 Oct 2008 09:01:14 -0700 (PDT) Message-ID: <3bbf2fe10810240901s576f6dday9b59ad44f0a1a85@mail.gmail.com> Date: Fri, 24 Oct 2008 18:01:14 +0200 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "David Xu" In-Reply-To: <200810240103.m9O13V7f071075@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200810240103.m9O13V7f071075@svn.freebsd.org> X-Google-Sender-Auth: cd72d7d9da6f7025 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184216 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2008 16:01:16 -0000 2008/10/24 David Xu : > Author: davidxu > Date: Fri Oct 24 01:03:31 2008 > New Revision: 184216 > URL: http://svn.freebsd.org/changeset/base/184216 > > Log: > partly revert revision 184199, because TDF_NEEDSIGCHK is persitent > when thread is in kernel mode, it can cause dead loop, now unlock > process lock after acquired sleep queue lock and thread lock to > avoid the problem. This means TDF_NEEDSIGCHK and TDF_NEEDSUSPCHK must > be set with process lock and thread lock being hold at same time. > > Modified: > head/sys/kern/subr_sleepqueue.c > > Modified: head/sys/kern/subr_sleepqueue.c > ============================================================================== > --- head/sys/kern/subr_sleepqueue.c Thu Oct 23 21:50:16 2008 (r184215) > +++ head/sys/kern/subr_sleepqueue.c Fri Oct 24 01:03:31 2008 (r184216) > @@ -396,7 +396,6 @@ sleepq_catch_signals(void *wchan, int pr > return (0); > } > > -catch_sig: > thread_unlock(td); > mtx_unlock_spin(&sc->sc_lock); > CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)", > @@ -416,19 +415,15 @@ catch_sig: > ret = ERESTART; > mtx_unlock(&ps->ps_mtx); > } > - PROC_UNLOCK(p); > > mtx_lock_spin(&sc->sc_lock); > thread_lock(td); > - if (ret != 0) > - goto out; > - if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) != 0) > - goto catch_sig; > - > - sleepq_switch(wchan, pri); > - return (0); > + PROC_UNLOCK(p); > + if (ret == 0) { > + sleepq_switch(wchan, pri); > + return (0); > + } > > -out: > /* > * There were pending signals and this thread is still > * on the sleep queue, remove it from the sleep queue. > As long as this is a variation about the usual scheme in the td_flags locking, you should document that with a comment IMHO. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein