From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GKRhIF5cjWFSMwAAWB0awg (envelope-from ) for ; Thu, 11 Nov 2021 13:09:34 -0500 Received: by simark.ca (Postfix, from userid 112) id 6E7051F0BD; Thu, 11 Nov 2021 13:09:34 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A 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 B46D61E813 for ; Thu, 11 Nov 2021 13:09:33 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 370A9385781C for ; Thu, 11 Nov 2021 18:09:33 +0000 (GMT) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by sourceware.org (Postfix) with ESMTPS id 98A5C385840A for ; Thu, 11 Nov 2021 18:09:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 98A5C385840A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f54.google.com with SMTP id d24so11305058wra.0 for ; Thu, 11 Nov 2021 10:09:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=tpEvloWf2A4TQINfMT1nVyBYxO9YTFbnGf0TMSErDl4=; b=eZEhLvkvKyWYhYNzrLYBQTnb1MmyVkzdu9AVMRRyL3EuisukaGjVyVfv5UggGOe8E1 oUidn4XdeDX79lg0Xn4jTi1FNOibbZ8kqZoHw2iTytKAU1cTZ3kZ2MEttxS4vmY+AoYm PCacdrkqS5tzL1NWE9HZyDRqopznfGIfBrPhwMhRwKdf+iPo4929Yd4xO68t+FVHSPM6 R9ZQqy2Qwa320L2/BfVnNEsGbeMvBXtuSLip/wkx8aSqZjJHSU4h3oK8L0Fu1+M56QWm viruZaOwBmmrV70iP6300tYYughkZArlMDg+/T7uzujOX83qQMKRyzPf4V2H85SoXXWI tBow== X-Gm-Message-State: AOAM532BUZIRsn3MXd/tmpXVyL6U12zigGMUtaSm9cEFcktr8LgaX29R AyzHSafPyIvYuDJewzbiDiVrXYDLmVpL/A== X-Google-Smtp-Source: ABdhPJzLCqvlzbVaPEiWuUAtmhgO0g7ycflYUnDrEZ8KxIGJpOYSsjldbs3cgUhs2ArBpUFUDUl5Tg== X-Received: by 2002:a5d:4b82:: with SMTP id b2mr11099678wrt.419.1636654160550; Thu, 11 Nov 2021 10:09:20 -0800 (PST) Received: from ?IPV6:2001:8a0:f912:1a00:fb57:3faf:e98:b979? ([2001:8a0:f912:1a00:fb57:3faf:e98:b979]) by smtp.gmail.com with ESMTPSA id 9sm5133747wry.0.2021.11.11.10.09.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Nov 2021 10:09:19 -0800 (PST) Message-ID: <223ea569-d16b-cfd6-c494-1e4a3349fecf@palves.net> Date: Thu, 11 Nov 2021 18:09:18 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH] gdb: fix "set scheduler-locking" thread exit hang Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org References: <20211108214921.373638-1-simon.marchi@efficios.com> From: Pedro Alves In-Reply-To: <20211108214921.373638-1-simon.marchi@efficios.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-11-08 21:49, Simon Marchi via Gdb-patches wrote: > The problem is in handle_no_resumed: we check if some other thread is > actually resumed, to see if we should ignore that event (see comments in > that function for more info). If this condition is true: > > (thread->executing () || thread->has_pending_waitstatus ()) > > ... then we ignore the event. The problem is that there are some non-resumed > threads with a pending event, which makes us ignore the event. But these > threads are not resumed, so we end up waiting while nothing executes, hence > waiting for ever. "There are some non-resumed" ... "But these are not resumed". The first "non-resumed" should be "non-executing", I believe. > > My first fix was to change the condition to: > > (thread->executing () > || (thread->resumed () && thread->has_pending_waitstatus ())) > > ... but then it occured to me that we could simply check for: > > (thread->resumed ()) > > Since "executing" implies "resumed", checking simply for "resumed" > covers threads that are resumed and executing, as well as threads that > are resumed with a pending status, which is what we want. OK. Thanks, Pedro Alves