From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 29972385841B for ; Tue, 31 Oct 2023 18:29:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29972385841B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 29972385841B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698776942; cv=none; b=Jux+lCXtULmqsnyNDOvigqknCDHi66VLiT+N9TowdCa/rTwLDU2RprX/bawe0HAWYdxhon1u12lVznKthD4cQXtXcUQw/gJUdbJjrFV1D31Y94FHmmqY2ZtyB8s5iRsJHwm7s1T5Idb0p+sApwWV5l7iYaCn3DYKQ+dAUjdv5Ew= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698776942; c=relaxed/simple; bh=OJVwFJn8czzDvjIVP8NBaZT9puA7dvF86ilLc7sYyYY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nuRCVjYn9TqlnNq1XIo9F49S7dyFRNkmxUp2LYy/NOqEr6MSWXgHc2BvoFmWQ77CX4dWdnxxuXUKA2qGhY0JwAaRDIIg+wmkmobAq+PagLbA+IjBqCilWoWk1IxEe9W4vbhNnCqQSNMGoEMz72GR319sb0ByF25XfujbFch2jhM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5010a.ext.cloudfilter.net ([10.0.29.199]) by cmsmtp with ESMTPS id xr9yqZh44KOkLxtU2qiDvg; Tue, 31 Oct 2023 18:28:58 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xtU1qRLyJoIDwxtU2qNDTs; Tue, 31 Oct 2023 18:28:58 +0000 X-Authority-Analysis: v=2.4 cv=TP1W9npa c=1 sm=1 tr=0 ts=6541476a a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=0kqbZmdnLQ4A0jWz0dgA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=O5kD1VmV3P3MaGiuVIYvC00cqfKQt9OCfyn6ojpwkhU=; b=n6bigIGJW6XOIqz3KfOWknkR3m htl48FXvdTHfjy+pVZBTnItuRafmqYsC78O9R9LXtLmpYt4WvzFP6JAKfKO90CLclUvR2Yn78FXch Ntda1MgUQM7XHazUQhtcwKeBB; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:52298 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxtU1-002cUi-1e; Tue, 31 Oct 2023 12:28:57 -0600 From: Tom Tromey To: Andrew Burgess Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] gdb: move all bfd_cache_close_all calls in gdb_bfd.c References: <87o7gjlv6q.fsf@tromey.com> <87r0lc1kef.fsf@redhat.com> X-Attribution: Tom Date: Tue, 31 Oct 2023 12:28:56 -0600 In-Reply-To: <87r0lc1kef.fsf@redhat.com> (Andrew Burgess's message of "Mon, 30 Oct 2023 10:20:40 +0000") Message-ID: <87wmv2k5nb.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.77.73 X-Source-L: No X-Exim-ID: 1qxtU1-002cUi-1e X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net (murgatroyd) [97.122.77.73]:52298 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfKU7kovwbXVDsg0uRFWnlrZwE1GaeuajZiLhyD5rmCgOX+VeFJo/RYhOFfkq1LVO319oDGWvpZmwizuF6Vbndzi09XOIZty+gogVr/yg5ozRlcN+jtfy CM7b3hRA39RZQPAlnsoJ8piYhJ+WwMsdDxwg/3Pq4i17RfAlyInGOaOONNCGEKb4uwLE30ldj6hudLGkWo5iqDv04Sz3Tf9PhqI= X-Spam-Status: No, score=-3018.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,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: >> However, there is one case where this will change: opening dwo files. >> Now, the way the background reading is implemented, the worst case here >> is some inefficiency: the main thread might close all the BFDs, and then >> the background reader might immediately reopen one. Andrew> Right now I don't see bfd/cache.c as thread safe, so are you planning to Andrew> make it thread safe? Yeah. I sent a series to the binutils list recently. Andrew> The other option I considered, is that you could add a mechanism to Andrew> allow BFDs to be opened without going through the BFD cache. In this Andrew> case, I think your thread safety issues go away, and also, you no longer Andrew> care about my bfd_cache_close_all() calls. The BFD cache exists to Andrew> handle systems that only allow a small number of open files (they quote Andrew> 20 as being a limit on some systems), so avoiding the cache might run Andrew> into an open FD limit issue ... but I'm not sure if this low limit Andrew> problem is really a thing on systems that are going to be running Andrew> multiple threads? We could definitely do this for the files the DWARF reader opens in the worker threads. Not sure if I will do this or not though. Adding an explicit bfd_cache_close call would also take care of the problem, and I think the reader only needs the file open from the call to open_dwo_file (in open_and_init_dwo_file) through mapping the sections -- and they could be mapped more eagerly in open_and_init_dwo_file. Andrew> I'd really prefer to avoid relying on folk to remember that they need to Andrew> call bfd_cache_close_all() in certain places. I think its far too easy Andrew> to forget, and these are bugs that are only going to crop up once in a Andrew> while .... A user is running a particular Python extension, and performs Andrew> a particular action, just at the same time as they recompile their test Andrew> binary ... and suddenly GDB "misses" that the test executable changed. Andrew> Bugs like this can be a nightmare to track down. Yeah. Tom