From patchwork Sat May 14 03:34:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 9094511 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5240D9F1C3 for ; Sat, 14 May 2016 03:36:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8B7B20148 for ; Sat, 14 May 2016 03:36:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08B6B20114 for ; Sat, 14 May 2016 03:36:54 +0000 (UTC) Received: from localhost ([::1]:36546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1QNp-0006rr-9r for patchwork-qemu-devel@patchwork.kernel.org; Fri, 13 May 2016 23:36:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1QM1-0002lG-0h for qemu-devel@nongnu.org; Fri, 13 May 2016 23:35:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1QLy-0005Kd-VU for qemu-devel@nongnu.org; Fri, 13 May 2016 23:34:59 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:49570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1QLw-0005JP-MC for qemu-devel@nongnu.org; Fri, 13 May 2016 23:34:58 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A3B0220B6B for ; Fri, 13 May 2016 23:34:41 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Fri, 13 May 2016 23:34:41 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=4zkp/qBN6V3z5ovo/ZHsqCcCvwE =; b=EXC2Y9qUHYQqDqCjLIo82oOXHkdD18mwd/aZ+ak4PbVbtXujYpwYzaFAgjH ZXZSOk+tjYuhYchsF23B81OiLADnKqcG6VC1E6UkVCGX00LRLuH3DTu4EBIdq+Us tRI8PiC3Uu1vbvyW44e74KUhQzoRnUDuiygZhELGkcEUDqjE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=4zkp /qBN6V3z5ovo/ZHsqCcCvwE=; b=WCMB3eLGixS4F4r3/v3CxzXZaRSlHIu1Jgzv I2WFzYXmrVA7u25gJIpRnYMq7gs7tvR2pkqmc9MuLg69CaIxs25rTDUmxAVWuCQG UxlsvU80t2hc4dHMsdXG1GPovZUWV5MP4t50CLTfjlmEp40P0cowEl9Ul/rv3HIl 7g7zERk= X-Sasl-enc: xect3BJ1ybCc6oEd/GYcUF4QSI6zcjWW7aJERW0rkPAx 1463196881 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4F5A9C00014; Fri, 13 May 2016 23:34:41 -0400 (EDT) From: "Emilio G. Cota" To: QEMU Developers , MTTCG Devel Date: Fri, 13 May 2016 23:34:20 -0400 Message-Id: <1463196873-17737-6-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463196873-17737-1-git-send-email-cota@braap.org> References: <1463196873-17737-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.29 Subject: [Qemu-devel] [PATCH v5 05/18] atomics: add atomic_test_and_set_acquire X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Sergey Fedorov , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Crosthwaite Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This new helper expands to __atomic_test_and_set with acquire semantics where available; otherwise it expands to __sync_test_and_set, which has acquire semantics. Signed-off-by: Emilio G. Cota --- include/qemu/atomic.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 5bc4d6c..6061a46 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -113,6 +113,7 @@ } while(0) #endif +#define atomic_test_and_set_acquire(ptr) __atomic_test_and_set(ptr, __ATOMIC_ACQUIRE) /* All the remaining operations are fully sequentially consistent */ @@ -327,6 +328,8 @@ #endif #endif +#define atomic_test_and_set_acquire(ptr) __sync_lock_test_and_set(ptr, true) + /* Provide shorter names for GCC atomic builtins. */ #define atomic_fetch_inc(ptr) __sync_fetch_and_add(ptr, 1) #define atomic_fetch_dec(ptr) __sync_fetch_and_add(ptr, -1)