From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8FC073857028 for ; Thu, 11 May 2023 16:05:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FC073857028 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683821104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GgE96wyYq8F+Zj6HrldjccG2PsqIFc1RxtXtuoJnpA4=; b=LByDHWSSZZuq9DwBxtg/CO5/7LUTE19xYtGDSenyDkChUFJhPWpez0griWRllEVw5jeWAh HjowLv+ZOJuWE4C80AMnpIGTnBWzAJGSdf0noDJ9riK9Um/jk6zzNC19aUoLpJTOV3cUBS PdT/BVxsEZOyaI4NrGUZOnmxs0QYkJw= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-378-TDr_EzovM1i2gV40-S_ApA-1; Thu, 11 May 2023 12:05:01 -0400 X-MC-Unique: TDr_EzovM1i2gV40-S_ApA-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4efef729387so5174606e87.2 for ; Thu, 11 May 2023 09:05:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683821100; x=1686413100; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GgE96wyYq8F+Zj6HrldjccG2PsqIFc1RxtXtuoJnpA4=; b=jZpQV4M/yE5s43FL+COQSRcfHYgy1Dj953Phwbng5WKAWxrejhw3XAmD4J/WX44VAb hSE1tCY7nwaTGwb6Tr3dW93LehhrYkGTgFDarZ4rvRmnNz1+WumUpr0Jkvo9mx3iLQ+j eYEf7o9qIqYIJXJd/5+xEYHf7NUAshLgLBPavUryTrExL2EdzrV+K/t0cKraJJWrAnXL FouKRJ9qgonNmKksYcVafWuhsp+24KUk1VeATYTFXj7reExXhzuHGxw0mY0XMT/0hUZO cO+u+329udVWunlhoEU8Z68AgoLoR6J1zc+S1ldLNVE8mgVa+VEaYz7mUiPvCHnqUVuX NuGQ== X-Gm-Message-State: AC+VfDxn0ukjuH/F8i6ca4Rjf9Kw444Yy2KzREvknGh/36/ZbMzMVwfd nqLinqDal+PeCJuhgdaINCbNcBtnfwcXgn9cUDRN07NemEAatmYyNBrDwtEvOHDJsQDBPil17UI ufkbetvxQlDHKaAt7s/gaw6LOgmWBrv6t8A== X-Received: by 2002:a2e:9b97:0:b0:2ad:98a6:4af0 with SMTP id z23-20020a2e9b97000000b002ad98a64af0mr3040936lji.23.1683821100514; Thu, 11 May 2023 09:05:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nEDCKcqpeqYxcubNvE363s5ntrOVjJgzkukYQ+MjOBNenJ+WOBL8pmU+cnj+Y0PwgXZpdtwzE81MNgb6gUJ4= X-Received: by 2002:a2e:9b97:0:b0:2ad:98a6:4af0 with SMTP id z23-20020a2e9b97000000b002ad98a64af0mr3040926lji.23.1683821100194; Thu, 11 May 2023 09:05:00 -0700 (PDT) MIME-Version: 1.0 References: <20230510112009.633444-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Thu, 11 May 2023 17:04:48 +0100 Message-ID: Subject: Re: [RFC] libstdc++: Do not use pthread_mutex_clocklock with ThreadSanitizer To: Thomas Rodgers Cc: Mike Crowe , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000008af60d05fb6d26ec" X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000008af60d05fb6d26ec Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 11 May 2023 at 16:54, Thomas Rodgers wrote: > > > On Thu, May 11, 2023 at 5:21=E2=80=AFAM Mike Crowe via Libstdc++ < > libstdc++@gcc.gnu.org> wrote: > >> On Wednesday 10 May 2023 at 12:31:12 +0100, Jonathan Wakely wrote: >> > On Wed, 10 May 2023 at 12:20, Jonathan Wakely via Libstdc++ < >> > libstdc++@gcc.gnu.org> wrote: >> > >> > > This patch would avoid TSan false positives when using timed waiting >> > > functions on mutexes and condvars, but as noted below, it changes the >> > > semantics. >> > > >> > > I'm not sure whether we want this workaround in place until tsan gets >> > > fixed. >> > > >> > > On one hand, there's no guarantee that those functions use the right >> > > clock anyway (and they won't do unless a recent-ish glibc is used). >> But >> > > on the other hand, if they normally would use the right clock because >> > > you have glibc support, it's not ideal for tsan to cause a different >> > > clock to be used. >> > > >> > >> > But of course, it's not ideal to get false positives from tsan either >> > (especially when it looks like a libstdc++ bug, as initially reported = to >> > me). >> >> I think that this is probably the least-worst option in the short term. = As >> TSan is distributed with GCC this workaround can be removed as soon as i= ts >> TSan implementation gains the necessary interceptors. I shall look into >> trying to do that. >> >> > I don't have a strong opinion either way on this, but I think documenting > the TSAN suppressions is the option most in keeping with the principle of > Least Astonishment. > That assumes anybody reads the docs :-) Getting TSan errors from the std::lib is somewhat astonishing. The errors could be avoided, at the risk of subtle timing differences between tsanitized and un-tsanitized builds ... but won't there be subtle diffs anyway based on the TSan overhead? Admittedly those will just be fairly constant overhead, and so immune to system clock adjustments. --0000000000008af60d05fb6d26ec--