From owner-cvs-src-old@FreeBSD.ORG  Sun Jan 24 15:10:28 2010
Return-Path: <owner-cvs-src-old@FreeBSD.ORG>
Delivered-To: cvs-src-old@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 837351065697
	for <cvs-src-old@freebsd.org>; Sun, 24 Jan 2010 15:10:28 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from repoman.freebsd.org (repoman.freebsd.org
	[IPv6:2001:4f8:fff6::29])
	by mx1.freebsd.org (Postfix) with ESMTP id 706498FC0A
	for <cvs-src-old@freebsd.org>; Sun, 24 Jan 2010 15:10:28 +0000 (UTC)
Received: from repoman.freebsd.org (localhost [127.0.0.1])
	by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o0OFASwi064823
	for <cvs-src-old@freebsd.org>; Sun, 24 Jan 2010 15:10:28 GMT
	(envelope-from attilio@repoman.freebsd.org)
Received: (from svn2cvs@localhost)
	by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o0OFAS6H064822
	for cvs-src-old@freebsd.org; Sun, 24 Jan 2010 15:10:28 GMT
	(envelope-from attilio@repoman.freebsd.org)
Message-Id: <201001241510.o0OFAS6H064822@repoman.freebsd.org>
X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to
	attilio@repoman.freebsd.org using -f
From: Attilio Rao <attilio@FreeBSD.org>
Date: Sun, 24 Jan 2010 15:07:00 +0000 (UTC)
To: cvs-src-old@freebsd.org
X-FreeBSD-CVS-Branch: HEAD
Subject: cvs commit: src/share/man/man9 kthread.9 src/sys/kern
 kern_kthread.c src/sys/sys kthread.h
X-BeenThere: cvs-src-old@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: **OBSOLETE** CVS commit messages for the src tree
	<cvs-src-old.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/cvs-src-old>,
	<mailto:cvs-src-old-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/cvs-src-old>
List-Post: <mailto:cvs-src-old@freebsd.org>
List-Help: <mailto:cvs-src-old-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/cvs-src-old>,
	<mailto:cvs-src-old-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 24 Jan 2010 15:10:28 -0000

attilio     2010-01-24 15:07:00 UTC

  FreeBSD src repository

  Modified files:
    share/man/man9       kthread.9 
    sys/kern             kern_kthread.c 
    sys/sys              kthread.h 
  Log:
  SVN rev 202933 on 2010-01-24 15:07:00Z by attilio
  
  - Fix the kthread_{suspend, resume, suspend_check}() locking.
    In the current code, the locking is completely broken and may lead
    easilly to deadlocks. Fix it by using the proc_mtx, linked to the
    suspending thread, as lock for the operation.  Keep using the
    thread_lock for setting and reading the flag even if it is not entirely
    necessary (atomic ops may do it as well, but this way the code is more
    readable).
  - Fix a deadlock within kthread_suspend().
    The suspender should not sleep on a different channel wrt the suspended
    thread, or, otherwise, the awaker should wakeup both. Uniform the
    interface to what the kproc_* counterparts do (sleeping on the same
    channel).
  - Change the kthread_suspend_check() prototype.
    kthread_suspend_check() always assumes curthread and must only refer to
    it, so skip the thread pointer as it may be easilly mistaken.
    If curthread is not a kthread, the system will panic.
  
  In collabouration with: jhb
  Tested by:              Giovanni Trematerra
                          <giovanni dot trematerra at gmail dot com>
  MFC:                    2 weeks
  
  Revision  Changes    Path
  1.21      +4 -7      src/share/man/man9/kthread.9
  1.51      +52 -18    src/sys/kern/kern_kthread.c
  1.13      +1 -1      src/sys/sys/kthread.h