From owner-freebsd-bugs@FreeBSD.ORG Thu Nov 10 22:20:08 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21814106564A for ; Thu, 10 Nov 2011 22:20:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id EBC528FC08 for ; Thu, 10 Nov 2011 22:20:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id pAAMK7Po008350 for ; Thu, 10 Nov 2011 22:20:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id pAAMK7oJ008349; Thu, 10 Nov 2011 22:20:07 GMT (envelope-from gnats) Date: Thu, 10 Nov 2011 22:20:07 GMT Message-Id: <201111102220.pAAMK7oJ008349@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jilles Tjoelker Cc: Subject: Re: misc/162403: regression in FreeBSD/9 regarding pthread timeouts in kernel context X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jilles Tjoelker List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 22:20:08 -0000 The following reply was made to PR misc/162403; it has been noted by GNATS. From: Jilles Tjoelker To: bug-followup@FreeBSD.org, davidxu@FreeBSD.org, ag-freebsd@muc.de Cc: Subject: Re: misc/162403: regression in FreeBSD/9 regarding pthread timeouts in kernel context Date: Thu, 10 Nov 2011 23:14:46 +0100 > [pthread_cond_timedwait() does not time out when called from RT > priority process] It looks like _thr_ucond_wait() drops the flags such as CVWAIT_ABSTIME and CVWAIT_CLOCKID that may be passed from cond_wait_kernel() in thr_cond.c. The below patch fixes the problem for me. Testing and review would be nice. Index: lib/libthr/thread/thr_umtx.c =================================================================== --- lib/libthr/thread/thr_umtx.c (revision 226880) +++ lib/libthr/thread/thr_umtx.c (working copy) @@ -231,7 +231,7 @@ int _thr_ucond_wait(struct ucond *cv, struct umutex *m, - const struct timespec *timeout, int check_unparking) + const struct timespec *timeout, int flags) { if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 && timeout->tv_nsec <= 0))) { @@ -240,7 +240,7 @@ return (ETIMEDOUT); } return _umtx_op_err(cv, UMTX_OP_CV_WAIT, - check_unparking ? UMTX_CHECK_UNPARKING : 0, + flags, m, __DECONST(void*, timeout)); } Index: lib/libthr/thread/thr_umtx.h =================================================================== --- lib/libthr/thread/thr_umtx.h (revision 226880) +++ lib/libthr/thread/thr_umtx.h (working copy) @@ -55,7 +55,7 @@ const struct timespec *timeout, int shared) __hidden; int _thr_umtx_wake(volatile void *mtx, int count, int shared) __hidden; int _thr_ucond_wait(struct ucond *cv, struct umutex *m, - const struct timespec *timeout, int check_unpaking) __hidden; + const struct timespec *timeout, int flags) __hidden; void _thr_ucond_init(struct ucond *cv) __hidden; int _thr_ucond_signal(struct ucond *cv) __hidden; int _thr_ucond_broadcast(struct ucond *cv) __hidden; -- Jilles Tjoelker