From patchwork Tue Mar 29 15:49:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1610718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fo8dPnQ8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KSYv73l89z9sFk for ; Wed, 30 Mar 2022 02:50:59 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KSYv73HNWz2yKQ for ; Wed, 30 Mar 2022 02:50:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fo8dPnQ8; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1033; helo=mail-pj1-x1033.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fo8dPnQ8; dkim-atps=neutral Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 4KSYv46ZYPz2yMK for ; Wed, 30 Mar 2022 02:50:56 +1100 (AEDT) Received: by mail-pj1-x1033.google.com with SMTP id d30so867526pjk.0 for ; Tue, 29 Mar 2022 08:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ql/LPCbzifr/dU2BJ170ylKNC+7QE0rrzpv34bkqmPY=; b=fo8dPnQ8AIuQagg+ulpibhFnBjV7yur1G7IP6eRyk7xCZTWeinVfyLqXpmo/L4Ii8a 4Z513VofZ5OMCAyfNl2T1ngQEEqAJD/HVunpvXYXf/eaU86OGeAcllnGJmucegmFtXFR vM+BkvdfKPhnr33LECZvv8IYjw99Togw2zv0Yj5rExqgDBND/hhmdEa4uhatY86Q7LtR baInMijRpKdJBBeyNuB5IG9vYzYCS6hAQSr9D+ImXXFAzjyF6aUCnQ0nPLDGhAnFrQaV cL+TiQcCoLhkC1IVut4oxsuLdAD9hbFT6D/d1uuHkdukPW3GTYN6xM5VyRTB7949VTij nWkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ql/LPCbzifr/dU2BJ170ylKNC+7QE0rrzpv34bkqmPY=; b=Fg1as4LlO5oP0ZpgsdUbf6PG5SjFxIfzya9rAJEpn/4tDTHGHh+OCZ5U8se0do0pwQ WBL8561X0zcMp9TkaQuNYmXTYIDrQEIcIDdnxZj88KANTGNpgtbQyPKoYMRDxtju+iz6 tBeDzWwzZ3U75RXxmuLEqkT+p7T5GSNRFQp335U6ELtuxeDrlHF6FvE4N1FRFekRWYN7 sHRf8KZVlUW41OtIIajbaxeh5OJXZZpUWd5Xe6GW2c7etKDnTdUlg7DcltxiJgkHTYxN 4i8IoInjyIPbuZbBYV6OpiK9oWLMPZ+gsIJGp9tOaHKRIJm8xR8XJ3ZwYIgphgZqP3yA 2cVg== X-Gm-Message-State: AOAM533UG289jxc3jpQWgFa4sOao2SkDiSUIyvZ2IrQnNDva6U4By9eK SxOau8JYkax+QrirWFY/7u2bd/1L9Bk= X-Google-Smtp-Source: ABdhPJyF7mQ+XF5GcPofPno/tRnk0Ypc4LiPLl2Jxsu6gAMxBY+le5INDHQ7VgwmVWILoxBJUYOpyA== X-Received: by 2002:a17:903:22c2:b0:154:565b:b273 with SMTP id y2-20020a17090322c200b00154565bb273mr31475378plg.115.1648569054341; Tue, 29 Mar 2022 08:50:54 -0700 (PDT) Received: from bobo.ibm.com (58-6-255-110.tpgi.com.au. [58.6.255.110]) by smtp.gmail.com with ESMTPSA id s35-20020a056a001c6300b004fb20b5d6c1sm14163564pfw.40.2022.03.29.08.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Mar 2022 08:50:54 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Wed, 30 Mar 2022 01:49:29 +1000 Message-Id: <20220329154931.493851-37-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220329154931.493851-1-npiggin@gmail.com> References: <20220329154931.493851-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 36/38] gdbserver: use thread_stop_all() / thread_start_all() X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This could (marginally) improve stop/start latency when targeting all threads. Signed-off-by: Nicholas Piggin --- src/pdbgproxy.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index b34dec5..687f766 100644 --- a/src/pdbgproxy.c +++ b/src/pdbgproxy.c @@ -686,13 +686,19 @@ static void __start_all(void) if (!all_stopped) PR_ERROR("starting while not all stopped\n"); - for_each_path_target_class("thread", target) { - if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) - continue; + if (path_target_all_selected("thread", NULL)) { + if (thread_start_all()) { + PR_ERROR("Could not start threads\n"); + } + } else { + for_each_path_target_class("thread", target) { + if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) + continue; - if (thread_start(target)) { - PR_ERROR("Could not start thread %s\n", - pdbg_target_path(target)); + if (thread_start(target)) { + PR_ERROR("Could not start thread %s\n", + pdbg_target_path(target)); + } } } @@ -706,16 +712,10 @@ static void start_all(void) for_each_path_target_class("thread", target) { struct thread *thread = target_to_thread(target); struct gdb_thread *gdb_thread; - struct thread_state status; if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) continue; - target->probe(target); - status = thread_status(target); - if (!status.quiesced) - PR_ERROR("starting thread not quiesced\n"); - gdb_thread = thread->gdbserver_priv; gdb_thread->stop_attn = false; @@ -794,14 +794,20 @@ static void __stop_all(void) if (all_stopped) PR_ERROR("stopping while all stopped\n"); - for_each_path_target_class("thread", target) { - if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) - continue; + if (path_target_all_selected("thread", NULL)) { + if (thread_stop_all()) { + PR_ERROR("Could not stop threads\n"); + } + } else { + for_each_path_target_class("thread", target) { + if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) + continue; - if (thread_stop(target)) { - PR_ERROR("Could not stop thread %s\n", - pdbg_target_path(target)); - /* How to fix? */ + if (thread_stop(target)) { + PR_ERROR("Could not stop thread %s\n", + pdbg_target_path(target)); + /* How to fix? */ + } } }