[Pdbg] [PATCH v3 05/13] libpdbg/p9chip.c: query thread active and stop states

Alistair Popple alistair at popple.id.au
Tue May 8 10:21:01 AEST 2018


> diff --git a/src/htm.c b/src/htm.c
> index 566687e..a7e7d06 100644
> --- a/src/htm.c
> +++ b/src/htm.c
> @@ -322,6 +322,8 @@ int run_htm(int optind, int argc, char *argv[])
>  		 * This is as easy as checking that every single
>  		 * thread is "ACTIVE" and hasn't gone into any sleep
>  		 * state.
> +		 *
> +		 * On P9 it requires checking for THREAD_STATUS_STOP
>  		 */

Generally the aim of the interfaces in libpdbg (vs. src/*) is to hide any system
specific details such as P8 vs. P9. However the thread interfaces are already a
pretty leaky abstraction so this is fine for now until we come up with something
better.

>  		pdbg_for_each_class_target("thread", target) {
>  			pdbg_target_probe(target);
> @@ -329,7 +331,8 @@ int run_htm(int optind, int argc, char *argv[])
>  			if (pdbg_target_status(target) == PDBG_TARGET_NONEXISTENT)
>  				continue;
>  
> -			if ((thread_status(target) & THREAD_STATUS_ACTIVE) != THREAD_STATUS_ACTIVE) {
> +			if ((!(thread_status(target) & THREAD_STATUS_ACTIVE)) ||
> +			    (thread_status(target) & THREAD_STATUS_STOP)) {
>  				fprintf(stderr, "It appears powersave is on 0x%"  PRIx64 "%p\n", thread_status(target), target);
>  				fprintf(stderr, "core HTM needs to run with powersave off\n");
>  				fprintf(stderr, "Hint: put powersave=off on the kernel commandline\n");
> 




More information about the Pdbg mailing list