Skip to contentSkip to conversation

s390x: Extend comment about PV cpu load state

PATCH In review Janosch Frank 4 participants 6 messages Sep 23 – Sep 25

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x: Extend comment about PV cpu load state

When implementing PV in KVM we chose to add the cpu load state to the mp state solely to have a way to keep the UV happy. The UV requires us to set that state before running the boot cpu since entering that state sets the initial PSW.

Since entering that state in KVM only sets off the UV call which causes the initial PSW load and does not set the KVM tracking to operating, we need a second set mp state to reach operating state.

---
 target/s390x/cpu-system.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
target/s390x/cpu-system.c +6 -2
index cc9685221a..5bd8b8d837 100644
@@ -73,8 +73,12 @@ static void s390_cpu_load_normal(CPUState *s)
         cpu->env.psw.addr = spsw & PSW_MASK_SHORT_ADDR;
     } else {
         /*
-         * Firmware requires us to set the load state before we set
-         * the cpu to operating on protected guests.
+         * Firmware/UV requires us to set the load state before we run
+         * the cpu on (re)boots. The UV load includes operating so the
+         * second set state isn't really needed but KVM doesn't update
+         * its internal state to operating on load. So we have to set
+         * operating again. The UV doesn't mind that since it's
+         * effectively a NOP.
          */
         s390_cpu_set_state(S390_CPU_STATE_LOAD, cpu);
     }
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Janosch Frank

When implementing PV in KVM we chose to add the cpu load state to the mp state solely to have a way to keep the UV happy. The UV requires us to set that state before running the boot cpu since entering that state sets the initial PSW.

Quoted 8 lines

Since entering that state in KVM only sets off the UV call which causes the initial PSW load and does not set the KVM tracking to operating, we need a second set mp state to reach operating state.

---
  target/s390x/cpu-system.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)

Thank you!

Reviewed-by on v1 1/1
#2 lore raw
In reply to Janosch Frank
Quoted 5 lines · Janosch Frank

When implementing PV in KVM we chose to add the cpu load state to the mp state solely to have a way to keep the UV happy. The UV requires us to set that state before running the boot cpu since entering that state sets the initial PSW.

Quoted 8 lines

Since entering that state in KVM only sets off the UV call which causes the initial PSW load and does not set the KVM tracking to operating, we need a second set mp state to reach operating state.

---
  target/s390x/cpu-system.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
Reviewed-by on v1 1/1
#3 lore raw
In reply to Janosch Frank
Quoted 10 lines · Janosch Frank

When implementing PV in KVM we chose to add the cpu load state to the mp state solely to have a way to keep the UV happy. The UV requires us to set that state before running the boot cpu since entering that state sets the initial PSW.

Since entering that state in KVM only sets off the UV call which causes the initial PSW load and does not set the KVM tracking to operating, we need a second set mp state to reach operating state.

#4 lore raw
In reply to Janosch Frank
Quoted 10 lines · Janosch Frank

When implementing PV in KVM we chose to add the cpu load state to the mp state solely to have a way to keep the UV happy. The UV requires us to set that state before running the boot cpu since entering that state sets the initial PSW.

Since entering that state in KVM only sets off the UV call which causes the initial PSW load and does not set the KVM tracking to operating, we need a second set mp state to reach operating state.

I was puzzled that this was applying as an empty commit. Philippe already picked this up [*], committed as bb495851c6744ede99b457d50255964a61249221 yesterday

[*] https://lore.kernel.org/qemu-devel/[email protected]/

#5 lore raw
Quoted 12 lines · Eric Farman
Quoted 9 lines · Janosch Frank

When implementing PV in KVM we chose to add the cpu load state to the mp state solely to have a way to keep the UV happy. The UV requires us to set that state before running the boot cpu since entering that state sets the initial PSW.

Since entering that state in KVM only sets off the UV call which causes the initial PSW load and does not set the KVM tracking to operating, we need a second set mp state to reach operating state.

Quoted 5 lines
Quoted 1 line

I was puzzled that this was applying as an empty commit. Philippe already picked this up [*], committed as bb495851c6744ede99b457d50255964a61249221 yesterday

[*] https://lore.kernel.org/qemu-devel/20260924152353.36209-11- [email protected]/

Yep sorry I forgot to mentioned I queued this patch because it was logically making sense in with the rest of the patches being merged. Otherwise I rather the s390x patches go via your tree ;)

Regards,

Phil.