All of lore.kernel.org
 help / color / mirror / Atom feed
* [1/1] s390x/smp: fix detection of "running"
@ 2020-03-27 16:33 Christian Borntraeger
  2020-03-27 16:34 ` Christian Borntraeger
  2020-03-27 16:55 ` David Hildenbrand
  0 siblings, 2 replies; 6+ messages in thread
From: Christian Borntraeger @ 2020-03-27 16:33 UTC (permalink / raw)
  To: David Hildenbrand, Janosch Frank
  Cc: Cornelia Huck, kvm, Christian Borntraeger

On s390x hosts with a single CPU, the smp test case hangs (loops).
The check is our restart has finished is wrong.
Sigp sense running status checks if the CPU is currently backed by a
real CPU. This means that on single CPU hosts a sigp sense running
will never claim that a target is running. We need to check for not
being stopped instead.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
index 2555bf4..5ed8b7b 100644
--- a/lib/s390x/smp.c
+++ b/lib/s390x/smp.c
@@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw)
 	 * The order has been accepted, but the actual restart may not
 	 * have been performed yet, so wait until the cpu is running.
 	 */
-	while (!smp_cpu_running(addr))
+	while (smp_cpu_stopped(addr))
 		mb();
 	cpu->active = true;
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [1/1] s390x/smp: fix detection of "running"
  2020-03-27 16:33 [1/1] s390x/smp: fix detection of "running" Christian Borntraeger
@ 2020-03-27 16:34 ` Christian Borntraeger
  2020-03-27 16:55 ` David Hildenbrand
  1 sibling, 0 replies; 6+ messages in thread
From: Christian Borntraeger @ 2020-03-27 16:34 UTC (permalink / raw)
  To: David Hildenbrand, Janosch Frank; +Cc: Cornelia Huck, kvm

[1/1] was supposed to be kvm-unit-tests....

On 27.03.20 17:33, Christian Borntraeger wrote:
> On s390x hosts with a single CPU, the smp test case hangs (loops).
> The check is our restart has finished is wrong.
> Sigp sense running status checks if the CPU is currently backed by a
> real CPU. This means that on single CPU hosts a sigp sense running
> will never claim that a target is running. We need to check for not
> being stopped instead.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  lib/s390x/smp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
> index 2555bf4..5ed8b7b 100644
> --- a/lib/s390x/smp.c
> +++ b/lib/s390x/smp.c
> @@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw)
>  	 * The order has been accepted, but the actual restart may not
>  	 * have been performed yet, so wait until the cpu is running.
>  	 */
> -	while (!smp_cpu_running(addr))
> +	while (smp_cpu_stopped(addr))
>  		mb();
>  	cpu->active = true;
>  	return 0;
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [1/1] s390x/smp: fix detection of "running"
  2020-03-27 16:33 [1/1] s390x/smp: fix detection of "running" Christian Borntraeger
  2020-03-27 16:34 ` Christian Borntraeger
@ 2020-03-27 16:55 ` David Hildenbrand
  2020-03-27 18:01   ` Christian Borntraeger
  1 sibling, 1 reply; 6+ messages in thread
From: David Hildenbrand @ 2020-03-27 16:55 UTC (permalink / raw)
  To: Christian Borntraeger, Janosch Frank; +Cc: Cornelia Huck, kvm

On 27.03.20 17:33, Christian Borntraeger wrote:
> On s390x hosts with a single CPU, the smp test case hangs (loops).
> The check is our restart has finished is wrong.
> Sigp sense running status checks if the CPU is currently backed by a
> real CPU. This means that on single CPU hosts a sigp sense running
> will never claim that a target is running. We need to check for not
> being stopped instead.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  lib/s390x/smp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
> index 2555bf4..5ed8b7b 100644
> --- a/lib/s390x/smp.c
> +++ b/lib/s390x/smp.c
> @@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw)
>  	 * The order has been accepted, but the actual restart may not
>  	 * have been performed yet, so wait until the cpu is running.
>  	 */
> -	while (!smp_cpu_running(addr))
> +	while (smp_cpu_stopped(addr))
>  		mb();
>  	cpu->active = true;
>  	return 0;
> 

Yeah, same as the other issue we fixed before. There is no trusting on
SIGP SENSE RUNNING STATUS.

Can you please get rid of smp_cpu_running()? (looks like this was the
last user)

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [1/1] s390x/smp: fix detection of "running"
  2020-03-27 16:55 ` David Hildenbrand
@ 2020-03-27 18:01   ` Christian Borntraeger
  2020-03-27 18:05     ` David Hildenbrand
  2020-03-30  7:37     ` Janosch Frank
  0 siblings, 2 replies; 6+ messages in thread
From: Christian Borntraeger @ 2020-03-27 18:01 UTC (permalink / raw)
  To: David Hildenbrand, Janosch Frank; +Cc: Cornelia Huck, kvm



On 27.03.20 17:55, David Hildenbrand wrote:
> On 27.03.20 17:33, Christian Borntraeger wrote:
>> On s390x hosts with a single CPU, the smp test case hangs (loops).
>> The check is our restart has finished is wrong.
>> Sigp sense running status checks if the CPU is currently backed by a
>> real CPU. This means that on single CPU hosts a sigp sense running
>> will never claim that a target is running. We need to check for not
>> being stopped instead.
>>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  lib/s390x/smp.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
>> index 2555bf4..5ed8b7b 100644
>> --- a/lib/s390x/smp.c
>> +++ b/lib/s390x/smp.c
>> @@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw)
>>  	 * The order has been accepted, but the actual restart may not
>>  	 * have been performed yet, so wait until the cpu is running.
>>  	 */
>> -	while (!smp_cpu_running(addr))
>> +	while (smp_cpu_stopped(addr))
>>  		mb();
>>  	cpu->active = true;
>>  	return 0;
>>
> 
> Yeah, same as the other issue we fixed before. There is no trusting on
> SIGP SENSE RUNNING STATUS.
> 
> Can you please get rid of smp_cpu_running()? (looks like this was the
> last user)

I think we should keep it and rename it to smp_cpu_running_status. This bug
actually showed that we should be able to test this feature (which is used
for spinlocks in Linux) somehow.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [1/1] s390x/smp: fix detection of "running"
  2020-03-27 18:01   ` Christian Borntraeger
