Message ID | 20250120032041.280173-4-amerey@redhat.com |
---|---|
State | Superseded |
Headers |
Return-Path: <elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 200C53858416 for <patchwork@sourceware.org>; Mon, 20 Jan 2025 03:22:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 200C53858416 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Dx2W9Bhv X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 52D5B3858D39 for <elfutils-devel@sourceware.org>; Mon, 20 Jan 2025 03:20:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52D5B3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 52D5B3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737343250; cv=none; b=ieUlGq2rGJ0qzEubpyRQ2eta3iAZ46QJwDhLm9vrtJ5NfDs2O1UkTQnswzS4KbQSHF4eb8fx5Gjz5evLsq2EoAolYYd+N/IleyXOSxJHTF8/iHLN8yhPfgvEHadX4daw7dcss5L3kDmfN0oBKgp16QPs496Pzk6j2wIa7k0xUL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737343250; c=relaxed/simple; bh=svNkZ5Wg5qWNrZxrJ8mdxKIsJxQza1rn2IMzDbYBlhE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vYKZGtEMF9v71RDaovu1pAW9gf7nP58JQQ2vcGu+9xCSmDRoZ1f/0oKehVnNIYUGGXeXMtnGr+CPjBsbeM8vYZDYvkMUzY9sD8KkInlOvq+knB16enz90Jblre8n9DUtE5/m+c6SQ7kwlN5IIzAldAM3qeuFH7YmBBBSMbVoZvw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52D5B3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737343250; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Y77BQJgNPSciCf+g4R8xzTuyJmo4HCgLMGISeUOINY=; b=Dx2W9BhvJwv1JmSBwB5Lou6tTFa+1x3fo9e9TGeicUMs+m2h8sKR5+Q0UbOteo9Im+qDaa RX1hdC70s1ol6fl/kpNdafOMiAQeClFtRG099S4DJVBDS/SCWwLHmaXLlmsGgyKSq6mSfk 8bOlH0IA0oJerm98w3rGAZP/RSDlBfA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-277-pO10hHl1N9-7-qinIVCV-A-1; Sun, 19 Jan 2025 22:20:48 -0500 X-MC-Unique: pO10hHl1N9-7-qinIVCV-A-1 X-Mimecast-MFC-AGG-ID: pO10hHl1N9-7-qinIVCV-A Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E782919560AA for <elfutils-devel@sourceware.org>; Mon, 20 Jan 2025 03:20:47 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.80.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 44596195608A; Mon, 20 Jan 2025 03:20:47 +0000 (UTC) From: Aaron Merey <amerey@redhat.com> To: elfutils-devel@sourceware.org Cc: Aaron Merey <amerey@redhat.com> Subject: [PATCH 04/15] dwarf_getsrcfiles.c: Add locking Date: Sun, 19 Jan 2025 22:20:30 -0500 Message-ID: <20250120032041.280173-4-amerey@redhat.com> In-Reply-To: <20250120032041.280173-1-amerey@redhat.com> References: <20250120032041.280173-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: SjUDd2xQj_z_a-D215s24AgOhXkxr6GuWg-FgKJPj4M_1737343248 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[01/15] Add eu_search_tree_init
|
|
Commit Message
Aaron Merey
Jan. 20, 2025, 3:20 a.m. UTC
* libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Use dwarf_lock.
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
libdw/dwarf_getsrcfiles.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Comments
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:30PM -0500, Aaron Merey wrote: > * libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Use dwarf_lock. > > --- > libdw/dwarf_getsrcfiles.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/libdw/dwarf_getsrcfiles.c b/libdw/dwarf_getsrcfiles.c > index 24e4b7d2..3029ce69 100644 > --- a/libdw/dwarf_getsrcfiles.c > +++ b/libdw/dwarf_getsrcfiles.c > @@ -47,9 +47,10 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) > } > > int res = -1; > + struct Dwarf_CU *const cu = cudie->cu; > + mutex_lock (cudie->cu->dbg->dwarf_lock); OK, another Dwarf_Files access, now getting at the dwarf_lock another way through the cu. > /* Get the information if it is not already known. */ > - struct Dwarf_CU *const cu = cudie->cu; > if (cu->files == NULL) > { > /* For split units there might be a simple file table (without lines). > @@ -96,7 +97,10 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) > Dwarf_Off debug_line_offset; > if (__libdw_formptr (stmt_list, IDX_debug_line, DWARF_E_NO_DEBUG_LINE, > NULL, &debug_line_offset) == NULL) > - return -1; > + { > + mutex_unlock (cudie->cu->dbg->dwarf_lock); > + return -1; > + } > > res = __libdw_getsrcfiles (cu->dbg, debug_line_offset, > __libdw_getcompdir (cudie), So is the lock to protect all paths through __libdw_getsrcfiles? > @@ -115,8 +119,7 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) > *nfiles = cu->files->nfiles; > } > > - // XXX Eventually: unlocking here. > - > + mutex_unlock (cudie->cu->dbg->dwarf_lock); > return res; > } > INTDEF (dwarf_getsrcfiles) > -- > 2.47.1 >
Hi Mark, > On Sun, Jan 19, 2025 at 10:20:30PM -0500, Aaron Merey wrote: > > res = __libdw_getsrcfiles (cu->dbg, debug_line_offset, > > __libdw_getcompdir (cudie), > > So is the lock to protect all paths through __libdw_getsrcfiles? This patch series contains enough locking to get the testsuite (in particular the new eu-search tests) passing. There is another path into __libdw_getsrcfiles in dwarf_macro_getsrcfiles that does not have any locking at the moment. Aaron
Hi Aaron, On Thu, Jan 23, 2025 at 09:15:10PM -0500, Aaron Merey wrote: > > On Sun, Jan 19, 2025 at 10:20:30PM -0500, Aaron Merey wrote: > > > res = __libdw_getsrcfiles (cu->dbg, debug_line_offset, > > > __libdw_getcompdir (cudie), > > > > So is the lock to protect all paths through __libdw_getsrcfiles? > > This patch series contains enough locking to get the testsuite (in > particular the new eu-search tests) passing. There is another path > into __libdw_getsrcfiles in dwarf_macro_getsrcfiles that does not have > any locking at the moment. It might make reviewing a little easier if the locks for the same field/function were in the same patch. Or if the patches referred to each other. Then it is easier to see why the locking is correct/complete. Thanks, Mark
diff --git a/libdw/dwarf_getsrcfiles.c b/libdw/dwarf_getsrcfiles.c index 24e4b7d2..3029ce69 100644 --- a/libdw/dwarf_getsrcfiles.c +++ b/libdw/dwarf_getsrcfiles.c @@ -47,9 +47,10 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) } int res = -1; + struct Dwarf_CU *const cu = cudie->cu; + mutex_lock (cudie->cu->dbg->dwarf_lock); /* Get the information if it is not already known. */ - struct Dwarf_CU *const cu = cudie->cu; if (cu->files == NULL) { /* For split units there might be a simple file table (without lines). @@ -96,7 +97,10 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) Dwarf_Off debug_line_offset; if (__libdw_formptr (stmt_list, IDX_debug_line, DWARF_E_NO_DEBUG_LINE, NULL, &debug_line_offset) == NULL) - return -1; + { + mutex_unlock (cudie->cu->dbg->dwarf_lock); + return -1; + } res = __libdw_getsrcfiles (cu->dbg, debug_line_offset, __libdw_getcompdir (cudie), @@ -115,8 +119,7 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) *nfiles = cu->files->nfiles; } - // XXX Eventually: unlocking here. - + mutex_unlock (cudie->cu->dbg->dwarf_lock); return res; } INTDEF (dwarf_getsrcfiles)