From patchwork Wed Apr 20 06:50:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1619364 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=gciOUEpL; 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 4Kjrv05gxGz9sG0 for ; Wed, 20 Apr 2022 16:51:56 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Kjrv02kWfz2yZf for ; Wed, 20 Apr 2022 16:51:56 +1000 (AEST) 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=gciOUEpL; 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::1032; helo=mail-pj1-x1032.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=gciOUEpL; dkim-atps=neutral Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (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 4Kjrty0RCMz3bY3 for ; Wed, 20 Apr 2022 16:51:53 +1000 (AEST) Received: by mail-pj1-x1032.google.com with SMTP id ll10so1061092pjb.5 for ; Tue, 19 Apr 2022 23:51:53 -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=JAR3pPLHTTTy5iRdJnSB5MS1m8axmLNDMrGUtOeT9RA=; b=gciOUEpLJHQ9j0ByMERG/pU9MV/e+ZTnvd6Tw1qKcFScrKaXGKBG5q8plXBVUL65pQ G2Vr7+33kls/y/YGgjmM0R/1Ius/fGOKOrIHdPavN1iXOAYtWhqp5orlqpKKQf5+PT5j zQaeoOq6McDzo/zMKarRurPS6I0vb/LbQsA7fXUhRcP8yDbmi4KWXNUTTCA9NnI5K8bQ d0QPTnO9ATX/9t3jlQq+Qkqrem/GHcT60Urv0f92mqZhi8BJQG7Lejydcnn+5MsP9j5V 86dT9eZj8xzlya8axr3VaCrAdydFcGNRcZN8vGL2I15eVumJ2pkKKtOOosFJotcLSL17 xroQ== 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=JAR3pPLHTTTy5iRdJnSB5MS1m8axmLNDMrGUtOeT9RA=; b=uM/IPWNXyy0NGIZVvREoCCCLKIfZJNFD2G6F2QH1xjdly8euNaQ5QnjDkUFtnIHGjI DOlzYQrcd19bCys2pfw9I/760XdcQQwSttSwHMZcUDLl1+sicZM2gi0ZJtYBLDfRZBkd gQOfmH+3jkU0WpWloPdAjgLnoCoQwQ/kHOyQcaI86ORxFHXEGIOvlGOueGnOroNXy+UG kgnWXKOT/Tg7L4LG+ijmSaueSilSKWgHAeMCUmAYdT/3O/qOTursOdss1J57afDTwyMh BxoVbcACmMSxhv2qnULoOawDhOQ9UdgoWvZ7KMRODOx/2ddhDEAfjxSV4VPqR8AXg3Nc IItA== X-Gm-Message-State: AOAM532jq0Zp23CiK5+bhTGXhUYKC5VrxAFBfATi8NV+KKF8MPsMBlz3 2E+8/gD/7uazLiU2WYgfyhVewz06yvltpg== X-Google-Smtp-Source: ABdhPJzp6+GmiMuXHkM9xyy6T3fa44PVEmGx0zr2zXClg0KNINZFWoJoFwov7SZ/qMeb8cgxldev+A== X-Received: by 2002:a17:903:1248:b0:151:9708:d586 with SMTP id u8-20020a170903124800b001519708d586mr19153852plh.15.1650437511274; Tue, 19 Apr 2022 23:51:51 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([203.221.203.144]) by smtp.gmail.com with ESMTPSA id x20-20020aa79574000000b005061f4782c5sm18481235pfq.183.2022.04.19.23.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 23:51:50 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Wed, 20 Apr 2022 16:50:11 +1000 Message-Id: <20220420065013.222816-38-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220420065013.222816-1-npiggin@gmail.com> References: <20220420065013.222816-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 37/39] 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 Reviewed-by: Joel Stanley --- src/pdbgproxy.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index d50121c0..e81dba40 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? */ + } } }