hvm: Allow triple fault to imply crash rather than reboot
RFC PATCH 1/1 hvm: Allow triple fault to imply crash rather than reboot
While the triple fault action on native hardware will result in a system reset, any modern operating system can and will make use of less violent reboot methods. As a result, the most likely cause of a triple fault is a fatal software bug.
This patch allows the toolstack to indicate that a triple fault should mean a crash rather than a reboot. The default of reboot still remains the same.
xen/arch/x86/hvm/hvm.c +7 -2
@@ -1233,9 +1233,14 @@ void hvm_hlt(unsigned long rflags)void hvm_triple_fault (void ) {struct vcpu *v = current; +struct domain * d = v->domain; +u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_CRASH ] + ? SHUTDOWN_crash : SHUTDOWN_reboot; +gdprintk (XENLOG_INFO ,"Triple fault on VCPU%d - " -"invoking HVM system reset.\n" , v->vcpu_id); -domain_shutdown (v->domain, SHUTDOWN_reboot); +"invoking HVM system %s.\n" , v->vcpu_id, + reason == SHUTDOWN_crash ?"crash" :"reboot" ); +domain_shutdown (v->domain, reason); }void hvm_inject_trap (struct hvm_trap *trap)
xen/include/public/hvm/params.h +4 -1
@@ -142,6 +142,9 @@#define HVM_PARAM_ACCESS_RING_PFN 28#define HVM_PARAM_SHARING_RING_PFN 29 -#define HVM_NR_PARAMS 31 +/* Boolean: Should a triple fault imply crash rather than reboot? */ +#define HVM_PARAM_TRIPLE_FAULT_CRASH 31 + +#define HVM_NR_PARAMS 32#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
While the triple fault action on native hardware will result in a system reset, any modern operating system can and will make use of less violent reboot methods. As a result, the most likely cause of a triple fault is a fatal software bug.
This patch allows the toolstack to indicate that a triple fault should mean a
crash rather than a reboot. The default of reboot still remains the same.
Makes sense to me; minor nits below (no need to resend just because of that, but would be nice to be addressed if you had to rev the patch anyway).
xen/arch/x86/hvm/hvm.c void hvm_hlt(unsigned long rflags) · line 1236
Quoted 7 lines
xen/arch/x86/hvm/hvm.c +1
-0@@ -1233,9 +1233,14 @@ void hvm_hlt(unsigned long rflags)void hvm_triple_fault (void ) {struct vcpu *v = current; +struct domain * d = v->domain;
Stray blank.
xen/arch/x86/hvm/hvm.c void hvm_hlt(unsigned long rflags) · line 1243
Quoted 9 lines
xen/arch/x86/hvm/hvm.c +6
-2+u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_CRASH ] + ? SHUTDOWN_crash : SHUTDOWN_reboot; +gdprintk (XENLOG_INFO ,"Triple fault on VCPU%d - " -"invoking HVM system reset.\n" , v->vcpu_id); -domain_shutdown (v->domain, SHUTDOWN_reboot); +"invoking HVM system %s.\n" , v->vcpu_id, + reason == SHUTDOWN_crash ?"crash" :"reboot" ); +domain_shutdown (v->domain, reason);
So you have d cached in a local variable now, yet you still use v->domain here?
Also, I'd prefer for the message to continue to say "reset".
Jan
Quoted 13 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
While the triple fault action on native hardware will result in a system reset, any modern operating system can and will make use of less violent reboot methods. As a result, the most likely cause of a triple fault is a fatal software bug.
This patch allows the toolstack to indicate that a triple fault should mean a
crash rather than a reboot. The default of reboot still remains the same.Makes sense to me; minor nits below (no need to resend just because of that, but would be nice to be addressed if you had to rev the patch anyway).
Quoted 8 lines
xen/arch/x86/hvm/hvm.c void hvm_hlt(unsigned long rflags) · line 1236
Quoted 7 lines
xen/arch/x86/hvm/hvm.c +1
-0@@ -1233,9 +1233,14 @@ void hvm_hlt(unsigned long rflags)void hvm_triple_fault (void ) {struct vcpu *v = current; +struct domain * d = v->domain;Stray blank.
Space between * and d ?
Quoted 10 lines
xen/arch/x86/hvm/hvm.c void hvm_hlt(unsigned long rflags) · line 1243
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +6
-2+u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_CRASH ] + ? SHUTDOWN_crash : SHUTDOWN_reboot; +gdprintk (XENLOG_INFO ,"Triple fault on VCPU%d - " -"invoking HVM system reset.\n" , v->vcpu_id); -domain_shutdown (v->domain, SHUTDOWN_reboot); +"invoking HVM system %s.\n" , v->vcpu_id, + reason == SHUTDOWN_crash ?"crash" :"reboot" ); +domain_shutdown (v->domain, reason);
Quoted 2 lines
So you have d cached in a local variable now, yet you still use
v->domainhere?
Doh - missed that.
Quoted 5 lines
Also, I'd prefer for the message to continue to say "reset".
Jan
Ok - I will respin and send as non-rfc.
Quoted 7 lines · Andrew Cooper
While the triple fault action on native hardware will result in a system reset, any modern operating system can and will make use of less violent reboot methods. As a result, the most likely cause of a triple fault is a fatal software bug.
This patch allows the toolstack to indicate that a triple fault should mean a crash rather than a reboot. The default of reboot still remains the same.
Just a random thought -- what about adding SHUTDOWN_triple_fault as an explicit thing, then the toolstack can decide what to do?
Quoted 41 lines
Signed-off-by Andrew Cooper <[email protected]>diff -r
5af4f2ab06f3-r6f8c532df545xen/arch/x86/hvm/hvm.cxen/arch/x86/hvm/hvm.c +7
-2@@ -1233,9 +1233,14 @@ void hvm_hlt(unsigned long rflags)void hvm_triple_fault (void ) {struct vcpu *v = current; +struct domain * d = v->domain; +u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_CRASH ] + ? SHUTDOWN_crash : SHUTDOWN_reboot; +gdprintk (XENLOG_INFO ,"Triple fault on VCPU%d - " -"invoking HVM system reset.\n" , v->vcpu_id); -domain_shutdown (v->domain, SHUTDOWN_reboot); +"invoking HVM system %s.\n" , v->vcpu_id, + reason == SHUTDOWN_crash ?"crash" :"reboot" ); +domain_shutdown (v->domain, reason); }void hvm_inject_trap (struct hvm_trap *trap)diff -r
5af4f2ab06f3-r6f8c532df545xen/include/public/hvm/params.hxen/include/public/hvm/params.h +4
-1@@ -142,6 +142,9 @@#define HVM_PARAM_ACCESS_RING_PFN 28#define HVM_PARAM_SHARING_RING_PFN 29 -#define HVM_NR_PARAMS 31 +/* Boolean: Should a triple fault imply crash rather than reboot? */ +#define HVM_PARAM_TRIPLE_FAULT_CRASH 31 + +#define HVM_NR_PARAMS 32#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 11 lines · Ian Campbell
Quoted 7 lines · Andrew Cooper
While the triple fault action on native hardware will result in a system reset, any modern operating system can and will make use of less violent reboot methods. As a result, the most likely cause of a triple fault is a fatal software bug.
This patch allows the toolstack to indicate that a triple fault should mean a crash rather than a reboot. The default of reboot still remains the same.
Just a random thought -- what about adding
SHUTDOWN_triple_faultas an explicit thing, then the toolstack can decide what to do?
I kind of prefer that, although it will require changes to every toolstack.
An alternative would be to do that, *and* still have the new HVM_PARAM, so that any SHUTDOWN_* code can be generated by a triple fault (including new SHUTDOWN_triple_fault) -- but defaulting to SHUTDOWN_reboot so that the default behaviour is still unchanged.
Or, in any case, I'm not dead against the existing patch, it just seems less flexible than it could be. But maybe that flexibility is pointless.
-- Keir
Quoted 43 lines
Quoted 41 lines
Signed-off-by Andrew Cooper <[email protected]>diff -r
5af4f2ab06f3-r6f8c532df545xen/arch/x86/hvm/hvm.cxen/arch/x86/hvm/hvm.c +7
-2@@ -1233,9 +1233,14 @@ void hvm_hlt(unsigned long rflags)void hvm_triple_fault (void ) {struct vcpu *v = current; +struct domain * d = v->domain; +u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_CRASH ] + ? SHUTDOWN_crash : SHUTDOWN_reboot; +gdprintk (XENLOG_INFO ,"Triple fault on VCPU%d - " -"invoking HVM system reset.\n" , v->vcpu_id); -domain_shutdown (v->domain, SHUTDOWN_reboot); +"invoking HVM system %s.\n" , v->vcpu_id, + reason == SHUTDOWN_crash ?"crash" :"reboot" ); +domain_shutdown (v->domain, reason); }void hvm_inject_trap (struct hvm_trap *trap)diff -r
5af4f2ab06f3-r6f8c532df545xen/include/public/hvm/params.hxen/include/public/hvm/params.h +4
-1@@ -142,6 +142,9 @@#define HVM_PARAM_ACCESS_RING_PFN 28#define HVM_PARAM_SHARING_RING_PFN 29 -#define HVM_NR_PARAMS 31 +/* Boolean: Should a triple fault imply crash rather than reboot? */ +#define HVM_PARAM_TRIPLE_FAULT_CRASH 31 + +#define HVM_NR_PARAMS 32#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 19 lines · Keir Fraser
Quoted 10 lines · Ian Campbell
Quoted 7 lines · Andrew Cooper
While the triple fault action on native hardware will result in a system reset, any modern operating system can and will make use of less violent reboot methods. As a result, the most likely cause of a triple fault is a fatal software bug.
This patch allows the toolstack to indicate that a triple fault should mean a crash rather than a reboot. The default of reboot still remains the same.
Just a random thought -- what about adding
SHUTDOWN_triple_faultas an explicit thing, then the toolstack can decide what to do?I kind of prefer that, although it will require changes to every toolstack.
An alternative would be to do that, *and* still have the new
HVM_PARAM, so that any SHUTDOWN_* code can be generated by a triple fault (including newSHUTDOWN_triple_fault) -- but defaulting toSHUTDOWN_rebootso that the default behaviour is still unchanged.
Quoted 4 lines
Or, in any case, I'm not dead against the existing patch, it just seems less flexible than it could be. But maybe that flexibility is pointless.
-- Keir
I considered this approach originally, but decided against it.
SHUTDOWN_triple_fault would be meaningless as a standard SCHOP_shutdown parameter, and having the toolstack differentiate between _crash and _triple_fault seems pointless.
I thought that the ideal end result would be specifying
on_triple_fault="reboot"|"crash"
In the vm.cfg file
The on_{crash,reboot} actions would still then take effect as usual.
Having said that, if _triple_fault is preferred, I am not overly attached to this specific implementation.
If it isn't obvious, the motivation behind this patch is because I am currently chasing a windows triple fault on Xen-4.2. It appears machine specific, but related to our PV driver, and takes a long time to reproduce. Having automated tests fail soon with a triple fault is better than having the domain in question sit in a reboot loop until the hour long timeout kicks in.
~Andrew
Quoted 8 lines · Andrew Cooper
Quoted 8 lines
An alternative would be to do that, *and* still have the new
HVM_PARAM, so that any SHUTDOWN_* code can be generated by a triple fault (including newSHUTDOWN_triple_fault) -- but defaulting toSHUTDOWN_rebootso that the default behaviour is still unchanged.Or, in any case, I'm not dead against the existing patch, it just seems less flexible than it could be. But maybe that flexibility is pointless.
Quoted 7 lines
Quoted 1 line
-- Keir
I considered this approach originally, but decided against it.
SHUTDOWN_triple_faultwould be meaningless as a standardSCHOP_shutdownparameter, and having the toolstack differentiate between_crashand_triple_faultseems pointless.
How about letting the HVM_PARAM accept any SHUTDOWN_ code? Rather than being a boolean? That's a trivial change, just seems a bit cleaner than a boolean to me.
Also adding the SHUTDOWN_triple_fault seemed like a maybe-nice-to-have. I don't really care that much, and indeed it probably is pointless.
Quoted 10 lines
I thought that the ideal end result would be specifying
on_triple_fault="reboot"|"crash"
In the vm.cfg file
The on_{crash,reboot} actions would still then take effect as usual.
Having said that, if
_triple_faultis preferred, I am not overly attached to this specific implementation.
No let's drop the idea of a SHUTDOWN_triple_fault. :)
Quoted 6 lines
If it isn't obvious, the motivation behind this patch is because I am currently chasing a windows triple fault on Xen-4.2. It appears machine specific, but related to our PV driver, and takes a long time to reproduce. Having automated tests fail soon with a triple fault is better than having the domain in question sit in a reboot loop until the hour long timeout kicks in.
Yep, agreed, a patch along these lines of some sort is a very good idea!
-- Keir