public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: libc-alpha@sourceware.org, Florian Weimer <fweimer@redhat.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH v2] nptl: Handle spurious EINTR when thread cancellation is disabled (BZ#29029)
Date: Tue, 19 Apr 2022 10:12:43 -0300	[thread overview]
Message-ID: <865c0df6-4668-a8ff-22b2-dd4dc149b220@linaro.org> (raw)
In-Reply-To: <Yl6vPkO02ww0M6Q7@arm.com>



On 19/04/2022 09:46, Szabolcs Nagy wrote:
> The 04/19/2022 09:30, Adhemerval Zanella wrote:
>> Do this fix the intermittent issue you are seeing:
>>
> 
> yes, this seems to fix the issue.

Thanks, I think this is obvious enough since it is essentially the old
code (sorry about trying to be clever here).  I will fix it upstream and
backport to affected releases as well.

> 
>> diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
>> index c76882e279..e67b2df5cc 100644
>> --- a/nptl/pthread_cancel.c
>> +++ b/nptl/pthread_cancel.c
>> @@ -121,6 +121,7 @@ __pthread_cancel (pthread_t th)
>>    int newval;
>>    do
>>      {
>> +    again:
>>        newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
>>        if (oldval == newval)
>>         break;
>> @@ -134,7 +135,7 @@ __pthread_cancel (pthread_t th)
>>           int newval2 = oldval | CANCELING_BITMASK;
>>           if (!atomic_compare_exchange_weak_acquire (&pd->cancelhandling,
>>                                                      &oldval, newval2))
>> -           continue;
>> +           goto again;
>>  
>>           if (pd == THREAD_SELF)
>>             /* This is not merely an optimization: An application may
>>
>>     

  reply	other threads:[~2022-04-19 13:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 15:49 Adhemerval Zanella
2022-04-14 18:26 ` Adhemerval Zanella
2022-04-19 10:44 ` Szabolcs Nagy
2022-04-19 12:18   ` Adhemerval Zanella
2022-04-19 12:23     ` Adhemerval Zanella
2022-04-19 12:10 ` Szabolcs Nagy
2022-04-19 12:30   ` Adhemerval Zanella
2022-04-19 12:46     ` Szabolcs Nagy
2022-04-19 13:12       ` Adhemerval Zanella [this message]
2022-07-12 21:27 ` Noah Goldstein
2022-07-12 21:28   ` Noah Goldstein
2022-07-13 12:57   ` Adhemerval Zanella Netto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865c0df6-4668-a8ff-22b2-dd4dc149b220@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).