From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2845 invoked by alias); 27 Aug 2019 03:52:57 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 2832 invoked by uid 89); 27 Aug 2019 03:52:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx0b-0010f301.pphosted.com Received: from mx0b-0010f301.pphosted.com (HELO mx0b-0010f301.pphosted.com) (148.163.153.244) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Aug 2019 03:52:53 +0000 Received: from pps.filterd (m0102858.ppops.net [127.0.0.1]) by mx0b-0010f301.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7R3pHCs014810; Mon, 26 Aug 2019 22:52:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rice.edu; h=date : from : subject : to : cc : message-id : in-reply-to : references : mime-version : content-type; s=ricemail; bh=UVvPDwowazO8nMmacSXDi49YyMt5eBUMUESiCh9FSiI=; b=Kbg972MxNnuDf5ktR5LslexkjZEaXxRR8iV6501RL5ceA7fY2G8Ajj7NncfQu/CogHNX QO/xeYMP3FJGONFPS1PDpL0PeKoau3bqG7XyRyiJHmOJZiHmCdkDTmmWL/6pz/ENaW17 pk1J7ajIDuf3io+cMlgkOtaBSfegEQu6RM1Us93Pl9fKxCwvi+xW/ypdeB+9pZtuFupg L0WCt2gHb02uVlCSzvucz+eE7FPoM6jcNmLN/mEY8PAqnxwKwTcat+l8CQdL3WzTrcjM 5ciGcHhElJbZ06jv/kqAB5kmC5TaeOmNjujKTyhGNbLQL3R++vcFiMgSRzcR7ps62Z61 Bg== Received: from mh10.mail.rice.edu (mh10.mail.rice.edu [128.42.201.30]) by mx0b-0010f301.pphosted.com with ESMTP id 2ujyxqjrry-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 22:52:50 -0500 Received-X: from mh10.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh10.mail.rice.edu (Postfix) with ESMTP id C9003614E4; Mon, 26 Aug 2019 22:52:49 -0500 (CDT) Received-X: from mh10.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh10.mail.rice.edu (Postfix) with ESMTP id C727E614DF; Mon, 26 Aug 2019 22:52:49 -0500 (CDT) X-Virus-Scanned: by amavis-2.7.0 at mh10.mail.rice.edu, auth channel Received-X: from mh10.mail.rice.edu ([127.0.0.1]) by mh10.mail.rice.edu (mh10.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id WOrsfqrPEbGq; Mon, 26 Aug 2019 22:52:49 -0500 (CDT) Received: from c-76-30-111-95.hsd1.tx.comcast.net (c-76-30-111-95.hsd1.tx.comcast.net [76.30.111.95]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jma14) by mh10.mail.rice.edu (Postfix) with ESMTPSA id 6CF58614BB; Mon, 26 Aug 2019 22:52:49 -0500 (CDT) Date: Tue, 27 Aug 2019 03:52:00 -0000 From: Jonathon Anderson Subject: Re: [PATCH] libdw: add thread-safety to dwarf_getabbrev() To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Srdan Milakovic Message-Id: <1566877968.10901.0@smtp.mail.rice.edu> In-Reply-To: <1566826627.5246.0@smtp.mail.rice.edu> References: <1565983469.1826.0@smtp.mail.rice.edu> <20190824232438.GA2622@wildebeest.org> <1566695452.979.1@smtp.mail.rice.edu> <5ba06557703ee363e19488c994cbddd92ade25be.camel@klomp.org> <1566782688.5803.0@smtp.mail.rice.edu> <1566826627.5246.0@smtp.mail.rice.edu> X-Mailer: geary/0.12.4 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-08-26_08:2019-08-26,2019-08-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 spamscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1906280000 definitions=main-1908270042 Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-q3/txt/msg00147.txt.bz2 Hello Mark, Just finished some modifications to the patch series, git request-pull=20 output below. This rebases onto the latest master and does a little=20 diff cleaning, the major change is that I swapped out the memory=20 management to use the pthread_key_* alternative mentioned before. I did=20 some performance testing and found it to be notably faster in a=20 high-stress microbenchmark (and no measurable difference in an=20 application), and it makes the result easier to read overall. I've also=20 removed the Valgrind configuration options patch since it doesn't add=20 anything at the moment, if it becomes useful I'll submit it separately. Thanks for taking the time to read through everything. -Jonathon The following changes since commit=20 4bcc641d362de4236ae8f0f5bc933c6d84b6f105: libdw: fix latent bug in dwarf_getcfi.c not setting=20 default_same_value. (2019-08-26 15:15:34 +0200) are available in the Git repository at: https://github.com/blue42u/elfutils.git parallel-pr-v2 for you to fetch changes up to 1191d9ed292b508d732973a318a01051053e0f61: lib + libdw: Add and use a concurrent version of the dynamic-size=20 hash table. (2019-08-26 22:29:45 -0500) ---------------------------------------------------------------- Jonathon Anderson (2): Add some supporting framework for C11-style atomics. libdw: Rewrite the memory handler to be thread-safe. Sr=F0an Milakovi=E6 (1): lib + libdw: Add and use a concurrent version of the dynamic-size=20 hash table. configure.ac | 12 ++ lib/ChangeLog | 11 ++ lib/Makefile.am | 5 +- lib/atomics.h | 37 +++++ lib/dynamicsizehash_concurrent.c | 522=20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/dynamicsizehash_concurrent.h | 118 +++++++++++++ lib/stdatomic-fbsd.h | 442=20 +++++++++++++++++++++++++++++++++++++++++++++++++ libdw/ChangeLog | 12 ++ libdw/Makefile.am | 4 +- libdw/dwarf_abbrev_hash.c | 2 +- libdw/dwarf_abbrev_hash.h | 2 +- libdw/dwarf_begin_elf.c | 12 +- libdw/dwarf_end.c | 7 +- libdw/libdwP.h | 59 ++++--- libdw/libdw_alloc.c | 5 +- 15 files changed, 1210 insertions(+), 40 deletions(-) create mode 100644 lib/atomics.h create mode 100644 lib/dynamicsizehash_concurrent.c create mode 100644 lib/dynamicsizehash_concurrent.h create mode 100644 lib/stdatomic-fbsd.h On Mon, Aug 26, 2019 at 8:37 AM, Jonathon Anderson =20 wrote: > Looks correct to me (assuming it applies). I think there's another=20 > latent bug in there somewhere (tests that use libdwfl used to leak=20 > mem_tails, but now that dwarf_begin_elf doesn't do an initial malloc=20 > it doesn't trigger), I'll try hunting it down when I have the time. >=20 > Glad I could be of help testing the mailinglist :) >=20 > -Jonathon >=20 > On Mon, Aug 26, 2019 at 8:18 AM, Mark Wielaard wrote: >> Hi Jonathon, >>=20 >> Thanks for checking our new mailinglist settings :) >> You message was accepted now and the HTML attachment stripped. >>=20 >> On Sun, 2019-08-25 at 20:24 -0500, Jonathon Anderson wrote: >>> The one extra line in dwarf_getcfi.c >>> is to account for a failure in the test suite when Valgrind is >>> enabled (didn't catch it the first time around). >>=20 >> That is an interesting catch. And obviously a latent bug. It works if >> things are in the first memblock (as part of the larger Dwarf=20 >> struct), >> since that is allocated with calloc, and so zeroed out. But if the=20 >> cfi >> would get into a later memblock it would get a random value, since >> those are malloced. In your patch the memblocks are always malloced, >> and so the bug shows up immediately. >>=20 >> Lets just cherry-pick this fixup since it is a good fixup to have. >>=20 >> Does the attached look correct? >>=20 >> Thanks, >>=20 >> Mark