From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id F1BEA3858D34 for ; Sat, 20 Apr 2024 20:59:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1BEA3858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F1BEA3858D34 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=96.47.72.81 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713646796; cv=pass; b=HSOJDWesLgNYfKYTo3JVueueFXCOxvCdJIJ9VLpSMM5ePcfAbmwPWElpLKDqci6XZmEMz3voBRUJXitK/9T97JmA5DET2ybzLzknidW/UAWfxTuIE2h7H+P2ExCGgG9AXP1xMMqa46yxgVpAXM33J+8e8Z+RLHiKeiWm5Xsz21k= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713646796; c=relaxed/simple; bh=I8n32TGoblCGDWtn8TsUtuv+pi44batAtlric90KXeg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=vuKW3yN0oNQJ423IWOqzOf8+4pVI4GvxW8zv8dijkh35EFxGUq83QTANN4IRW0TkWAPDtinPuI2G88CIo+1JdiF2GcBMsdahFXOtRUE0XEnEgPLuwkE7Ieu0SSQZu1QuW2Xb4GUskiBQc/7V4r4qsv9bS7iLGMWaQoESYuzLOAQ= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4VMP605fBZz3jwf; Sat, 20 Apr 2024 20:59:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VMP604mtkz4Y2m; Sat, 20 Apr 2024 20:59:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713646792; 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=bQWWhqFtO4GktZrSK4Jd5GnxZ0JETcY+nc5ZECs47V8=; b=HevK1darfWeqGTlS+8W0HRphpIqH8QyADDf7HCtprG4UNg+EPHE8g6SiaylVmfSjR3FkUC oCpJdUe6zIsyxi1IdDVJgMGuTTC0mO3M0gVZAy/m4PxtCDWALkGDnlbCt8Xl6BTTIz2ff8 eIYLbpJZ0XDb3iOC92ome79DUanTBBxlmIQgKwBDoyFu1LyvEsVybRZHLBiRC30swajgxa G1XzAFGcpIbS5dgJp4blTWouFMwVbzqViax+RKijEl58BXB7S7AmDnlL++pYZgrVMh7EGX dEGR0XVWhPjopuIsrTJOqM2S0Rcd8aOehmMnvt9k8TF81rJ5lafrK+EdFBgsPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713646792; a=rsa-sha256; cv=none; b=dxyAlEC6JkgMrUL10bqBPDad7pd8/kjxrI+gUDVLOzk+x0LYqLSNj3WR+NosYfHUx4dNTu AomI34zmPa1f7K23zhcafNiYZy05Z15F5oUW3lf4nC+1bC64SOIZWQMG/Av+/Vzl9xZapm hv3F1wHMb3uHIllIjR+tMzTr2OMOgNUdqagvgX8BXCGn3ROCvicb/mzvXJ3kMsLLUk5JmQ WbE04mjJK+W57AN2QKYFOI7GG7gNpDtQDQnFfubPJ63WOZBaxpyL8rS95ASaAikvkAemNX fAudAo1Q+rOttlehK3PZgPq++zx1aRyP2RTnagEj4kpKqMIwXga64+OkpRZ6Ug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713646792; 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=bQWWhqFtO4GktZrSK4Jd5GnxZ0JETcY+nc5ZECs47V8=; b=I4rP41ZmlplUHTVn3BfOb5fRg/KRwmLDykmb4S1Hqb8JrVwwBd5/UaUFiBL54puYuT/vWK VD2HsFSZmjAQsFGxlwEzChds3YfPfnvueW/d1dpEyGElRdoZZmNRfOBF1IMGOR9IzgKbzc msp/KOqPpM1Dna76S8hv1blim2+nfG/tFFMa/ZX5xaq9PRysPaabUSGHHNrsA4H+HA17C8 pj+fX68gzi2Ru+q1oXaPLTYSC72FWli+jpoucMX1n5HQSSfU4sJ/0i6f7dbGqF79OAjFoY pC+2SBoyQBr8PNK48vBrC7GWrvlU/M1R62dSfqlyCCgn58X+DIQy1HHT9kkhdw== Received: from [IPV6:2601:644:937f:4c50:ace4:f593:f45d:460] (unknown [IPv6:2601:644:937f:4c50:ace4:f593:f45d:460]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VMP601BrwzGf1; Sat, 20 Apr 2024 20:59:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <56ec3aae-9681-443b-914f-242bc2fb155c@FreeBSD.org> Date: Sat, 20 Apr 2024 13:59:50 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Fix AIX thread exit events not being reported and UI to show kernel thread ID. Content-Language: en-US To: Aditya Kamath1 , Ulrich Weigand , Aditya Kamath1 via Gdb-patches Cc: Sangamesh Mallayya References: From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,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 List-Id: On 4/18/24 6:26 AM, Aditya Kamath1 wrote: > Respected community members, > > Hi, > > Thank you for the comments in the [RFC] thread. > > Please find attached the patch. (See: 0001-Fix-AIX-thread-exit-events-not-being-reported-and-UI.patch) Next time can you please send the patch inline as a separate e-mail? You can use a cover letter for the contents of this mail. It is just easier to review in that case. One thing I think I'm not fully understanding: does a thread never get removed from the pth list once it has exited? That is, is it on that list forever? If so, I think you could simplify this quite a bit to remove the qsort and the gcount and associated list, etc. Instead, I would keep track of exited threads whose exit has been reported via a new std::unordered_set<> class member in the target to avoid reporting duplicate events and then do something like: for (cmd = PTHDB_LIST_FIRST;; cmd = PTHDB_LIST_NEXT) { status = pthdb_pthread (data->pd_session, &pdtid, cmd); if (status != PTHDB_SUCCESS || pthid == PTHDB_INVALID_PTID) continue; status = pthdb_pthread_tid (data->pd_session, pdtid, &tid); if (status != PTHDB_SUCCESS) tid = PTHDB_INVALID_TID; ptid_t ptid (pid, 0, pthid); status = pthdb_pthread_state (data->pd_session, pdtid, &state); if (state == PST_TERM) { /* If this thread's exit was previously reported, ignore. */ if (exited_threads.count (pdtid) != 0) continue; } /* If this thread has never been reported to GDB, add it. */ if (!in_thread_list (proc_target, ptid)) { aix_thread_info *priv = new aix_thread_info; /* init priv */ add_thread_with_info (proc_target, ptid, private_thread_info_up (priv)); } if (state == PST_TERM) { thread_info *thr = proc_target->find_thread (ptid); gdb_assert (thr != nullptr); delete_thread (thr); exited_threads.insert (pdtid); } } -- John Baldwin