From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id d0hkHaBrnWAlAwAAWB0awg (envelope-from ) for ; Thu, 13 May 2021 14:10:40 -0400 Received: by simark.ca (Postfix, from userid 112) id 6A71B1F11C; Thu, 13 May 2021 14:10:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 simark.ca (Postfix) with ESMTPS id B61591E813 for ; Thu, 13 May 2021 14:10:38 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EA3F3894C37; Thu, 13 May 2021 18:10:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EA3F3894C37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620929438; bh=E5GfJJeQnKLuuHcnKINvUeScT7SweODQpmX51PyAe34=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HXg+NjpLMCcnTkm1h6LQbSeCfK+j/x95007VCnkNO/YtkOmp7JLIFwIAcElzdvnLc l7XmqZzWj9SRgGlqZqYNduTBzLVEKzpBb4P3HFxHP0rES3N04DQfWdivY6y8dccjvz Fqs10wgJz+kkTBHQUQqFdAtQOqMED9ygX8COt45o= Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id DB0DF3894C37 for ; Thu, 13 May 2021 18:10:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DB0DF3894C37 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14DI2lQ3152487; Thu, 13 May 2021 14:10:35 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 38h8kp8ymt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 May 2021 14:10:35 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14DI6WTp020570; Thu, 13 May 2021 18:10:34 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma05wdc.us.ibm.com with ESMTP id 38fu1y8p9p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 May 2021 18:10:34 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14DIAVPm28312028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 May 2021 18:10:31 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2862A6A047; Thu, 13 May 2021 18:10:31 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BCA776A051; Thu, 13 May 2021 18:10:30 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.146.166]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 13 May 2021 18:10:30 +0000 (GMT) Message-ID: <8ee8a594f30dcdd1506487ea63ca3f8654c5f112.camel@us.ibm.com> To: Tom Tromey , Carl Love via Gdb-patches Date: Thu, 13 May 2021 11:10:30 -0700 In-Reply-To: <87im3m63ke.fsf@tromey.com> References: <87im3m63ke.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-14.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VWsXEdcqHXRsXs61m0Lxs2KdCVBBMoSQ X-Proofpoint-ORIG-GUID: VWsXEdcqHXRsXs61m0Lxs2KdCVBBMoSQ Subject: RE: [PATCH] kill all threadapply processes at end of test X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-13_10:2021-05-12, 2021-05-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 phishscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105130127 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Carl Love via Gdb-patches Reply-To: Carl Love Cc: pedromfc@br.ibm.com, Ulrich.Weigand@de.ibm.com, rogealve@br.ibm.com Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Tom, Simon: On Thu, 2021-05-13 at 10:30 -0400, Simon Marchi wrote: > From what I can see, there is not attach in that test, only > detach. GDB > starts some processes itself, and tests that detaching in a "thread > apply" command is correctly handled. It's these processes that are > detached that are left running. Fortunately, they exit when the > threads' counters go past INT_MAX, making the condition `*myp > 0` > false. Unfortunately, it means they consume a lot of CPU for some > time after the test. Yes, that is a correct summary of the issue. On Thu, 2021-05-13 at 09:44 -0600, Tom Tromey wrote: > > > > > > "Carl" == Carl Love via Gdb-patches < > > > > > > gdb-patches@sourceware.org> writes: > > Carl> +# Make sure all of the threadapply processes are terminated > Carl> +set data [exec ps -e | grep threadapply] > > This seems like an issue in a few ways. 'ps' arguments may differ by > platform. Other programs might be called 'threadapply' (unlikely for > user stuff but suppose I'm running 2 gdb test suites at the same > time). > It doesn't handle cross-host testing (I don't know if we care about > that > any more but in the past it was an issue). > > So, I wonder if there's a better way to do this. > Like, could the test track PIDs itself? Then maybe re-attach? I had tried to do that but couldn't get the code to work. On Thu, 2021-05-13 at 10:30 -0400, Simon Marchi wrote: > Instead, could we > redesign the test so there isn't this CPU-consuming loop? Maybe use > a pthread barrier, such that when we detach, the all threads are > released and the program ends immediately. I don't know if that will > cause complications because the threads' backtraces won't be exactly > predictable, but it would good to give this a try. Interesting idea. I will give this a try. If it doesn't work out, I will go back and work on the re-attach approach some more to see if I can get that to work. Thanks for the help. Carl