[Pdbg] [PATCH v2 01/39] libpdbg: fix p9chip and p10chip thread_stop
Nicholas Piggin
npiggin at gmail.com
Wed Apr 20 16:49:35 AEST 2022
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 <npiggin at gmail.com>
---
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;
}
--
2.35.1
More information about the Pdbg
mailing list