public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Carlos O'Donell <carlos@redhat.com>,
	Arjun Shankar <arjun.is@lostca.se>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH v2] Fix double-checked locking in __gconv_get_path and __gconv_read_conf [BZ #22062]
Date: Fri, 06 Oct 2017 06:38:00 -0000	[thread overview]
Message-ID: <1b058316-b54d-165d-5876-af1327d0cfde@redhat.com> (raw)
In-Reply-To: <08eed690-d5eb-ce13-0c61-15a93e4bc8a7@redhat.com>

On 10/06/2017 01:05 AM, Carlos O'Donell wrote:
> Is there any reason we need this atomic load?
> 
>> +      gconv_path_elem_local = atomic_load_relaxed (&__gconv_path_elem);
>                                   ^^^^^^^^^^^^^^^^^^^

Oh, this follows just the general rule that if atomics are used, all 
accesses should employ atomics.  This follows from the general principle 
of C11 compatibility, where an atomic type would default to seq-cst 
access (which we don't want here).  I see this was not mentioned in the 
Concurrency wiki page.  I've fixed that.

I did not notice that there was a __libc_once guard.  So it would be 
better to remove the locking from __gconv_get_path and document that 
(including that this serializes initialization of the gconv cache via 
__gconv_load_cache).

Thanks,
Florian

  reply	other threads:[~2017-10-06  6:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02 14:31 Arjun Shankar
2017-10-05 15:18 ` Florian Weimer
2017-10-05 20:23 ` Carlos O'Donell
2017-10-05 22:20   ` Florian Weimer
2017-10-05 23:05     ` Carlos O'Donell
2017-10-06  6:38       ` Florian Weimer [this message]
2017-10-10 19:08         ` Carlos O'Donell

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=1b058316-b54d-165d-5876-af1327d0cfde@redhat.com \
    --to=fweimer@redhat.com \
    --cc=arjun.is@lostca.se \
    --cc=carlos@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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).