From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110390 invoked by alias); 3 Dec 2019 09:53:01 -0000 Mailing-List: contact libstdc++-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libstdc++-owner@gcc.gnu.org Received: (qmail 110382 invoked by uid 89); 3 Dec 2019 09:53:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Dec 2019 09:52:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575366778; 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=UhMxux679vPpAPGNiJdPlJP6MEPE3CYOpwoWc/kvz/Q=; b=WrT1FtB5TcwFqJtlaA5xdB54rSPLqeKwtowrhjWoN5GveUJPQr3YmbiLZnWxi02zEX/sDr XifC7axt8eTrk+U6Ntcr07lpCT04zsMtigYi0RujWxP73at5uNl2l6QQqrdEJNkmHnZ/dF 08yrQIqkIheG6mKhCAs48uR4EzpztOQ= 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-84-Q2nNwL2NPZW5Szw2pkzbwA-1; Tue, 03 Dec 2019 04:52:55 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7BB48017DF; Tue, 3 Dec 2019 09:52:54 +0000 (UTC) Received: from localhost (unknown [10.33.36.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6116860C05; Tue, 3 Dec 2019 09:52:54 +0000 (UTC) Date: Tue, 03 Dec 2019 09:53:00 -0000 From: Jonathan Wakely To: Mike Crowe Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH v2 00/11] timed_mutex, shared_timed_mutex: Add full steady clock support Message-ID: <20191203095253.GG11522@redhat.com> References: <20191202162346.GD11522@redhat.com> MIME-Version: 1.0 In-Reply-To: <20191202162346.GD11522@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.12.1 (2019-06-15) X-Mimecast-Spam-Score: 0 Content-Type: multipart/mixed; boundary="n2Pv11Ogg/Ox8ay5" Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00008.txt.bz2 --n2Pv11Ogg/Ox8ay5 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 5591 On 02/12/19 16:23 +0000, Jonathan Wakely wrote: >On 15/10/19 18:57 +0100, Mike Crowe wrote: >>glibc v2.30 added the pthread_mutex_clocklock, >>pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock >>functions. These accept CLOCK_MONOTONIC, so they can be used to >>implement proper steady_clock support in timed_mutex, >>recursive_timed_mutex and shared_timed_mutex that is immune to the >>system clock being warped. >> >>Unfortunately we can't warp the system clock in the testsuite, so it's >>not possible to automatically ensure that the system_clock test cases >>result in a wait on CLOCK_REALTIME and steady_clock test cases result >>in a wait on CLOCK_MONOTONIC. It's recommended to run the test under >>strace(1) and check whether the expected futex calls are made by glibc >>or ltrace(1) and check whether the expected pthread calls are >>made. The easiest way to do this is to copy and paste the line used to >>build the test from the output of running the tests (for example): >> >>make check-target-libstdc++-v3 RUNTESTFLAGS=3D"conformance.exp=3D30_threa= ds/shared_mutex/* -v -v" >> >>to compile the test with only the tests for one clock enabled and then >>run it as: >> >>strace -f ./1.exe >> >>You should see calls to: >> >>futex(..., FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, ...) >> >>with large values of tv_sec when using system_clock and calls to: >> >>futex(..., FUTEX_WAIT_BITSET_PRIVATE, ...) >> >>Alternatively, you can use: >> >>ltrace -f ./1.exe >> >>and look for calls to pthread_mutex_clocklock, >>pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock with a >>parameter of 1 for CLOCK_MONOTONIC and with values of tv_sec based on >>the system uptime when using steady_clock. >> >>This series also adds some extra tests and fixes some other minor >>problems with the existing implementation and tests. >> >>Changes since v1[1]: >> >>* Fix flaw pointed out[2] by Fran=E7ois Dumont and add tests to prove >> that. >> >>[1] https://gcc.gnu.org/ml/libstdc++/2019-09/msg00106.html >>[2] https://gcc.gnu.org/ml/libstdc++/2019-10/msg00021.html >> >>Mike Crowe (11): >> libstdc++ testsuite: Check return value from timed_mutex::try_lock_until >> libstdc++ testsuite: Add timed_mutex::try_lock_until test >> libstdc++ testsuite: Also test timed_mutex with steady_clock >> libstdc++ testsuite: Also test unique_lock::try_lock_until with steady_c= lock >> PR libstdc++/78237 Add full steady_clock support to timed_mutex >> libstdc++ testsuite: Move slow_clock to its own header >> PR libstdc++/91906 Fix timed_mutex::try_lock_until on arbitrary clock >> libstdc++ testsuite: Also test shared_timed_mutex with steady_clock >> libstdc++ shared_mutex: Add full steady_clock support to shared_timed_mu= tex >> libstdc++ timed_mutex: Ensure that try_lock_for waits for long enough >> shared_mutex: Fix try_lock_until and try_lock_shared_until on arbitrary = clock >> >>libstdc++-v3/acinclude.m4 = | 64 +++++++++++++++++++++++++++- >>libstdc++-v3/config.h.in = | 7 +++- >>libstdc++-v3/configure = | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++- >>libstdc++-v3/configure.ac = | 6 +++- >>libstdc++-v3/include/std/mutex = | 60 +++++++++++++++++++++---- >>libstdc++-v3/include/std/shared_mutex = | 117 +++++++++++++++++++++++++++++++++++++++++--------- >>libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc = | 17 +------- >>libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.= cc | 76 ++++++++++++++++++++++++++++++++- >>libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/3.cc = | 17 ++++--- >>libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/1.cc = | 87 +++++++++++++++++++++++++++++++++++++- >>libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/2.cc = | 75 ++++++++++++++++++++++++++++++++- >>libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/3.cc = | 76 ++++++++++++++++++++++++++++++++- >>libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/4.cc = | 68 +++++++++++++++++++++++++++++- >>libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc = | 18 +++++--- >>libstdc++-v3/testsuite/30_threads/unique_lock/locking/4.cc = | 14 ++++-- >>libstdc++-v3/testsuite/util/slow_clock.h = | 38 ++++++++++++++++- >>16 files changed, 850 insertions(+), 60 deletions(-) >>create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mute= x/try_lock_until/3.cc >>create mode 100644 libstdc++-v3/testsuite/30_threads/shared_timed_mutex/t= ry_lock_until/1.cc >>create mode 100644 libstdc++-v3/testsuite/30_threads/shared_timed_mutex/t= ry_lock_until/2.cc >>create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock= _until/3.cc >>create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock= _until/4.cc >>create mode 100644 libstdc++-v3/testsuite/util/slow_clock.h >> >>base-commit: 32244cd831c781020ebc44d7b557149d9d26c6f5 >>--=20 >>git-series 0.9.1 > >I've committed this patch series as r278901 - r278904. > >Tested powerpc64le-linux, committed to trunk. I meant to correct the copyright date in the new testsuite/util/slow_clock.h file. Done with this patch, committed to trunk. --n2Pv11Ogg/Ox8ay5 Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-Transfer-Encoding: quoted-printable Content-length: 971 commit e9dca5cf16cd1bc37df71710b5e394a7596a8898 Author: Jonathan Wakely Date: Tue Dec 3 09:49:43 2019 +0000 libstdc++: Fix copyright date on new test header =20=20=20=20 The slow_clock type was introduced to the testsuite in 2018 in the testsuite/30_threads/condition_variable/members/2.cc test, so the new header should have that date. =20=20=20=20 * testsuite/util/slow_clock.h: Fix copyright date. diff --git a/libstdc++-v3/testsuite/util/slow_clock.h b/libstdc++-v3/testsu= ite/util/slow_clock.h index b81754ec240..d1787d8c5b0 100644 --- a/libstdc++-v3/testsuite/util/slow_clock.h +++ b/libstdc++-v3/testsuite/util/slow_clock.h @@ -1,6 +1,6 @@ // -*- C++ -*- =20 -// Copyright (C) 2019 Free Software Foundation, Inc. +// Copyright (C) 2018-2019 Free Software Foundation, Inc. =20 // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as --n2Pv11Ogg/Ox8ay5--