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 061353856DC8 for ; Thu, 11 May 2023 15:54:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 061353856DC8 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=1683820478; 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=lztQAY2HjJvkRT0X/310iVSHPE3RBhGvqgiNBqSNYMg=; b=EiyzKGjxkEkffoKSDBp3/YN1tpM1zraWdXHufs9TaBAz0EmqHW7lv5JAeyKbRsOcG9HGPY h+S7f4iqPI9CZDYks2V7p9hIwmh4jIreihGTLxrhzg121sKbnQJTRd70ToFJ3i8dry8Izz TDu7Aub7nd0NizxNxW8TcthrMNmlKIk= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-250-3jX4yXkEPTyw35D5_8icSg-1; Thu, 11 May 2023 11:54:37 -0400 X-MC-Unique: 3jX4yXkEPTyw35D5_8icSg-1 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-24e5481a79fso4910366a91.2 for ; Thu, 11 May 2023 08:54:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683820476; x=1686412476; 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=lztQAY2HjJvkRT0X/310iVSHPE3RBhGvqgiNBqSNYMg=; b=Zwk/SvidrdhbdtDUCi8KMzQUca4PxzPCTaEh65fwYcAN8wfDm5gn3SHCVQLVU4MUTM shRts0xiDbukbWdyOIKA/08w0afBLsVyzA4CBw0iBdAXubDa2nzjsQjSiplrvW+kO+WO ZCL6c19aiFcWdtsDCzeYwFduZCisKGOvWIYFFRN9nxwIZ8jsKggTCmozPlaC5TsKEd/c rDjx7IytQ/x6uWd7y7yW/jz46/VqROdyavQcnO2OeuVHT8t4ujY/3kmVvsyMDwfhTU4t RbP8dBoOlWbzF9TtNE6vbqrCXpTEqMjkCRGieLZgpWZ2QFmVEyNb0/PCNZ+MabOtdla0 Dyog== X-Gm-Message-State: AC+VfDyeTES0dvZ2XQqLf3LN3Qv1m2RdXwoYD6akn/30+v83rddX3rkI c47gkL1LznTUKm/6jdnz+KlTQecln7E2naZj7gY1BGD5ErpaoVehRz9GHScYjZn/p4ZUCebMmWk pjrlj6ZaHwbiAtjx8t4/JrIjPXX/J0WxakQ== X-Received: by 2002:a17:90b:1c8b:b0:233:fb7d:845a with SMTP id oo11-20020a17090b1c8b00b00233fb7d845amr22759315pjb.4.1683820476121; Thu, 11 May 2023 08:54:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zbW0QoITz9OLLpavg+JBCozCUbT4Wg779i5NQgcTQ+X8kp/3jOVAPeOcJ5pD984EdIymF7AqdoxpDZtmtJmw= X-Received: by 2002:a17:90b:1c8b:b0:233:fb7d:845a with SMTP id oo11-20020a17090b1c8b00b00233fb7d845amr22759296pjb.4.1683820475672; Thu, 11 May 2023 08:54:35 -0700 (PDT) MIME-Version: 1.0 References: <20230510112009.633444-1-jwakely@redhat.com> In-Reply-To: From: Thomas Rodgers Date: Thu, 11 May 2023 08:54:24 -0700 Message-ID: Subject: Re: [RFC] libstdc++: Do not use pthread_mutex_clocklock with ThreadSanitizer To: Mike Crowe Cc: Jonathan Wakely , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000005185f105fb6d01b6" X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000005185f105fb6d01b6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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). B= ut > > > 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 its > 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. > However, ... > > > > diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 > > > index 89e7f5f5f45..e2700b05ec3 100644 > > > --- a/libstdc++-v3/acinclude.m4 > > > +++ b/libstdc++-v3/acinclude.m4 > > > @@ -4284,7 +4284,7 @@ AC_DEFUN([GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT], > [ > > > [glibcxx_cv_PTHREAD_COND_CLOCKWAIT=3Dno]) > > > ]) > > > if test $glibcxx_cv_PTHREAD_COND_CLOCKWAIT =3D yes; then > > > - AC_DEFINE(_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT, 1, [Define if > > > pthread_cond_clockwait is available in .]) > > > + AC_DEFINE(_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT, (_GLIBCXX_TSAN=3D= =3D0), > > > [Define if pthread_cond_clockwait is available in .]) > > > fi > > TSan does appear to have an interceptor for pthread_cond_clockwait, even = if > it lacks the others. Does this mean that this part is unnecessary? > > See: https://github.com/google/sanitizers/issues/1259 > > Thanks. > > Mike. > > --0000000000005185f105fb6d01b6--