Message ID | 20210925080206.3213821-1-shorne@gmail.com |
---|---|
State | Committed |
Commit | 9874ca536b1d0662b1cea46af3ce09a4d42aeb32 |
Delegated to: | Adhemerval Zanella Netto |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A2B31385801A for <patchwork@sourceware.org>; Sat, 25 Sep 2021 08:02:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2B31385801A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632556959; bh=oejOojYeHN5co9qv2FerJqHibjDBq/hCKyDTn5ARq28=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=aIh0B19nx82vsqQa5gnlVeg+Lo6RpSfh7ru8ilMknQAF4M6+yP6zw/RLWGb4nONyw XtYBrrqX3GIYU3rSSjDejH0uOn248gFEEM++AbQB+YDtDMTCRgNEdFLbu4rOBJP51m GIgmjv5H17jpBaN0+EazxJOCL4W+LdYzxj1z0BaY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 3B8F13858403 for <libc-alpha@sourceware.org>; Sat, 25 Sep 2021 08:02:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3B8F13858403 Received: by mail-pj1-x102f.google.com with SMTP id pf3-20020a17090b1d8300b0019e081aa87bso9347806pjb.0 for <libc-alpha@sourceware.org>; Sat, 25 Sep 2021 01:02:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oejOojYeHN5co9qv2FerJqHibjDBq/hCKyDTn5ARq28=; b=GreHfDRUDRfVzfLw70/ciD7Km0QC9ENEIFsS2KnDcat6CAK26JKk8yg/dn6qj6vgqk mh7kmdMRvE6oW1n0nDxdqRDLXt7ckkiCzN4Gy2XdgF+SvEGtZiHJuIR4w0CYl1aFFqRG yxH1SHQLTKFUjGkCPAmko2CjlP6rg/2SRZv5/m5cQHwEDQNUYJAgZa72JFigWM0nvDLQ NrGKFkZThojNbDBOAiak2sZu0Cht0SCemc/IVe+kQn+8sOWfh0U12cmKvNQ5E3INt12s haRQSLplKmu37IVAZ+5LawJXcMcaaPMTQeMfuIx6T1F862S8ucPM5++KtPeNNWbyDr2C CX9Q== X-Gm-Message-State: AOAM5326SX9ZpB1F1z2wsfvkXu1xLJ5s0Ozm8KExhHZmlXA7Vy5iOjYU Y+Ae4wHGensxzXG1OiQ75E1fuB5g+nA= X-Google-Smtp-Source: ABdhPJyOhQ7xuV7e3mbA8uDMWns4DKkGK8p9g8V+WcMivZNTavOEHjj2gsV58A4Acf+p9Q6UUWbSHA== X-Received: by 2002:a17:90a:55c8:: with SMTP id o8mr518013pjm.144.1632556935891; Sat, 25 Sep 2021 01:02:15 -0700 (PDT) Received: from localhost (g22.61-45-46.ppp.wakwak.ne.jp. [61.45.46.22]) by smtp.gmail.com with ESMTPSA id l11sm13468138pjg.22.2021.09.25.01.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 01:02:14 -0700 (PDT) To: GLIBC patches <libc-alpha@sourceware.org> Subject: [PATCH] pthread/tst-cancel28: Fix barrier re-init race condition Date: Sat, 25 Sep 2021 17:02:06 +0900 Message-Id: <20210925080206.3213821-1-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Stafford Horne via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Stafford Horne <shorne@gmail.com> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
pthread/tst-cancel28: Fix barrier re-init race condition
|
|
Checks
Context | Check | Description |
---|---|---|
dj/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
dj/TryBot-32bit | success | Build for i686 |
Commit Message
Stafford Horne
Sept. 25, 2021, 8:02 a.m. UTC
When running this test on the OpenRISC port I am working on this test fails with a timeout. The test passes when being straced or debugged. Looking at the code there seems to be a race condition in that: 1 main thread: calls xpthread_cancel 2 sub thread : receives cancel signal 3 sub thread : cleanup routine waits on barrier 4 main thread: re-inits barrier 5 main thread: waits on barrier After getting to 5 the main thread and sub thread wait forever as the 2 barriers are no longer the same. Removing the barrier re-init seems to fix this issue. Also, the barrier does not need to be reinitialized as that is done by default. Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org> --- sysdeps/pthread/tst-cancel28.c | 1 - 1 file changed, 1 deletion(-)
Comments
ping On Sat, Sep 25, 2021 at 5:02 PM Stafford Horne <shorne@gmail.com> wrote: > > When running this test on the OpenRISC port I am working on this test > fails with a timeout. The test passes when being straced or debugged. > Looking at the code there seems to be a race condition in that: > > 1 main thread: calls xpthread_cancel > 2 sub thread : receives cancel signal > 3 sub thread : cleanup routine waits on barrier > 4 main thread: re-inits barrier > 5 main thread: waits on barrier > > After getting to 5 the main thread and sub thread wait forever as the 2 > barriers are no longer the same. > > Removing the barrier re-init seems to fix this issue. Also, the barrier > does not need to be reinitialized as that is done by default. > > Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > sysdeps/pthread/tst-cancel28.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/sysdeps/pthread/tst-cancel28.c b/sysdeps/pthread/tst-cancel28.c > index 627cbc8160..9286c159b3 100644 > --- a/sysdeps/pthread/tst-cancel28.c > +++ b/sysdeps/pthread/tst-cancel28.c > @@ -69,7 +69,6 @@ do_test (void) > > xpthread_cancel (timer_thread); > > - xpthread_barrier_init (&barrier, NULL, 2); > xpthread_barrier_wait (&barrier); > > return 0; > -- > 2.31.1 >
On 25/09/2021 05:02, Stafford Horne wrote: > When running this test on the OpenRISC port I am working on this test > fails with a timeout. The test passes when being straced or debugged. > Looking at the code there seems to be a race condition in that: > > 1 main thread: calls xpthread_cancel > 2 sub thread : receives cancel signal > 3 sub thread : cleanup routine waits on barrier > 4 main thread: re-inits barrier > 5 main thread: waits on barrier > > After getting to 5 the main thread and sub thread wait forever as the 2 > barriers are no longer the same. > > Removing the barrier re-init seems to fix this issue. Also, the barrier > does not need to be reinitialized as that is done by default. > > Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org> LGTM, thanks. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > sysdeps/pthread/tst-cancel28.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/sysdeps/pthread/tst-cancel28.c b/sysdeps/pthread/tst-cancel28.c > index 627cbc8160..9286c159b3 100644 > --- a/sysdeps/pthread/tst-cancel28.c > +++ b/sysdeps/pthread/tst-cancel28.c > @@ -69,7 +69,6 @@ do_test (void) > > xpthread_cancel (timer_thread); > > - xpthread_barrier_init (&barrier, NULL, 2); > xpthread_barrier_wait (&barrier); > > return 0; >
diff --git a/sysdeps/pthread/tst-cancel28.c b/sysdeps/pthread/tst-cancel28.c index 627cbc8160..9286c159b3 100644 --- a/sysdeps/pthread/tst-cancel28.c +++ b/sysdeps/pthread/tst-cancel28.c @@ -69,7 +69,6 @@ do_test (void) xpthread_cancel (timer_thread); - xpthread_barrier_init (&barrier, NULL, 2); xpthread_barrier_wait (&barrier); return 0;