From patchwork Sun Feb 9 19:51:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1235540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109304-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=mG75+8XF; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48G06T0DQhz9sRQ for ; Mon, 10 Feb 2020 06:51:44 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=E5h tqWqvRBy8bNDyWLkB6eiswhiOMeXCL6RiNMKps0mSf1N32vlee3F6kL54MoFTgmH pD8x0Bbo9UADoPGe3GvffIxc57isalwYx9Ugx8Ig3cTgp2yNSHo+EG1di2WZQxuA SNZlPN1HU/l3MkuCdO6OuMiQa4Se4tgVGDJYBY0c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=AVu30ZhSM wxGyr1I9Im9GS0Q1iA=; b=mG75+8XFoB4z/Bmp2iRSZhVm0DY6mDIzzoRrikKe1 /0AYCdH418B2d6Ctu5qULEDaj72tIyI2aN6h6pY0ZJih3rHQmAKuabwIouP1u6EF qzZFRWtzgrQTPcTDRfEnV1jQ6d3orXbVqwHPrT1VzRzbhAMl/AIVicXQSmaTjQEE hQ= Received: (qmail 112490 invoked by alias); 9 Feb 2020 19:51:38 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk 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 112482 invoked by uid 89); 9 Feb 2020 19:51:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 1/2] htl: support cancellation during pthread_once Date: Sun, 9 Feb 2020 20:51:31 +0100 Message-Id: <20200209195132.294255-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 --- sysdeps/htl/pt-once.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sysdeps/htl/pt-once.c b/sysdeps/htl/pt-once.c index 0581f7bd6c..7f86e28006 100644 --- a/sysdeps/htl/pt-once.c +++ b/sysdeps/htl/pt-once.c @@ -21,6 +21,13 @@ #include +static void +clear_once_control (void *arg) +{ + pthread_once_t *once_control = arg; + __pthread_spin_unlock (&once_control->__lock); +} + int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void)) { @@ -33,7 +40,10 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void)) if (once_control->__run == 0) { + pthread_cleanup_push (clear_once_control, once_control); init_routine (); + pthread_cleanup_pop (0); + atomic_full_barrier (); once_control->__run = 1; } From patchwork Sun Feb 9 19:51:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1235541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109305-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=GjCTsEjI; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48G06c1TLQz9sRQ for ; Mon, 10 Feb 2020 06:51:52 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=KUHCHDhCcbEvGOITBZmymoTr9DJT1N2n2F4R8tnYVyFW1ofhNKFO6 70ybGgVOhf54ByCXY8a83pASI+Ejhzb6iarSazV11+1uJOmrfs+dFQZefIf/PQXV 7u7aedcdPTVvhuJuJsnclf5sHUB1vA9mh/+37RwFjf6I0oVCK6v4/I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=RZZeENGfx7f0bJF/Czohk5j4JLk=; b=GjCTsEjIwp6C3P53K0W6E6Y3N9aS txyTOb4qmHCZbMVMveCUsvnJhy+mZoi5Yjf8ltgh+cr/tzL0hxNnLZBYJpY8ruAN nHkF5J/33HLW5lpuRtTSxLFSf2kois0xiw1+r7KBR6Tqa1g7gYsft90+75haTZ2Z o/TZejANAoFZQ/s= Received: (qmail 112649 invoked by alias); 9 Feb 2020 19:51:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk 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 112519 invoked by uid 89); 9 Feb 2020 19:51:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd, commited 2/2] pthread: Move most once tests from nptl to sysdeps/pthread Date: Sun, 9 Feb 2020 20:51:32 +0100 Message-Id: <20200209195132.294255-2-samuel.thibault@ens-lyon.org> In-Reply-To: <20200209195132.294255-1-samuel.thibault@ens-lyon.org> References: <20200209195132.294255-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 So they can be checked with htl too. --- nptl/Makefile | 7 ++----- sysdeps/pthread/Makefile | 6 ++++++ {nptl => sysdeps/pthread}/tst-once1.c | 0 {nptl => sysdeps/pthread}/tst-once2.c | 0 {nptl => sysdeps/pthread}/tst-once3.c | 0 {nptl => sysdeps/pthread}/tst-once4.c | 0 {nptl => sysdeps/pthread}/tst-oncex3.c | 0 {nptl => sysdeps/pthread}/tst-oncex4.c | 0 8 files changed, 8 insertions(+), 5 deletions(-) rename {nptl => sysdeps/pthread}/tst-once1.c (100%) rename {nptl => sysdeps/pthread}/tst-once2.c (100%) rename {nptl => sysdeps/pthread}/tst-once3.c (100%) rename {nptl => sysdeps/pthread}/tst-once4.c (100%) rename {nptl => sysdeps/pthread}/tst-oncex3.c (100%) rename {nptl => sysdeps/pthread}/tst-oncex4.c (100%) diff --git a/nptl/Makefile b/nptl/Makefile index 8fadd1d025..bf21413c26 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -248,7 +248,7 @@ tests = tst-attr2 tst-attr3 tst-default-attr \ tst-rwlock4 tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 \ tst-rwlock9 tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 \ tst-rwlock14 tst-rwlock15 tst-rwlock16 tst-rwlock17 tst-rwlock18 \ - tst-once1 tst-once2 tst-once3 tst-once4 tst-once5 \ + tst-once5 \ tst-key1 tst-key2 tst-key3 tst-key4 \ tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \ tst-sem8 tst-sem9 tst-sem10 tst-sem14 \ @@ -375,8 +375,7 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \ tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \ tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 \ tst-cancelx16 tst-cancelx17 tst-cancelx18 tst-cancelx20 tst-cancelx21 \ - tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \ - tst-oncex3 tst-oncex4 + tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 ifeq ($(build-shared),yes) tests += tst-atfork2 tst-tls4 tst-_res1 tst-fini1 tst-compat-forwarder \ tst-audit-threads @@ -516,8 +515,6 @@ CFLAGS-tst-cleanupx2.c += -fexceptions CFLAGS-tst-cleanupx3.c += -fexceptions CFLAGS-tst-cleanupx4.c += -fexceptions CFLAGS-tst-cleanupx4aux.c += -fexceptions -CFLAGS-tst-oncex3.c += -fexceptions -CFLAGS-tst-oncex4.c += -fexceptions CFLAGS-tst-align.c += $(stack-align-test-flags) CFLAGS-tst-align3.c += $(stack-align-test-flags) CFLAGS-tst-initializers1.c += -W -Wall -Werror diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile index 2c33c5c904..6b49e33bdc 100644 --- a/sysdeps/pthread/Makefile +++ b/sysdeps/pthread/Makefile @@ -51,11 +51,17 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \ tst-cond23 tst-cond24 tst-cond25 \ tst-cond-except \ tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex6 tst-mutex10 \ + tst-once1 tst-once2 tst-once3 tst-once4 \ tst-spin1 tst-spin2 tst-spin3 tst-spin4 +tests += tst-oncex3 tst-oncex4 + ifeq ($(build-shared),yes) tests-static += tst-cond8-static tests += tst-cond8-static endif +CFLAGS-tst-oncex3.c += -fexceptions +CFLAGS-tst-oncex4.c += -fexceptions + endif diff --git a/nptl/tst-once1.c b/sysdeps/pthread/tst-once1.c similarity index 100% rename from nptl/tst-once1.c rename to sysdeps/pthread/tst-once1.c diff --git a/nptl/tst-once2.c b/sysdeps/pthread/tst-once2.c similarity index 100% rename from nptl/tst-once2.c rename to sysdeps/pthread/tst-once2.c diff --git a/nptl/tst-once3.c b/sysdeps/pthread/tst-once3.c similarity index 100% rename from nptl/tst-once3.c rename to sysdeps/pthread/tst-once3.c diff --git a/nptl/tst-once4.c b/sysdeps/pthread/tst-once4.c similarity index 100% rename from nptl/tst-once4.c rename to sysdeps/pthread/tst-once4.c diff --git a/nptl/tst-oncex3.c b/sysdeps/pthread/tst-oncex3.c similarity index 100% rename from nptl/tst-oncex3.c rename to sysdeps/pthread/tst-oncex3.c diff --git a/nptl/tst-oncex4.c b/sysdeps/pthread/tst-oncex4.c similarity index 100% rename from nptl/tst-oncex4.c rename to sysdeps/pthread/tst-oncex4.c