From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 53E4C3858D35 for ; Mon, 25 May 2020 08:08:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 53E4C3858D35 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-182-PgBaYvLYMwmhzRMyFHtn0g-1; Mon, 25 May 2020 04:08:41 -0400 X-MC-Unique: PgBaYvLYMwmhzRMyFHtn0g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0ED151855A05; Mon, 25 May 2020 08:08:40 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A5E9E6FB76; Mon, 25 May 2020 08:08:38 +0000 (UTC) From: Florian Weimer To: Rich Felker Cc: Szabolcs Nagy , Szabolcs Nagy , libc-alpha@sourceware.org Subject: Re: [PATCH 2/2] manual: Document __libc_single_threaded References: <20200522105458.GB29518@arm.com> <20200522150720.GR1079@brightrain.aerifal.cx> <20200522161413.GU1079@brightrain.aerifal.cx> <871rnb3nue.fsf@oldenburg2.str.redhat.com> <20200522172826.GW1079@brightrain.aerifal.cx> <87h7w727i4.fsf@oldenburg2.str.redhat.com> <20200522174932.GY1079@brightrain.aerifal.cx> <20200522192249.GC24880@arm.com> <20200522195326.GB1079@brightrain.aerifal.cx> <20200523064941.GD26190@port70.net> <20200523160202.GG1079@brightrain.aerifal.cx> Date: Mon, 25 May 2020 10:08:37 +0200 In-Reply-To: <20200523160202.GG1079@brightrain.aerifal.cx> (Rich Felker's message of "Sat, 23 May 2020 12:02:03 -0400") Message-ID: <87r1v8zbay.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2020 08:08:44 -0000 * Rich Felker: >> this can allow earlier single threaded detection than only >> considering pthread_join: e.g. stdio, malloc etc may do a >> check and update the global after an acquire barrier, however >> the compiler must not cache globals across libc calls for this >> to work. > > It can't cache globals across non-pure functions whose definitions it > cant't see (and if it saw the definition it would know the global is > modified). All > malloc is something of a special case where clang treats it > not as a function but having "pure malloc semantics", but even then I > don't think it matters if it caches it; at worst you see the old value > of __libc_single_threaded (false) rather than the new one (true) and > that direction is safe. > > Rich