[kvm-unit-tests,v3,6/9] s390x: smp: Loop if secondary cpu returns into cpu setup again
diff mbox series

Message ID 20200117104640.1983-7-frankja@linux.ibm.com
State New
Headers show
Series
  • s390x: smp: Improve smp code and reset checks
Related show

Commit Message

Janosch Frank Jan. 17, 2020, 10:46 a.m. UTC
Up to now a secondary cpu could have returned from the function it was
executing and ending up somewhere in cstart64.S. This was mostly
circumvented by an endless loop in the function that it executed.

Let's add a loop to the end of the cpu setup, so we don't have to rely
on added loops in the tests.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/cstart64.S | 2 ++
 1 file changed, 2 insertions(+)

Comments

Cornelia Huck Jan. 20, 2020, 11:27 a.m. UTC | #1
On Fri, 17 Jan 2020 05:46:37 -0500
Janosch Frank <frankja@linux.ibm.com> wrote:

> Up to now a secondary cpu could have returned from the function it was
> executing and ending up somewhere in cstart64.S. This was mostly
> circumvented by an endless loop in the function that it executed.
> 
> Let's add a loop to the end of the cpu setup, so we don't have to rely
> on added loops in the tests.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/cstart64.S | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index 9af6bb3..5fd8d2f 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -162,6 +162,8 @@ smp_cpu_setup_state:
>  	/* We should only go once through cpu setup and not for every restart */
>  	stg	%r14, GEN_LC_RESTART_NEW_PSW + 8
>  	br	%r14
> +	/* If the function returns, just loop here */
> +0:	j	0

Would it make sense to e.g. load a disabled wait psw instead? Or does
that mess things up elsewhere?

>  
>  pgm_int:
>  	SAVE_REGS
David Hildenbrand Jan. 20, 2020, 12:07 p.m. UTC | #2
On 20.01.20 12:27, Cornelia Huck wrote:
> On Fri, 17 Jan 2020 05:46:37 -0500
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> Up to now a secondary cpu could have returned from the function it was
>> executing and ending up somewhere in cstart64.S. This was mostly
>> circumvented by an endless loop in the function that it executed.
>>
>> Let's add a loop to the end of the cpu setup, so we don't have to rely
>> on added loops in the tests.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  s390x/cstart64.S | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
>> index 9af6bb3..5fd8d2f 100644
>> --- a/s390x/cstart64.S
>> +++ b/s390x/cstart64.S
>> @@ -162,6 +162,8 @@ smp_cpu_setup_state:
>>  	/* We should only go once through cpu setup and not for every restart */
>>  	stg	%r14, GEN_LC_RESTART_NEW_PSW + 8
>>  	br	%r14
>> +	/* If the function returns, just loop here */
>> +0:	j	0
> 
> Would it make sense to e.g. load a disabled wait psw instead? Or does
> that mess things up elsewhere?

I think we can keep it like that for now (simpler than loading a PSW).
Overall, I don't care about burning CPU cycles here :)

Patch
diff mbox series

diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index 9af6bb3..5fd8d2f 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -162,6 +162,8 @@  smp_cpu_setup_state:
 	/* We should only go once through cpu setup and not for every restart */
 	stg	%r14, GEN_LC_RESTART_NEW_PSW + 8
 	br	%r14
+	/* If the function returns, just loop here */
+0:	j	0
 
 pgm_int:
 	SAVE_REGS