[Pdbg] [PATCH 10/14] libpdbg/p9chip.c: allow sreset on running threads

Alistair Popple alistair at popple.id.au
Thu Apr 12 14:24:24 AEST 2018


In general I have avoided making pdbg operations do things which were not
explicitly requested as IMHO it's preferable to not alter system state in
"unexpected" ways. However in this case it's probably ok. I forget though - does
a thread automatically restart after sreset or will it remain in the stopped
state?

- Alistair

On Monday, 9 April 2018 5:35:18 PM AEST Nicholas Piggin wrote:
> Have sreset stop threads rather than require it only be used on threads
> already stopped. This makes it friendlier to use, and fewer pdbg steps.
> There is some indication that the sreset control works on running
> threads, but testing has so far proven otherwise, so stop them if
> they were not stopped.
> 
> Signed-off-by: Nicholas Piggin <npiggin at mgail.com>
> ---
>  libpdbg/p9chip.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
> index 684975a..2c6069a 100644
> --- a/libpdbg/p9chip.c
> +++ b/libpdbg/p9chip.c
> @@ -140,8 +140,10 @@ static int p9_thread_step(struct thread *thread, int count)
>  static int p9_thread_sreset(struct thread *thread)
>  {
>  	/* Can only sreset if a thread is inactive */
> -	if (p9_get_thread_status(thread) != (THREAD_STATUS_QUIESCE | THREAD_STATUS_ACTIVE))
> -		return 1;
> +	if (p9_get_thread_status(thread) != (THREAD_STATUS_QUIESCE | THREAD_STATUS_ACTIVE)) {
> +		if (p9_thread_stop(thread))
> +			return 1;
> +	}
>  
>  	thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(4 + 8*thread->id));
>  
> 




More information about the Pdbg mailing list