From patchwork Mon Aug 11 14:26:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernie Ogden X-Patchwork-Id: 35207 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8C0920540 for ; Mon, 11 Aug 2014 14:22:56 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp18sf37846194obc.5 for ; Mon, 11 Aug 2014 07:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results; bh=lkNEMvCskd9rDstDYDzZHftbkPocD+BDOn6C4wcTszk=; b=GRVTVBCr32JyS81bVY2eoRDnf+qyhfdfQ/7h7LickFspD07CmqpDQlcZ1QCNkmF8/c zaZfM48LDm0xR9z3o0uv8C2ssB5QEHXzN8qDQiQ06iTnpYfw+AhQu9Mv8F3QXyen87Su TQ4/DoUCxjbZesc0+neZRZpthb1MNwlSgFqEyLPcQBuk+r3JZ6h7no1X+uaxKFcGkSq9 bwKCy37+W78UZ1Gx9zMYhb26IEHw09VIQJUY9cEhnJgIriBt2gnUtMpdYvOs/1ZZwO6Y cLQhJKYsXnSZTgqrDS7RXsIdnsgchDezroCtQk40K4ZHgpwYJnUFlV9WO7GT2ecBlv3h XXaw== X-Gm-Message-State: ALoCoQlLyoVg2F2eMkKpwSxvNKpEqFFO4gYOkyJNBMAUtEoJlOVF4o56fROIt2qUKcCwCtKvDRzg X-Received: by 10.50.117.10 with SMTP id ka10mr11090504igb.1.1407766976282; Mon, 11 Aug 2014 07:22:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.11 with SMTP id y11ls1349213qgy.23.gmail; Mon, 11 Aug 2014 07:22:56 -0700 (PDT) X-Received: by 10.221.32.8 with SMTP id si8mr435766vcb.69.1407766976106; Mon, 11 Aug 2014 07:22:56 -0700 (PDT) Received: from mail-vc0-x229.google.com (mail-vc0-x229.google.com [2607:f8b0:400c:c03::229]) by mx.google.com with ESMTPS id ji10si4094194vdb.3.2014.08.11.07.22.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Aug 2014 07:22:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::229 as permitted sender) client-ip=2607:f8b0:400c:c03::229; Received: by mail-vc0-f169.google.com with SMTP id le20so11716790vcb.14 for ; Mon, 11 Aug 2014 07:22:56 -0700 (PDT) X-Received: by 10.52.119.229 with SMTP id kx5mr4875910vdb.40.1407766976019; Mon, 11 Aug 2014 07:22:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp168523vcb; Mon, 11 Aug 2014 07:22:55 -0700 (PDT) X-Received: by 10.70.130.195 with SMTP id og3mr41983267pdb.59.1407766974706; Mon, 11 Aug 2014 07:22:54 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id pq10si13508569pbb.233.2014.08.11.07.22.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Aug 2014 07:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-52143-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 27279 invoked by alias); 11 Aug 2014 14:22:44 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 27267 invoked by uid 89); 11 Aug 2014 14:22:43 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f43.google.com X-Received: by 10.180.108.13 with SMTP id hg13mr26563116wib.28.1407766959255; Mon, 11 Aug 2014 07:22:39 -0700 (PDT) From: Bernard Ogden To: will.newton@linaro.org, roland@hack.frob.com, libc-alpha@sourceware.org Cc: Bernard Ogden Subject: [PATCH] [BZ #16892] Check value of futex before updating in __lll_timedlock Date: Mon, 11 Aug 2014 15:26:48 +0100 Message-Id: <1407767208-20900-1-git-send-email-bernie.ogden@linaro.org> In-Reply-To: References: X-Original-Sender: bernie.ogden@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::229 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 Retrying with git send-email. Patch unchanged other than whitespace fix. 2014-08-07 Bernard Ogden [BZ #16892] * sysdeps/nptl/lowlevellock.h (__lll_timedlock): Use atomic_compare_and_exchange_bool_acq rather than atomic_exchange_acq. diff --git a/sysdeps/nptl/lowlevellock.h b/sysdeps/nptl/lowlevellock.h index 548a9c8..28f4ba3 100644 --- a/sysdeps/nptl/lowlevellock.h +++ b/sysdeps/nptl/lowlevellock.h @@ -88,12 +88,15 @@ extern int __lll_timedlock_wait (int *futex, const struct timespec *, extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *, int private) attribute_hidden; +/* Take futex if it is untaken. + Otherwise block until either we get the futex or abstime runs out. */ #define __lll_timedlock(futex, abstime, private) \ ({ \ int *__futex = (futex); \ int __val = 0; \ \ - if (__glibc_unlikely (atomic_exchange_acq (__futex, 1))) \ + if (__glibc_unlikely \ + (atomic_compare_and_exchange_bool_acq (__futex, 1, 0))) \ __val = __lll_timedlock_wait (__futex, abstime, private); \ __val; \ })