From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18938 invoked by alias); 20 Feb 2014 17:44:00 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 18570 invoked by uid 48); 20 Feb 2014 17:43:54 -0000 From: "john.ogness at linutronix dot de" To: glibc-bugs@sourceware.org Subject: [Bug nptl/11588] pthread condvars are not priority inheritance aware Date: Thu, 20 Feb 2014 17:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nptl X-Bugzilla-Version: 2.12 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: john.ogness at linutronix dot de X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00683.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=11588 John Ogness changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |john.ogness at linutronix dot de --- Comment #32 from John Ogness --- I believe there is an error in [PATCH 1/3 V3] where COND_PRIO_PROTECT will clobber the CLOCKID in cond->__data.__nwaiters. This is because the COND_PROTOCOL values are not shifted by COND_PROTOCOL_SHIFT before reading and writing to __nwaiters. I believe the switch cases in pthread_cond_init.c:__pthread_cond_init() should look like this: case PTHREAD_PRIO_INHERIT: cond->__data.__nwaiters |= COND_PRIO_INHERIT << COND_PROTOCOL_SHIFT; break; case PTHREAD_PRIO_PROTECT: cond->__data.__nwaiters |= COND_PRIO_PROTECT << COND_PROTOCOL_SHIFT; break; And the cond_lock() and cond_unlock() in cond-lock.h should look like this: static inline void cond_lock(pthread_cond_t *cond, int pshared) { if (pshared == LLL_PRIVATE && (((cond->__data.__nwaiters & COND_PROTOCOL_MASK) >> COND_PROTOCOL_SHIFT) == COND_PRIO_INHERIT)) lll_pi_lock (cond->__data.__lock, pshared); else lll_lock (cond->__data.__lock, pshared); } static inline void cond_unlock(pthread_cond_t *cond, int pshared) { if (pshared == LLL_PRIVATE && (((cond->__data.__nwaiters & COND_PROTOCOL_MASK) >> COND_PROTOCOL_SHIFT) == COND_PRIO_INHERIT)) lll_pi_unlock (cond->__data.__lock, pshared); else lll_unlock (cond->__data.__lock, pshared); } -- You are receiving this mail because: You are on the CC list for the bug.