From patchwork Wed Sep 9 03:32:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 1360313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=R/WW9N+u; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=mail header.b=Z7tsJS+I; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BmSJF3TqWz9sRK for ; Wed, 9 Sep 2020 13:32:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Ciklx1+PzFDpHd94xmQBDyhqR7iy7a8oqH0KzUBmnI8=; b=R/WW9N+uqe3zvc5+QDes8L7jRR qCqH9FZuzWzV699I4M23nctAlwDfOBXwarUrB+29u4tr9Gp4slicFRzgkxRLOpIOIkT3lfpRrSFfW D+BWplla2MBix2Fhk0Q98cTeu8SbDvGdnljOYSoxNWrKoXR7Oy48GGAxPdwHC0/UExlD0wsZ4r090 PdKoTfeQalQN2NNxXWbENUAnS4j39WQiE2XqIkO26nQ4TUn0OrywKKZ+3Qa6fzemJco4htxYzQyYB mmF+Jj5UAM1rQRwwh6yt/o4sW61YpSeXoPJE8mptyWHcxXJYC49sqlyoxAj/Xaqubqbm2ewA1vUef Wuu0X7ig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFqqQ-00040X-JK; Wed, 09 Sep 2020 03:32:26 +0000 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFqqO-000407-9S for linux-snps-arc@lists.infradead.org; Wed, 09 Sep 2020 03:32:25 +0000 Received: from mailhost.synopsys.com (sv2-mailhost2.synopsys.com [10.205.2.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id EE7B940194; Wed, 9 Sep 2020 03:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1599622343; bh=pY9pJjWL9a50maoWNrVjfTwURhusUfH/NsLeFHDVXdk=; h=From:To:Cc:Subject:Date:From; b=Z7tsJS+IMov6jvuWwTXjUXOYXKFTMNtjI8HAHI0mCuPevO8ZFY6eRk/bzEHQzhaoT 47E6bUCzhuY0Gz4CWN9/lBaPJe7SQAPu0mq81m6obksieAYGF6kVEa2fZzXLG60eJ7 Qe2hy8Vi8hXbQ2yPGDtEoh6kg4o+0cx98wA3VIkHTeWBOaGSENdjJ0ePR8uSGHgLOt zznavXn8T3WuodwAs3T2Q6OSwTDnIGimSYuCcQlG6vERT9Cg8NG539xXOz/0xa/9nM Kwm9gmE8oCeiUQ0kWcFJugngvYA+iPMJKUysGZkJ4T66MCa0O+iFQH5ivBAhy5Otcu L0hbBLCHPDa5A== Received: from vineetg-Latitude-7400.internal.synopsys.com (unknown [10.13.183.89]) by mailhost.synopsys.com (Postfix) with ESMTP id ACBB9A0096; Wed, 9 Sep 2020 03:32:22 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Vineet Gupta To: libc-alpha@sourceware.org Subject: [PATCH] support: user more portable atomic wrappers Date: Tue, 8 Sep 2020 20:32:21 -0700 Message-Id: <20200909033221.3549140-1-vgupta@synopsys.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_233224_468672_90512270 X-CRM114-Status: GOOD ( 12.01 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [149.117.73.133 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , linux-snps-arc@lists.infradead.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This came up in a nascent arc64 port, lacking gcc atomics for now --- support/support_record_failure.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/support/support_record_failure.c b/support/support_record_failure.c index f766c0623683..65e576c6e901 100644 --- a/support/support_record_failure.c +++ b/support/support_record_failure.c @@ -25,6 +25,7 @@ #include #include #include +#include /* This structure keeps track of test failures. The counter is incremented on each failure. The failed member is set to true if a @@ -66,8 +67,8 @@ support_record_failure (void) } /* Relaxed MO is sufficient because we are only interested in the values themselves, in isolation. */ - __atomic_store_n (&state->failed, 1, __ATOMIC_RELEASE); - __atomic_add_fetch (&state->counter, 1, __ATOMIC_RELEASE); + atomic_store_release (&state->failed, 1); + atomic_fetch_add_release (&state->counter, 1); } int @@ -84,10 +85,10 @@ support_report_failure (int status) assumes that exiting from the main thread happens before the error reporting via support_record_failure, which requires some form of external synchronization. */ - bool failed = __atomic_load_n (&state->failed, __ATOMIC_RELAXED); + bool failed = atomic_load_relaxed (&state->failed); if (failed) printf ("error: %u test failures\n", - __atomic_load_n (&state->counter, __ATOMIC_RELAXED)); + atomic_load_relaxed (&state->counter)); if ((status == 0 || status == EXIT_UNSUPPORTED) && failed) /* If we have a recorded failure, it overrides a non-failure @@ -101,8 +102,8 @@ support_record_failure_reset (void) { /* Only used for testing the test framework, with external synchronization, but use release MO for consistency. */ - __atomic_store_n (&state->failed, 0, __ATOMIC_RELAXED); - __atomic_add_fetch (&state->counter, 0, __ATOMIC_RELAXED); + atomic_store_relaxed (&state->failed, 0); + atomic_fetch_add_release (&state->counter, 0); } int @@ -110,5 +111,5 @@ support_record_failure_is_failed (void) { /* Relaxed MO is sufficient because we need (blocking) external synchronization for reliable test error reporting anyway. */ - return __atomic_load_n (&state->failed, __ATOMIC_RELAXED); + return atomic_load_relaxed (&state->failed); }