Skip to contentSkip to conversation

pseries: Correct panic behaviour for pseries machine type

PATCH In review David Gibson 3 participants 10 messages Jun 7, 2017 – Jun 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pseries: Correct panic behaviour for pseries machine type

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +2 -5
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,
Signature · 1 line
2.9.4
#1 lore raw

----- Original Message -----

Quoted 30 lines

From: "David Gibson" <[email protected]>
To: [email protected], [email protected], [email protected]
Cc: [email protected], [email protected], [email protected], "David Gibson" <[email protected]>
Sent: Wednesday, June 7, 2017 9:07:32 AM
Subject: [PATCH] pseries: Correct panic behaviour for pseries machine type

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +0 -0
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 299

Quoted 10 lines
hw/ppc/spapr_rtas.c +2 -5
 {
-    target_ulong ret = 0;
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }

It's possible to "cont" a panicked guest, so I think you should keep the rtas_st.

Paolo

#2 lore raw
Quoted 37 lines · Paolo Bonzini

----- Original Message -----

Quoted 34 lines

From: "David Gibson" <[email protected]>
To: [email protected], [email protected], [email protected]
Cc: [email protected], [email protected], [email protected], "David Gibson" <[email protected]>
Sent: Wednesday, June 7, 2017 9:07:32 AM
Subject: [PATCH] pseries: Correct panic behaviour for pseries machine type

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +1 -1
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;
+    qemu_system_guest_panicked(NULL);
 
Quoted 9 lines

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 299

Quoted 6 lines
hw/ppc/spapr_rtas.c +1 -4
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }

It's possible to "cont" a panicked guest, so I think you should keep the rtas_st.

I did keep the rtas_st(), I just changed it to using a constant instead of an always-0 variable.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw
In reply to David Gibson
Quoted 27 lines · David Gibson

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +0 -1
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 301

Quoted 10 lines
hw/ppc/spapr_rtas.c +2 -4
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,

If I get that qemu_system_guest_panicked() function right, it will stop the VM, won't it? That contradicts the LoPAPR spec that says that the RTAS call returns if the "ibm,extended-os-term" property is available in the device tree. And we currently present this property in the device tree. So either the guest should not be stopped here, or we've got to remove the property from the device tree again.

Thomas

#4 lore raw
Quoted 36 lines · Thomas Huth
Quoted 35 lines · David Gibson

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +2 -5
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
Quoted 9 lines

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 301

Quoted 2 lines
hw/ppc/spapr_rtas.c +0 -0
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,

If I get that qemu_system_guest_panicked() function right, it will stop the VM, won't it? That contradicts the LoPAPR spec that says that the RTAS call returns if the "ibm,extended-os-term" property is available in the device tree. And we currently present this property in the device tree. So either the guest should not be stopped here, or we've got to remove the property from the device tree again.

Hrm. However in the case of this "extended behaviour" it's not clear what we should do next. I'm include to think that the preference set by the qemu user / management layer should take precedence over PAPR.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#5 lore raw
In reply to Thomas Huth
Quoted 36 lines · Thomas Huth
Quoted 35 lines · David Gibson

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +2 -5
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
Quoted 7 lines

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 301

Quoted 2 lines
hw/ppc/spapr_rtas.c +0 -0
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,

If I get that qemu_system_guest_panicked() function right, it will stop the VM, won't it? That contradicts the LoPAPR spec that says that the RTAS call returns if the "ibm,extended-os-term" property is available in the device tree.

It does return... but only after the user starts the guest again with "cont".

Paolo

#6 lore raw
Quoted 47 lines · Paolo Bonzini
Quoted 36 lines · Thomas Huth
Quoted 35 lines · David Gibson

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +2 -5
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
Quoted 7 lines

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 301

Quoted 2 lines
hw/ppc/spapr_rtas.c +0 -0
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,

If I get that qemu_system_guest_panicked() function right, it will stop the VM, won't it? That contradicts the LoPAPR spec that says that the RTAS call returns if the "ibm,extended-os-term" property is available in the device tree.

Quoted 2 lines

It does return... but only after the user starts the guest again with "cont".

OK, I guess that's enough to say that the "ibm,extended-os-term" property can stay ... so I think the patch is fine as it is right now.

Thomas

#7 lore raw
Quoted 48 lines · Thomas Huth
Quoted 47 lines · Paolo Bonzini
Quoted 43 lines · Thomas Huth
Quoted 27 lines · David Gibson

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +0 -1
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 301

Quoted 10 lines
hw/ppc/spapr_rtas.c +2 -4
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,

If I get that qemu_system_guest_panicked() function right, it will stop the VM, won't it? That contradicts the LoPAPR spec that says that the RTAS call returns if the "ibm,extended-os-term" property is available in the device tree.

Quoted 5 lines
Quoted 2 lines

It does return... but only after the user starts the guest again with "cont".

OK, I guess that's enough to say that the "ibm,extended-os-term" property can stay ... so I think the patch is fine as it is right now.

So.. can I have an R-b?

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Reviewed-by
#8 lore raw
Quoted 49 lines · David Gibson
Quoted 48 lines · Thomas Huth
Quoted 47 lines · Paolo Bonzini
Quoted 43 lines · Thomas Huth
Quoted 27 lines · David Gibson

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +0 -1
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 301

Quoted 10 lines
hw/ppc/spapr_rtas.c +2 -4
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,

If I get that qemu_system_guest_panicked() function right, it will stop the VM, won't it? That contradicts the LoPAPR spec that says that the RTAS call returns if the "ibm,extended-os-term" property is available in the device tree.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

It does return... but only after the user starts the guest again with "cont".

OK, I guess that's enough to say that the "ibm,extended-os-term" property can stay ... so I think the patch is fine as it is right now.

So.. can I have an R-b?

#9 lore raw
Quoted 53 lines · Thomas Huth
Quoted 52 lines · David Gibson
Quoted 51 lines · Thomas Huth
Quoted 49 lines · Paolo Bonzini
Quoted 36 lines · Thomas Huth
Quoted 35 lines · David Gibson

The pseries machine type doesn't usually use the 'pvpanic' device as such, because it has a firmware/hypervisor facility with roughly the same purpose. The 'ibm,os-term' RTAS call notifies the hypervisor that the guest has crashed.

Our implementation of this call was sending a GUEST_PANICKED qmp event; however, it was not doing the other usual panic actions, making its behaviour different from pvpanic for no good reason.

To correct this, we should call qemu_system_guest_panicked() rather than directly sending the panic event.

---
 hw/ppc/spapr_rtas.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +2 -5
index 707c4d4..94a2799 100644
@@ -293,12 +293,9 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
-    target_ulong ret = 0;
+    qemu_system_guest_panicked(NULL);
 
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL,
-                                   &error_abort);
-
-    rtas_st(rets, 0, ret);
+    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
Quoted 7 lines

hw/ppc/spapr_rtas.c static void rtas_ibm_os_term(PowerPCCPU *cpu, · line 301

Quoted 2 lines
hw/ppc/spapr_rtas.c +0 -0
 static void rtas_set_power_level(PowerPCCPU *cpu, sPAPRMachineState *spapr,

If I get that qemu_system_guest_panicked() function right, it will stop the VM, won't it? That contradicts the LoPAPR spec that says that the RTAS call returns if the "ibm,extended-os-term" property is available in the device tree.

It does return... but only after the user starts the guest again with "cont".

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

OK, I guess that's enough to say that the "ibm,extended-os-term" property can stay ... so I think the patch is fine as it is right now.

So.. can I have an R-b?

Thanks.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson