From patchwork Wed Mar 2 14:04:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Marlier X-Patchwork-Id: 85085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 393D2B70AA for ; Thu, 3 Mar 2011 01:04:34 +1100 (EST) Received: (qmail 7273 invoked by alias); 2 Mar 2011 14:04:32 -0000 Received: (qmail 7263 invoked by uid 22791); 2 Mar 2011 14:04:30 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from columbi.unine.ch (HELO unine.ch) (130.125.1.54) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Mar 2011 14:04:26 +0000 Received: from mail-11.unine.ch ([130.125.5.94]) by unine.ch stage1 with esmtps (Exim MailCleaner) id 1Pumf7-0004sQ-N2 from ; Wed, 02 Mar 2011 15:04:21 +0100 Received: from mail-21.UNINE.CH (130.125.1.40) by mail-11.UNINE.CH (130.125.5.94) with Microsoft SMTP Server (TLS) id 8.3.137.0; Wed, 2 Mar 2011 15:04:21 +0100 Received: from [130.125.11.134] (130.125.11.134) by webmail.unine.ch (130.125.1.20) with Microsoft SMTP Server (TLS) id 8.3.137.0; Wed, 2 Mar 2011 15:04:21 +0100 Message-ID: <4D6E4E62.7030008@unine.ch> Date: Wed, 2 Mar 2011 15:04:18 +0100 From: Patrick Marlier User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Richard Henderson CC: Aldy Hernandez , "gcc-patches@gcc.gnu.org" Subject: [trans-mem] missing case in rwlock::write_upgrade X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org In libitm, a specific case is missing in rwlock::write_upgrade. Indeed, if there is no concurrent active reader while upgrading the lock, we have to unset the a_reader bit (we were the only reader). Patrick Marlier. libitm/ * config/posix/rwlock.cc (write_upgrade): Add missing case. Index: libitm/config/posix/rwlock.cc =================================================================== --- libitm/config/posix/rwlock.cc (revision 170587) +++ libitm/config/posix/rwlock.cc (working copy) @@ -130,6 +130,11 @@ // We only return from upgrade when we've got it; don't loop. assert ((sum & (a_reader | a_writer)) == 0); } + else + { + // We were the only reader. + sum &= ~a_reader; + } // Otherwise we can upgrade to writer. this->summary = sum | a_writer;