From: Florian Weimer <fweimer@redhat.com>
To: Stefan Liebler <stli@linux.ibm.com>,
GNU C Library <libc-alpha@sourceware.org>
Cc: Torvald Riegel <triegel@redhat.com>, Carlos O'Donell <carlos@redhat.com>
Subject: Re: [PATCH] Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP [BZ #23275]
Date: Mon, 17 Sep 2018 13:38:00 -0000 [thread overview]
Message-ID: <a10e9a65-5031-fe9c-8552-3f046c351be6@redhat.com> (raw)
In-Reply-To: <f3fc33e5-aa98-f772-a1bf-c02ddf9352c7@linux.ibm.com>
On 06/12/2018 04:24 PM, Stefan Liebler wrote:
> ChangeLog:
>
> Â Â Â Â [BZ #23275]
> Â Â Â Â * nptl/tst-mutex10.c: New File.
> Â Â Â Â * nptl/Makefile (tests): Add tst-mutex10.
> Â Â Â Â (tst-mutex-ENV): New variable.
> Â Â Â Â * sysdeps/unix/sysv/linux/s390/force-elision.h: (FORCE_ELISION):
> Â Â Â Â Ensure that elision path is used if elision is available.
> Â Â Â Â * sysdeps/unix/sysv/linux/powerpc/force-elision.h
> Â Â Â Â (FORCE_ELISION): Likewise.
> Â Â Â Â * sysdeps/unix/sysv/linux/x86/force-elision.h: (FORCE_ELISION):
> Â Â Â Â Likewise.
> Â Â Â Â * nptl/pthreadP.h (PTHREAD_MUTEX_TYPE,
> Â Â Â Â PTHREAD_MUTEX_TYPE_ELISION, PTHREAD_MUTEX_PSHARED):
> Â Â Â Â Use atomic_load_relaxed.
> Â Â Â Â * nptl/pthread_mutex_consistent.c (pthread_mutex_consistent):
> Â Â Â Â Likewise.
> Â Â Â Â * nptl/pthread_mutex_getprioceiling.c
> Â Â Â Â (pthread_mutex_getprioceiling): Likewise.
> Â Â Â Â * nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full,
> Â Â Â Â __pthread_mutex_cond_lock_adjust): Likewise.
> Â Â Â Â * nptl/pthread_mutex_setprioceiling.c
> Â Â Â Â (pthread_mutex_setprioceiling): Likewise.
> Â Â Â Â * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock):
> Â Â Â Â Likewise.
> Â Â Â Â * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
> Â Â Â Â Likewise.
> Â Â Â Â * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full):
> Â Â Â Â Likewise.
> Â Â Â Â * sysdeps/nptl/bits/thread-shared-types.h
> Â Â Â Â (struct __pthread_mutex_s): Add comments.
> Â Â Â Â * nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy):
> Â Â Â Â Use atomic_load_relaxed and atomic_store_relaxed.
> Â Â Â Â * nptl/pthread_mutex_init.c (__pthread_mutex_init):
> Â Â Â Â Use atomic_store_relaxed.
I had another look at this. I think the code changes are okay, but:
There is a reference to âpthread_mutex_destroy()â in the new test. Per
GNU style, this should just be âpthread_mutex_destroyâ.
There are three places where a comma is used before âthatâ (as a
conjunction). This comma is no longer used in contemporary standard
English.
The comment in force-elision.h references
PTHREAD_MUTEX_TIMED_NO_ELISION_NP and not PTHREAD_MUTEX_NO_ELISION_NP.
Is this deliberate? I also find the second part of this comment
confusing (which contains the flag reference) a bit confusing. I assume
that PTHREAD_MUTEX_NO_ELISION_NP is somehow checked before FORCE_ELISION
is called, and that check is not racy because
PTHREAD_MUTEX_NO_ELISION_NP is unchanged after mutex initialization. So
for each particular mutex, we either always enable elision as part of
the first locking operation, or we never do.
Thanks,
Florian
next prev parent reply other threads:[~2018-09-17 13:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 14:25 Stefan Liebler
2018-06-13 8:43 ` Florian Weimer
2018-06-13 9:18 ` Stefan Liebler
2018-06-13 9:36 ` Florian Weimer
2018-06-13 15:25 ` Stefan Liebler
2018-06-14 8:04 ` Stefan Liebler
2018-06-13 21:45 ` Tulio Magno Quites Machado Filho
2018-06-19 7:45 ` Stefan Liebler
2018-06-26 6:45 ` [PING][PATCH] " Stefan Liebler
2018-07-03 6:28 ` Stefan Liebler
2018-07-10 6:34 ` Stefan Liebler
2018-07-16 11:57 ` Stefan Liebler
2018-07-23 6:42 ` Stefan Liebler
2018-07-30 7:22 ` Stefan Liebler
2018-08-27 9:12 ` Stefan Liebler
2018-09-03 7:10 ` Stefan Liebler
2018-09-10 12:01 ` Stefan Liebler
2018-09-17 13:38 ` Florian Weimer [this message]
2018-10-04 16:08 ` [PATCH] " Stefan Liebler
2018-10-16 14:23 ` Florian Weimer
2018-10-17 10:36 ` Stefan Liebler
2018-10-18 13:24 ` [COMMITTED 2.27 / 2.28] " Stefan Liebler
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=a10e9a65-5031-fe9c-8552-3f046c351be6@redhat.com \
--to=fweimer@redhat.com \
--cc=carlos@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=stli@linux.ibm.com \
--cc=triegel@redhat.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).