From patchwork Tue Mar 29 15:48:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1610684 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=O3FmLVHl; 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 4KSYst6pCCz9sG8 for ; Wed, 30 Mar 2022 02:49:54 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KSYst5qg8z2xvF for ; Wed, 30 Mar 2022 02:49:54 +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=O3FmLVHl; 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::529; helo=mail-pg1-x529.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=O3FmLVHl; dkim-atps=neutral Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (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 4KSYsl5MjXz2xYG for ; Wed, 30 Mar 2022 02:49:47 +1100 (AEDT) Received: by mail-pg1-x529.google.com with SMTP id q19so15182484pgm.6 for ; Tue, 29 Mar 2022 08:49:47 -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=6xe69WyHxH24SiQtjMoI23eaFO31g3rwAA0sBZbaBEs=; b=O3FmLVHlWtjBwc93xUwPNB4gN9psgp2iCEhHA8Q11fBTjL9QK/A8lBvgfb/AkLZupd 01ClkW254qpizi7ZJuc3mZcqeJIjfu9ZChsnyRDARf6Zhq2Antml+Mnrr+V6tIjoSQI0 ADbdGOEBHRZtcX5wzr88bLxS5QFTfwH9P1SORz6m4bx/JdkjiHFDR0Wxda4zvsW7fdZ9 2PZis1JHO7Dj4yyzawK4FHH+CYt1Z89oPAuQtFJjLtMk6WLNleR6hQvq7x4hmDhJDvya 0BXXomhgJD0KutbT+hARGdGWfMB7Ql+c8Jd46tY4vtp0Nm9NfFVe6hTi2itrXS5sxVF1 hGDQ== 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=6xe69WyHxH24SiQtjMoI23eaFO31g3rwAA0sBZbaBEs=; b=dY0UBWQ1Zp6AZRdhCbW1Itjh4LkuvR0RUQ1XJAZ9rvUXUu/oKannVd+L6o+4sSWRYS Qs63d6yeI6PjXK3dK1icXN+5TqEF6p9bXQ5ZNvLKvnTUIUAcn22Wi1+t6DKkf+nOCs5g QZl5i8n1bthM88bQYpz7ddpxc6XQlzFCz8jOqbloW+6prcwydGLeKPdJtGYsdszY3t2J ana9jkG5KUW/FGpIYeKyRr2BOI6rgjHAJkxbAJxdSF/tYXI4QEt6TqrIOzyg+UBErryf oC+WsJiHR9npW7W84lwAd05OXReDHdDlbCRusVeYKYCx7q683ccC7mMKyWSCeAl84h3l czoA== X-Gm-Message-State: AOAM533CmDcoFDwJIYjRLW0v1YA4005Y3qFMOXZaL/F3DZtruYNmmUaB 0L4f45mT0NIRSwulrfIX2dXIG+74QFg= X-Google-Smtp-Source: ABdhPJzUP2lzfq0Z9mDls9XqAEGQug5IQw3vItK2Gq60fAnGi7iNvYqPlfnUL7MJBwdkkuNLM+ypKg== X-Received: by 2002:a63:1063:0:b0:382:adf9:e0c9 with SMTP id 35-20020a631063000000b00382adf9e0c9mr2393200pgq.508.1648568985404; Tue, 29 Mar 2022 08:49:45 -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.49.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Mar 2022 08:49:45 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Wed, 30 Mar 2022 01:48:55 +1000 Message-Id: <20220329154931.493851-3-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 02/38] libpdbg: fix p9chip and p10chip thread_stop 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" Have p9 and p10 thread_stop return 1 on failure, and have them set thread->status to the status used when checking for quiesce, rather than sampling it again on the way out. This seems to improve some intermittent condition on POWER9 where a thread was stopped successfuly but the subsequent status read finds it no longer quiesced. Signed-off-by: Nicholas Piggin --- libpdbg/p10chip.c | 8 ++++---- libpdbg/p9chip.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libpdbg/p10chip.c b/libpdbg/p10chip.c index e0d9ee2..70481f1 100644 --- a/libpdbg/p10chip.c +++ b/libpdbg/p10chip.c @@ -154,14 +154,14 @@ static int p10_thread_stop(struct thread *thread) int i = 0; thread_write(thread, P10_DIRECT_CONTROL, PPC_BIT(7 + 8*thread->id)); - while (!(thread->state(thread).quiesced)) { + do { usleep(1000); if (i++ > RAS_STATUS_TIMEOUT) { PR_ERROR("Unable to quiesce thread\n"); - break; + return 1; } - } - thread->status = thread->state(thread); + thread->status = thread->state(thread); + } while (!thread->status.quiesced); return 0; } diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index 9fddaf6..0ac5354 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -157,14 +157,14 @@ static int p9_thread_stop(struct thread *thread) int i = 0; thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(7 + 8*thread->id)); - while (!(thread->state(thread).quiesced)) { + do { usleep(1000); if (i++ > RAS_STATUS_TIMEOUT) { PR_ERROR("Unable to quiesce thread\n"); - break; + return 1; } - } - thread->status = thread->state(thread); + thread->status = thread->state(thread); + } while (!thread->status.quiesced); return 0; }