From patchwork Wed Apr 20 06:49:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1619328 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=TdTgzXpU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 4KjrsX51TNz9sG0 for ; Wed, 20 Apr 2022 16:50:40 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KjrsX3rsVz2ym7 for ; Wed, 20 Apr 2022 16:50:40 +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=TdTgzXpU; 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::52f; helo=mail-pg1-x52f.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=TdTgzXpU; dkim-atps=neutral Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (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 4KjrsL4mgZz2xnM for ; Wed, 20 Apr 2022 16:50:28 +1000 (AEST) Received: by mail-pg1-x52f.google.com with SMTP id r83so800446pgr.2 for ; Tue, 19 Apr 2022 23:50:28 -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=Q4215VEPSv9gm3PPi5xMtpWAW3++hZFZysnojjZetpk=; b=TdTgzXpU+iQ9amaYmQdV9lHlBj4byNb9Drh2tcntemkEzu7mOuUfhQNrd1hlIcQIyO K9ILAPsTdRPlYtZe8ht0UKqOHEHPuNofIAV7O2kS02oTVHic2azZ8KU1zza9zcQu2/bG 39XkhsWUYmgDL2BIBWBQkl9anpDxxzPL4R3ODcn2LE7csGNy3/4dnkMYSDMSSeUWETsd G6VGBqHvz4RuLLR2Cd3Wwgiwnb5+XciFjIR9DuUZoK6xLZcNtlPzK0YMNmrw/nQ1KErs BdYBvvjR3+eNooJ+WCPN3VYKid5MLUSEv4HGEslzeFP2av5DWIhkqojeHGmKAtumgyGX lCbg== 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=Q4215VEPSv9gm3PPi5xMtpWAW3++hZFZysnojjZetpk=; b=Zualx4yYG9eS3M5NG3IaqHRIvF/mx57+LJqGrU+3FePP9pFN0a3wEVURj+QfaVYOLy 1x/eYODOYTYnApCWFe/BbhEbeh2elDFr0agArTpRGehlh27B0Qw+rUoMrE+/N+4B+GSO G7Ex/lJ1bW2n5ZVtjoX8lNlWW4XthuD4srl5ottfFEPAOTcqNEkMO3a1xQx+NDqEaGJ/ lWCOSEnRwMaPs5fdOiHSnTw7QhifHpQK+ls4r3GuHCuvm5fprr1+ukkP8jZgSsa3Q5yJ k0duG3G2P5SNrr+Ncl67zM/yI33yAc7f5gTfTHOPUdYHBHaikFhOvUbgYw/VRsajKOvT Zyag== X-Gm-Message-State: AOAM531AKn9dJuhJyFg8rG4zcqiyXcwti8fmLO2vzr584gYGgjoZuKlv MTAJpTodLoU/jQakksxN7HvCZLsL3SLYqg== X-Google-Smtp-Source: ABdhPJwLoqv3tFuZ0ogMCz7djrfrWCII+/OsNXhoHSwPJPBZmkvkfLcBFtpwdYNLTkG4fUXyDa60gg== X-Received: by 2002:a63:a902:0:b0:398:cdd3:f85e with SMTP id u2-20020a63a902000000b00398cdd3f85emr18025127pge.122.1650437425633; Tue, 19 Apr 2022 23:50:25 -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.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 23:50:25 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Wed, 20 Apr 2022 16:49:35 +1000 Message-Id: <20220420065013.222816-2-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 01/39] 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 e0d9ee21..70481f1f 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 9fddaf64..0ac53542 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; }