ppc: spapr-rtas - implement os-term rtas call
PATCH v2 1/1 ppc: spapr-rtas - implement os-term rtas call
PAPR compliant guest calls this in absence of kdump. After receiving this call qemu could trigger a guest dump. This guest dump can be used to analyse using crash tool.
---
v2: indentation fixes
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
hw/ppc/spapr_rtas.c +32 -0
@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h"
@@ -267,6 +269,34 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); +vm_stop (RUN_STATE_GUEST_PANICKED ); + +rtas_st (rets,0 , ret); +} + +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;
@@ -392,6 +422,8 @@ static void core_rtas_register_types(void) rtas_ibm_get_system_parameter);spapr_rtas_register ("ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , rtas_ibm_ext_os_term); }type_init (core_rtas_register_types)
Signature · 1 line
1.8.3.1
Quoted 61 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. After receiving this call qemu could trigger a guest dump. This guest dump can be used to analyse using crash tool.
Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: indentation fixes
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)hw/ppc/spapr_rtas.c +30
-0@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -267,6 +269,34 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); +vm_stop (RUN_STATE_GUEST_PANICKED ); + +rtas_st (rets,0 , ret); +} + +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 426
Quoted 5 lines
hw/ppc/spapr_rtas.c +2
-0@@ -392,6 +422,8 @@ static void core_rtas_register_types(void) rtas_ibm_get_system_parameter);spapr_rtas_register ("ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , rtas_ibm_ext_os_term);
Why do we need the extended-os-term if we don't do anything with it?
Alex
Quoted 3 lines
hw/ppc/spapr_rtas.c +0
-0}type_init (core_rtas_register_types)
Quoted 61 lines · Alexander Graf
Quoted 60 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. After receiving this call qemu could trigger a guest dump. This guest dump can be used to analyse using crash tool.
Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: indentation fixes
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)hw/ppc/spapr_rtas.c +30
-0@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -267,6 +269,34 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); +vm_stop (RUN_STATE_GUEST_PANICKED ); + +rtas_st (rets,0 , ret); +} + +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;
Quoted 8 lines
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 426
Quoted 6 lines
hw/ppc/spapr_rtas.c +2
-0@@ -392,6 +422,8 @@ static void core_rtas_register_types(void) rtas_ibm_get_system_parameter);spapr_rtas_register ("ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:
void rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes with panic_timeout.
*/
if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term") ||
RTAS_UNKNOWN_SERVICE == rtas_token("ibm,extended-os-term"))
return;[...]
}
Regards,
Nikunj
Quoted 74 lines · Nikunj A Dadhania
Quoted 60 lines · Alexander Graf
Quoted 59 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. After receiving this call qemu could trigger a guest dump. This guest dump can be used to analyse using crash tool.
Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: indentation fixes
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)hw/ppc/spapr_rtas.c +30
-0@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -267,6 +269,34 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); +vm_stop (RUN_STATE_GUEST_PANICKED ); + +rtas_st (rets,0 , ret); +} + +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name;Quoted 8 lines
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 426
Quoted 7 lines
hw/ppc/spapr_rtas.c +2
-0spapr_rtas_fn fn;@@ -392,6 +422,8 @@ static void core_rtas_register_types(void) rtas_ibm_get_system_parameter);spapr_rtas_register ("ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:
Quoted 8 lines
void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.
But we do not return from the RTAS call, so we don't adhere to the extended semantics?
Alex
Quoted 11 lines
*/ if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term") || RTAS_UNKNOWN_SERVICE == rtas_token("ibm,extended-os-term")) return;[...]
}Regards,
Nikunj
Quoted 84 lines · Alexander Graf
Quoted 74 lines · Nikunj A Dadhania
Quoted 60 lines · Alexander Graf
Quoted 59 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. After receiving this call qemu could trigger a guest dump. This guest dump can be used to analyse using crash tool.
Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: indentation fixes
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)hw/ppc/spapr_rtas.c +30
-0@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -267,6 +269,34 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); +vm_stop (RUN_STATE_GUEST_PANICKED ); + +rtas_st (rets,0 , ret); +} + +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name;Quoted 8 lines
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 426
Quoted 7 lines
hw/ppc/spapr_rtas.c +2
-0spapr_rtas_fn fn;@@ -392,6 +422,8 @@ static void core_rtas_register_types(void) rtas_ibm_get_system_parameter);spapr_rtas_register ("ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:Quoted 8 lines
void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.
Quoted 2 lines
But we do not return from the RTAS call, so we don't adhere to the extended semantics?
But you would return without calling os-term call if
ibm,extended-os-term isnt registered. For that reason I h ave defined a
stub.
Regards
Nikunj
Quoted 85 lines · Nikunj A Dadhania
Quoted 83 lines · Alexander Graf
Quoted 82 lines · Nikunj A Dadhania
Quoted 60 lines · Alexander Graf
Quoted 59 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. After receiving this call qemu could trigger a guest dump. This guest dump can be used to analyse using crash tool.
Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: indentation fixes
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)hw/ppc/spapr_rtas.c +30
-0@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -267,6 +269,34 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); +vm_stop (RUN_STATE_GUEST_PANICKED ); + +rtas_st (rets,0 , ret); +} + +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name;Quoted 8 lines
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 426
Quoted 7 lines
hw/ppc/spapr_rtas.c +2
-0spapr_rtas_fn fn;@@ -392,6 +422,8 @@ static void core_rtas_register_types(void) rtas_ibm_get_system_parameter);spapr_rtas_register ("ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.
Quoted 5 lines
Quoted 2 lines
But we do not return from the RTAS call, so we don't adhere to the extended semantics?
But you would return without calling os-term call if
ibm,extended-os-term isnt registered. For that reason I h ave defined a
stub.
I appreciate the hacker mentality, but Linux explicitly checks on ibm,extended-os-term to ensure that the hypervisor does not stop the VM when it calls ibm,os-term. However, the implementation above does stop the VM when the guest calls ibm,os-term.
Why was that check put into place?
Alex
Quoted 22 lines · Alexander Graf
Quoted 21 lines · Nikunj A Dadhania
Quoted 20 lines · Alexander Graf
Quoted 9 lines · Nikunj A Dadhania
Quoted 3 lines · Alexander Graf
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 426
Quoted 2 lines
hw/ppc/spapr_rtas.c +2
-0+spapr_rtas_register ("ibm,os-term" , rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:Quoted 8 lines
void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.But we do not return from the RTAS call, so we don't adhere to the extended semantics?
Quoted 8 lines
Quoted 3 lines
But you would return without calling os-term call if
ibm,extended-os-term isnt registered. For that reason I h ave defined a
stub.I appreciate the hacker mentality, but Linux explicitly checks on ibm,extended-os-term to ensure that the hypervisor does not stop the VM when it calls ibm,os-term. However, the implementation above does stop the VM when the guest calls ibm,os-term.
Seems to be added to do just that:
commit e9bbc8cde0e3c33b42ddbe1b02108cb5c97275eb
Author: Anton Blanchard <[email protected]> Date: Thu Feb 18 12:11:51 2010 +0000
powerpc/pseries: Call ibm,os-term if the ibm,extended-os-term is present
We have had issues in the past with ibm,os-term initiating shutdown of a partition. This is confusing to the user, especially if panic_timeout is non zero.
The temporary fix was to avoid calling ibm,os-term if a panic_timeout was set and since we set it on every boot we basically never call ibm,os-term.
An extended version of ibm,os-term has since been implemented which gives us the behaviour we want:
"When the platform supports extended ibm,os-term behavior, the return to the RTAS will always occur unless there is a kernel assisted dump active as initiated by an ibm,configure-kernel-dump call."
This patch checks for the ibm,extended-os-term property and calls ibm,os-term if it exists.
Quoted 1 line
Why was that check put into place?
Regards
Nikunj
Quoted 55 lines · Nikunj A Dadhania
Quoted 22 lines · Alexander Graf
Quoted 21 lines · Nikunj A Dadhania
Quoted 20 lines · Alexander Graf
Quoted 9 lines · Nikunj A Dadhania
Quoted 3 lines · Alexander Graf
Review
Quoted 2 lines
(quoted diff) +2
-0+ spapr_rtas_register("ibm,os-term", rtas_ibm_os_term); + spapr_rtas_register("ibm,extended-os-term", rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:Quoted 8 lines
void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.But we do not return from the RTAS call, so we don't adhere to the extended semantics?
Quoted 8 lines
Quoted 3 lines
But you would return without calling os-term call if
ibm,extended-os-term isnt registered. For that reason I h ave defined a
stub.I appreciate the hacker mentality, but Linux explicitly checks on ibm,extended-os-term to ensure that the hypervisor does not stop the VM when it calls ibm,os-term. However, the implementation above does stop the VM when the guest calls ibm,os-term.
Seems to be added to do just that:
commit
e9bbc8cde0e3c33b42ddbe1b02108cb5c97275ebAuthor: Anton Blanchard <[email protected]> Date: Thu Feb 18 12:11:51 2010 +0000powerpc/pseries: Call ibm,os-term if the ibm,extended-os-term is present
We have had issues in the past with ibm,os-term initiating shutdown of a partition. This is confusing to the user, especially if
panic_timeoutis non zero.The temporary fix was to avoid calling ibm,os-term if a
panic_timeoutwas set and since we set it on every boot we basically never call ibm,os-term.An extended version of ibm,os-term has since been implemented which gives us the behaviour we want:
"When the platform supports extended ibm,os-term behavior, the return to the RTAS will always occur unless there is a kernel assisted dump active as initiated by an ibm,configure-kernel-dump call."
Quoted 5 lines
This patch checks for the ibm,extended-os-term property and calls ibm,os-term if it exists.
Signed-off-by Anton Blanchard <[email protected]>Signed-off-by Benjamin Herrenschmidt <[email protected]>
I was thinking of the following:
1) Return the RTAS unsupported for extended-os-term
2) A comment in the beginning of the function to suggest that this is a stub need for legacy of PowerVM
Please let me know your thoughts.
Regards,
Nikunj
Quoted 60 lines · Nikunj A Dadhania
Quoted 52 lines · Nikunj A Dadhania
Quoted 21 lines · Alexander Graf
Quoted 20 lines · Nikunj A Dadhania
Quoted 19 lines · Alexander Graf
Quoted 8 lines · Nikunj A Dadhania
Quoted 3 lines · Alexander Graf
Review
Quoted 2 lines
(quoted diff) +2
-0+ spapr_rtas_register("ibm,os-term", rtas_ibm_os_term); + spapr_rtas_register("ibm,extended-os-term", rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:Quoted 8 lines
void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.But we do not return from the RTAS call, so we don't adhere to the extended semantics?
Quoted 7 lines
Quoted 3 lines
But you would return without calling os-term call if
ibm,extended-os-term isnt registered. For that reason I h ave defined a
stub.I appreciate the hacker mentality, but Linux explicitly checks on ibm,extended-os-term to ensure that the hypervisor does not stop the VM when it calls ibm,os-term. However, the implementation above does stop the VM when the guest calls ibm,os-term.
Seems to be added to do just that:
commit
e9bbc8cde0e3c33b42ddbe1b02108cb5c97275ebAuthor: Anton Blanchard <[email protected]> Date: Thu Feb 18 12:11:51 2010 +0000powerpc/pseries: Call ibm,os-term if the ibm,extended-os-term is present
We have had issues in the past with ibm,os-term initiating shutdown of a partition. This is confusing to the user, especially if
panic_timeoutis non zero.The temporary fix was to avoid calling ibm,os-term if a
panic_timeoutwas set and since we set it on every boot we basically never call ibm,os-term.An extended version of ibm,os-term has since been implemented which gives us the behaviour we want:
"When the platform supports extended ibm,os-term behavior, the return to the RTAS will always occur unless there is a kernel assisted dump active as initiated by an ibm,configure-kernel-dump call."
Quoted 5 lines
This patch checks for the ibm,extended-os-term property and calls ibm,os-term if it exists.
Signed-off-by Anton Blanchard <[email protected]>Signed-off-by Benjamin Herrenschmidt <[email protected]>
Quoted 7 lines
I was thinking of the following:
1) Return the RTAS unsupported for extended-os-term
2) A comment in the beginning of the function to suggest that this is a stub need for legacy of PowerVMPlease let me know your thoughts.
I think we need to clarify what bug Anton was trying to fix. The implementation you're proposing for os-term may "initiate a shutdown of a partition", albeit a hard stop usually. Is this what Linux is trying to avoid?
Did PowerVM try to inject a soft shutdown signal into the VM and this check is to make sure we don't get that?
I think we should make 100% sure we understand what situation the fix above actually tried to avoid and make sure QEMU doesn't do it.
Alex
Quoted 67 lines · Alexander Graf
Quoted 66 lines · Nikunj A Dadhania
Quoted 52 lines · Nikunj A Dadhania
Quoted 21 lines · Alexander Graf
Quoted 20 lines · Nikunj A Dadhania
Quoted 19 lines · Alexander Graf
Quoted 8 lines · Nikunj A Dadhania
Quoted 3 lines · Alexander Graf
Review
Quoted 2 lines
(quoted diff) +2
-0+ spapr_rtas_register("ibm,os-term", rtas_ibm_os_term); + spapr_rtas_register("ibm,extended-os-term", rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:Quoted 8 lines
void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.But we do not return from the RTAS call, so we don't adhere to the extended semantics?
Quoted 7 lines
Quoted 3 lines
But you would return without calling os-term call if
ibm,extended-os-term isnt registered. For that reason I h ave defined a
stub.I appreciate the hacker mentality, but Linux explicitly checks on ibm,extended-os-term to ensure that the hypervisor does not stop the VM when it calls ibm,os-term. However, the implementation above does stop the VM when the guest calls ibm,os-term.
Seems to be added to do just that:
commit
e9bbc8cde0e3c33b42ddbe1b02108cb5c97275ebAuthor: Anton Blanchard <[email protected]> Date: Thu Feb 18 12:11:51 2010 +0000powerpc/pseries: Call ibm,os-term if the ibm,extended-os-term is present
We have had issues in the past with ibm,os-term initiating shutdown of a partition. This is confusing to the user, especially if
panic_timeoutis non zero.The temporary fix was to avoid calling ibm,os-term if a
panic_timeoutwas set and since we set it on every boot we basically never call ibm,os-term.An extended version of ibm,os-term has since been implemented which gives us the behaviour we want:
"When the platform supports extended ibm,os-term behavior, the return to the RTAS will always occur unless there is a kernel assisted dump active as initiated by an ibm,configure-kernel-dump call."
Quoted 5 lines
This patch checks for the ibm,extended-os-term property and calls ibm,os-term if it exists.
Signed-off-by Anton Blanchard <[email protected]>Signed-off-by Benjamin Herrenschmidt <[email protected]>I was thinking of the following:
1) Return the RTAS unsupported for extended-os-term
2) A comment in the beginning of the function to suggest that this is a stub need for legacy of PowerVM
Quoted 6 lines
Quoted 1 line
Please let me know your thoughts.
I think we need to clarify what bug Anton was trying to fix. The implementation you're proposing for os-term may "initiate a shutdown of a partition", albeit a hard stop usually. Is this what Linux is trying to avoid?
Let me put down my understanding:
There are two possible way to handle kernel panic:
1) Kdump service running in guest - already working
2) Pass the kernel panic information to hypervisor - not there in Qemu pseries
So without kdump service running, if linux kernel hits a panic, its going to check os-term and extended-os-term, only then its going to call os-term.
Now for what to do in os-term is the question, at present my code is putting that to guest paniced state(paused)
Quoted 2 lines
Did PowerVM try to inject a soft shutdown signal into the VM and this check is to make sure we don't get that?
In this case, isnt that implementation dependent on what we do in qemu?
Quoted 2 lines
I think we should make 100% sure we understand what situation the fix above actually tried to avoid and make sure QEMU doesn't do it.
Regards
Nikunj
Quoted 75 lines · Nikunj A Dadhania
Quoted 66 lines · Alexander Graf
Quoted 65 lines · Nikunj A Dadhania
Quoted 52 lines · Nikunj A Dadhania
Quoted 21 lines · Alexander Graf
Quoted 20 lines · Nikunj A Dadhania
Quoted 19 lines · Alexander Graf
Quoted 8 lines · Nikunj A Dadhania
Quoted 3 lines · Alexander Graf
Review
Quoted 2 lines
(quoted diff) +2
-0+ spapr_rtas_register("ibm,os-term", rtas_ibm_os_term); + spapr_rtas_register("ibm,extended-os-term", rtas_ibm_ext_os_term);Why do we need the extended-os-term if we don't do anything with it?
Linux kernel checks for both of them because of legacy:
arch/powerpc/kernel/rtas.c:Quoted 8 lines
void
rtas_os_term(char *str)
{
[...]
/*
* Firmware with the ibm,extended-os-term property is guaranteed
* to always return from an ibm,os-term call. Earlier versions without
* this property may terminate the partition which we want to avoid
* since it interferes withpanic_timeout.But we do not return from the RTAS call, so we don't adhere to the extended semantics?
Quoted 7 lines
Quoted 3 lines
But you would return without calling os-term call if
ibm,extended-os-term isnt registered. For that reason I h ave defined a
stub.I appreciate the hacker mentality, but Linux explicitly checks on ibm,extended-os-term to ensure that the hypervisor does not stop the VM when it calls ibm,os-term. However, the implementation above does stop the VM when the guest calls ibm,os-term.
Seems to be added to do just that:
commit
e9bbc8cde0e3c33b42ddbe1b02108cb5c97275ebAuthor: Anton Blanchard <[email protected]> Date: Thu Feb 18 12:11:51 2010 +0000powerpc/pseries: Call ibm,os-term if the ibm,extended-os-term is present
We have had issues in the past with ibm,os-term initiating shutdown of a partition. This is confusing to the user, especially if
panic_timeoutis non zero.The temporary fix was to avoid calling ibm,os-term if a
panic_timeoutwas set and since we set it on every boot we basically never call ibm,os-term.An extended version of ibm,os-term has since been implemented which gives us the behaviour we want:
"When the platform supports extended ibm,os-term behavior, the return to the RTAS will always occur unless there is a kernel assisted dump active as initiated by an ibm,configure-kernel-dump call."
Quoted 5 lines
This patch checks for the ibm,extended-os-term property and calls ibm,os-term if it exists.
Signed-off-by Anton Blanchard <[email protected]>Signed-off-by Benjamin Herrenschmidt <[email protected]>I was thinking of the following:
1) Return the RTAS unsupported for extended-os-term
2) A comment in the beginning of the function to suggest that this is a stub need for legacy of PowerVMQuoted 5 lines
Quoted 1 line
Please let me know your thoughts.
I think we need to clarify what bug Anton was trying to fix. The implementation you're proposing for os-term may "initiate a shutdown of a partition", albeit a hard stop usually. Is this what Linux is trying to avoid?
Let me put down my understanding:
Quoted 8 lines
There are two possible way to handle kernel panic:
1) Kdump service running in guest - already working
2) Pass the kernel panic information to hypervisor - not there in Qemu pseriesSo without kdump service running, if linux kernel hits a panic, its going to check os-term and extended-os-term, only then its going to call os-term.
It's checking both for a reason. Find that reason.
Alex
Quoted 10 lines · Alexander Graf
Quoted 9 lines · Nikunj A Dadhania
Alexander Graf <[email protected]> writes:
Let me put down my understanding:
There are two possible way to handle kernel panic:
1) Kdump service running in guest - already working
2) Pass the kernel panic information to hypervisor - not there in Qemu pseries
Quoted 5 lines
Quoted 3 lines
So without kdump service running, if linux kernel hits a panic, its going to check os-term and extended-os-term, only then its going to call os-term.
It's checking both for a reason. Find that reason.
Here is what I figured out from PAPR:
rtas ibm,os-term, does not gaurantee a return back to the guest cpu.
If ibm,extended-os-term property is set rtas call return will always occur.
Regards
Nikunj
Quoted 20 lines
Am 26.06.2014 um 09:55 schrieb Nikunj A Dadhania <[email protected]>:
Quoted 14 lines · Alexander Graf
Quoted 13 lines · Nikunj A Dadhania
Alexander Graf <[email protected]> writes:
Let me put down my understanding:
There are two possible way to handle kernel panic:
1) Kdump service running in guest - already working
2) Pass the kernel panic information to hypervisor - not there in Qemu pseriesSo without kdump service running, if linux kernel hits a panic, its going to check os-term and extended-os-term, only then its going to call os-term.
Quoted 8 lines
Quoted 1 line
It's checking both for a reason. Find that reason.
Here is what I figured out from PAPR:
rtas ibm,os-term, does not gaurantee a return back to the guest cpu.
If ibm,extended-os-term property is set rtas call return will always occur.
With your patch it doesn't occur.
Alex
Quoted 4 lines
Regards
Nikunj
Quoted 20 lines · Alexander Graf
Quoted 20 lines
Am 26.06.2014 um 09:55 schrieb Nikunj A Dadhania <[email protected]>:
Quoted 15 lines · Alexander Graf
Quoted 5 lines · Nikunj A Dadhania
Alexander Graf <[email protected]> writes:
Let me put down my understanding:
Quoted 8 lines
There are two possible way to handle kernel panic:
1) Kdump service running in guest - already working
2) Pass the kernel panic information to hypervisor - not there in Qemu pseriesSo without kdump service running, if linux kernel hits a panic, its going to check os-term and extended-os-term, only then its going to call os-term.
It's checking both for a reason. Find that reason.
Quoted 8 lines
Quoted 6 lines
Here is what I figured out from PAPR:
rtas ibm,os-term, does not gaurantee a return back to the guest cpu.
If ibm,extended-os-term property is set rtas call return will always occur.
With your patch it doesn't occur.
Hmm, you are right.
+ monitor_protocol_event(QEVENT_GUEST_PANICKED, data); + qobject_decref(data); + vm_stop(RUN_STATE_GUEST_PANICKED);
So the issue here is using vm_stop. So if I do not do this I will be returning back to the guest.
I was trying to enable:
<on_crash> coredump-restart </on_crash>
<on_crash> coredump-destroy </on_crash>
in libvirt. But anyways, when libvirt receives these event, it will either destroy or restart the guest. So if I remove the vm_stop, there will be a return to the guest. And depending on the libvirt domain config a restart/destroy will take effect. Does this look ok?
Regards
Nikunj
Quoted 38 lines · Nikunj A Dadhania
Quoted 17 lines · Alexander Graf
Quoted 17 lines
Am 26.06.2014 um 09:55 schrieb Nikunj A Dadhania <[email protected]>:
Quoted 13 lines · Alexander Graf
Quoted 13 lines · Nikunj A Dadhania
Alexander Graf <[email protected]> writes:
Let me put down my understanding:
There are two possible way to handle kernel panic:
1) Kdump service running in guest - already working
2) Pass the kernel panic information to hypervisor - not there in Qemu pseriesSo without kdump service running, if linux kernel hits a panic, its going to check os-term and extended-os-term, only then its going to call os-term.
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
It's checking both for a reason. Find that reason.
Here is what I figured out from PAPR:
rtas ibm,os-term, does not gaurantee a return back to the guest cpu.
If ibm,extended-os-term property is set rtas call return will always occur.
With your patch it doesn't occur.
Hmm, you are right.
(quoted diff) +3
-0+ monitor_protocol_event(QEVENT_GUEST_PANICKED, data); + qobject_decref(data); + vm_stop(RUN_STATE_GUEST_PANICKED);So the issue here is using
vm_stop. So if I do not do this I will be returning back to the guest.I was trying to enable:
Quoted 7 lines
<
on_crash> coredump-restart </on_crash>
<on_crash> coredump-destroy </on_crash>in libvirt. But anyways, when libvirt receives these event, it will either destroy or restart the guest. So if I remove the
vm_stop, there will be a return to the guest. And depending on the libvirt domain config a restart/destroy will take effect. Does this look ok?
I think that's closer to what Linux expects, yes. But I'd like to have an ack on that approach from Ben or Anton.
Alex