From patchwork Thu Aug 9 07:37:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 955391 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41mKq80Xf2z9s4Z for ; Thu, 9 Aug 2018 17:37:56 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41mKq75nWyzDr5r for ; Thu, 9 Aug 2018 17:37:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41mKq463FYzDqBy for ; Thu, 9 Aug 2018 17:37:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41mKq43gQFz9s1x; Thu, 9 Aug 2018 17:37:52 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au From: Alistair Popple To: pdbg@lists.ozlabs.org Date: Thu, 9 Aug 2018 17:37:51 +1000 Message-Id: <20180809073751.9404-1-alistair@popple.id.au> X-Mailer: git-send-email 2.11.0 Subject: [Pdbg] [PATCH] libpdbg: Ensure threads are probed prior to setup in ram_setup X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" p9chip.c called the probe function directly. Better to call pdbg_target_probe() so that any intermediate targets can also be probed. p8chip.c didn't probe the threads at all prior to use, so do that. Signed-off-by: Alistair Popple --- libpdbg/p8chip.c | 6 ++++++ libpdbg/p9chip.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index 3e90c8d..2638725 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -300,6 +300,12 @@ static int p8_ram_setup(struct thread *thread) * quiesced */ dt_for_each_compatible(&chip->target, target, "ibm,power8-thread") { struct thread *tmp; + + /* If this thread wasn't enabled it may not yet have been probed + so do that now. This will also update the thread status */ + if (pdbg_target_probe(target) != PDBG_TARGET_ENABLED) + return 1; + tmp = target_to_thread(target); if (!(get_thread_status(tmp).quiesced)) return 1; diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index 1433d19..dcdb69d 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -227,7 +227,9 @@ static int p9_ram_setup(struct thread *thread) /* If this thread wasn't enabled it may not yet have been probed so do that now. This will also update the thread status */ - p9_thread_probe(target); + if (pdbg_target_probe(target) != PDBG_TARGET_ENABLED) + goto out_fail; + tmp = target_to_thread(target); if (!(tmp->status.quiesced)) goto out_fail;