Skip to contentSkip to conversation

s390x/smp: fix detection of "running"

PATCH In review Christian Borntraeger 3 participants 6 messages Mar 27, 2020 – Mar 30, 2020 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x/smp: fix detection of "running"

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.

---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/s390x/smp.c +1 -1
index 2555bf4..5ed8b7b 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

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

Quoted 26 lines · 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.

---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/s390x/smp.c +1 -1
index 2555bf4..5ed8b7b 100644
@@ -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 lore raw
In reply to Christian Borntraeger
Quoted 18 lines · 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.

---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/s390x/smp.c +0 -0
index 2555bf4..5ed8b7b 100644

lib/s390x/smp.c static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw) · line 134

Quoted 8 lines
lib/s390x/smp.c +1 -1
@@ -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)

Signature · 3 lines
Thanks,

David / dhildenb
#3 lore raw
Quoted 31 lines · David Hildenbrand
Quoted 18 lines · 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.

---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/s390x/smp.c +0 -0
index 2555bf4..5ed8b7b 100644

lib/s390x/smp.c static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw) · line 134

Quoted 8 lines
lib/s390x/smp.c +1 -1
@@ -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.

Quoted 2 lines

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.

#4 lore raw
Quoted 34 lines · Christian Borntraeger
Quoted 31 lines · David Hildenbrand
Quoted 18 lines · 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.

---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/s390x/smp.c +0 -0
index 2555bf4..5ed8b7b 100644

lib/s390x/smp.c static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw) · line 134

Quoted 8 lines
lib/s390x/smp.c +1 -1
@@ -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.

Quoted 6 lines
Quoted 2 lines

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.

Signature · 3 lines
Thanks,

David / dhildenb
#5 lore raw
In reply to Christian Borntraeger
Quoted 34 lines · Christian Borntraeger
Quoted 31 lines · David Hildenbrand
Quoted 18 lines · 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.

---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/s390x/smp.c +0 -0
index 2555bf4..5ed8b7b 100644

lib/s390x/smp.c static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw) · line 134

Quoted 8 lines
lib/s390x/smp.c +1 -1
@@ -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.

Quoted 7 lines
Quoted 2 lines

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.