@ 2020-03-27 18:05     ` David Hildenbrand
  2020-03-30  7:37     ` Janosch Frank
  1 sibling, 0 replies; 6+ messages in thread
From: David Hildenbrand @ 2020-03-27 18:05 UTC (permalink / raw)
  To: Christian Borntraeger, Janosch Frank; +Cc: Cornelia Huck, kvm

On 27.03.20 19:01, Christian Borntraeger wrote:
> 
> 
> On 27.03.20 17:55, David Hildenbrand wrote:
>> On 27.03.20 17:33, Christian Borntraeger wrote:
>>> On s390x hosts with a single CPU, the smp test case hangs (loops).
>>> The check is our restart has finished is wrong.
>>> Sigp sense running status checks if the CPU is currently backed by a
>>> real CPU. This means that on single CPU hosts a sigp sense running
>>> will never claim that a target is running. We need to check for not
>>> being stopped instead.
>>>
>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>> ---
>>>  lib/s390x/smp.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
>>> index 2555bf4..5ed8b7b 100644
>>> --- a/lib/s390x/smp.c
>>> +++ b/lib/s390x/smp.c
>>> @@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw)
>>>  	 * The order has been accepted, but the actual restart may not
>>>  	 * have been performed yet, so wait until the cpu is running.
>>>  	 */
>>> -	while (!smp_cpu_running(addr))
>>> +	while (smp_cpu_stopped(addr))
>>>  		mb();
>>>  	cpu->active = true;
>>>  	return 0;
>>>
>>
>> Yeah, same as the other issue we fixed before. There is no trusting on
>> SIGP SENSE RUNNING STATUS.
>>
>> Can you please get rid of smp_cpu_running()? (looks like this was the
>> last user)
> 
> I think we should keep it and rename it to smp_cpu_running_status. This bug
> actually showed that we should be able to test this feature (which is used
> for spinlocks in Linux) somehow.

AFAIK, there is no trusting on SIGP SENSE RUNNING STATUS at all (I
discussed this with Janosch back then). And I don't see a way for a
reasonable test either. But if you have plans to add a test, then yes,
we can keep it.

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [1/1] s390x/smp: fix detection of "running"
  2020-03-27 18:01   ` Christian Borntraeger
  2020-03-27 18:05     ` David Hildenbrand
@ 2020-03-30  7:37     ` Janosch Frank
  1 sibling, 0 replies; 6+ messages in thread
From: Janosch Frank @ 2020-03-30  7:37 UTC (permalink / raw)
  To: Christian Borntraeger, David Hildenbrand; +Cc: Cornelia Huck, kvm


[-- Attachment #1.1: Type: text/plain, Size: 1836 bytes --]

On 3/27/20 7:01 PM, Christian Borntraeger wrote:
> 
> 
> On 27.03.20 17:55, David Hildenbrand wrote:
>> On 27.03.20 17:33, Christian Borntraeger wrote:
>>> On s390x hosts with a single CPU, the smp test case hangs (loops).
>>> The check is our restart has finished is wrong.
>>> Sigp sense running status checks if the CPU is currently backed by a
>>> real CPU. This means that on single CPU hosts a sigp sense running
>>> will never claim that a target is running. We need to check for not
>>> being stopped instead.
>>>
>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>> ---
>>>  lib/s390x/smp.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
>>> index 2555bf4..5ed8b7b 100644
>>> --- a/lib/s390x/smp.c
>>> +++ b/lib/s390x/smp.c
>>> @@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw)
>>>  	 * The order has been accepted, but the actual restart may not
>>>  	 * have been performed yet, so wait until the cpu is running.
>>>  	 */
>>> -	while (!smp_cpu_running(addr))
>>> +	while (smp_cpu_stopped(addr))
>>>  		mb();
>>>  	cpu->active = true;
>>>  	return 0;
>>>
>>
>> Yeah, same as the other issue we fixed before. There is no trusting on
>> SIGP SENSE RUNNING STATUS.
>>
>> Can you please get rid of smp_cpu_running()? (looks like this was the
>> last user)
> 
> I think we should keep it and rename it to smp_cpu_running_status. This bug
> actually showed that we should be able to test this feature (which is used
> for spinlocks in Linux) somehow.
> 

We need to move it to the smp test case and at least test it but not use
it for any library stuff. When I do firmware testing with the unit tests
I need to be able to exercise as much sigp orders as possible.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-30  7:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 16:33 [1/1] s390x/smp: fix detection of "running" Christian Borntraeger
2020-03-27 16:34 ` Christian Borntraeger
2020-03-27 16:55 ` David Hildenbrand
2020-03-27 18:01   ` Christian Borntraeger
2020-03-27 18:05     ` David Hildenbrand
2020-03-30  7:37     ` Janosch Frank

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.