xen: add support for automatic debug key actions in case of crash
PATCH 1/1 xen: add support for automatic debug key actions in case of crash
When the host crashes it would sometimes be nice to have additional debug data available which could be produced via debug keys, but halting the server for manual intervention might be impossible due to the need to reboot/kexec rather sooner than later.
Add support for automatic debug key actions in case of crashes which can be activated via boot- or runtime-parameter.
Depending on the type of crash the desired data might be different, so support different settings for the possible types of crashes.
The parameter is "crash-debug" with the following syntax:
crash-debug-<type>=<string>
with <type> being one of:
panic, hwdom, watchdog, kexeccmd, debugkey
and <string> a sequence of debug key characters with '.' having the special semantics of a 1 second pause.
So "crash-debug-watchdog=0.0qr" would result in special output in case of watchdog triggered crash (dom0 state, 1 second pause, dom0 state, domain info, run queues).
--- docs/misc/xen-command-line.pandoc | 23 +++++++++++++++++++ xen/common/kexec.c | 8 ++++--- xen/common/keyhandler.c | 37 +++++++++++++++++++++++++++++++ xen/common/shutdown.c | 4 ++-- xen/drivers/char/console.c | 2 +- xen/include/xen/kexec.h | 10 +++++++-- xen/include/xen/keyhandler.h | 11 +++++++++ 7 files changed, 87 insertions(+), 8 deletions(-)
docs/misc/xen-command-line.pandoc +23 -0
@@ -574,6 +574,29 @@ reduction of features at Xen's disposal to manage guests. ### cpuinfo (x86) > `= <boolean>` +### crash-debug-debugkey +### crash-debug-hwdom +### crash-debug-kexeccmd +### crash-debug-panic +### crash-debug-watchdog +> `= <string>` + +> Can be modified at runtime + +Specify debug-key actions in cases of crashes. Each of the parameters applies +to a different crash reason. The `<string>` is a sequence of debug key +characters, with `.` having the special meaning of a 1 second pause. + +So e.g. `crash-debug-watchdog=0.0r` would dump dom0 state twice with a +second between the two state dumps, followed by the run queues of the +hypervisor, if the system crashes due to a watchdog timeout. + +These parameters should be used carefully, as e.g. specifying +`crash-debug-debugkey=C` would result in an endless loop. Depending on the +reason of the system crash it might happen that triggering some debug key +action will result in a hang instead of dumping data and then doing a +reboot or crash dump. + ### crashinfo_maxaddr > `= <size>`
xen/common/kexec.c +5 -3
@@ -373,10 +373,12 @@ static int kexec_common_shutdown(void)return 0 ; } -void kexec_crash (void ) +void kexec_crash (enum crash_reason reason) {int pos; +keyhandler_crash_action (reason); + pos = (test_bit (KEXEC_FLAG_CRASH_POS , &kexec_flags) !=0 );if ( !test_bit (KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) )return ;
@@ -409,7 +411,7 @@ static long kexec_reboot(void *_image)static void do_crashdump_trigger (unsigned char key) {printk ("'%c' pressed -> triggering crashdump\n" , key); -kexec_crash (); +kexec_crash (CRASHREASON_DEBUGKEY );printk (" * no crash kernel loaded!\n" ); }
@@ -840,7 +842,7 @@ static int kexec_exec(XEN_GUEST_HANDLE_PARAM(void) uarg) ret =continue_hypercall_on_cpu (0 , kexec_reboot, image);break ;case KEXEC_TYPE_CRASH : -kexec_crash ();/* Does not return */ +kexec_crash (CRASHREASON_KEXECCMD );/* Does not return */ break ; }
xen/common/keyhandler.c +37 -0
@@ -3,7 +3,9 @@*/ #include <asm/regs.h> +#include <xen/delay.h> #include <xen/keyhandler.h> +#include <xen/param.h> #include <xen/shutdown.h> #include <xen/event.h> #include <xen/console.h>
@@ -507,6 +509,41 @@ void __init initialize_keytable(void) } } +#define CRASHACTION_SIZE 32 +static char crash_debug_panic[CRASHACTION_SIZE ]; +static char crash_debug_hwdom[CRASHACTION_SIZE ]; +static char crash_debug_watchdog[CRASHACTION_SIZE ]; +static char crash_debug_kexeccmd[CRASHACTION_SIZE ]; +static char crash_debug_debugkey[CRASHACTION_SIZE ]; + +static char *crash_action[CRASHREASON_N ] = { + [CRASHREASON_PANIC ] = crash_debug_panic, + [CRASHREASON_HWDOM ] = crash_debug_hwdom, + [CRASHREASON_WATCHDOG ] = crash_debug_watchdog, + [CRASHREASON_KEXECCMD ] = crash_debug_kexeccmd, + [CRASHREASON_DEBUGKEY ] = crash_debug_debugkey, +}; + +string_runtime_param ("crash-debug-panic" , crash_debug_panic); +string_runtime_param ("crash-debug-hwdom" , crash_debug_hwdom); +string_runtime_param ("crash-debug-watchdog" , crash_debug_watchdog); +string_runtime_param ("crash-debug-kexeccmd" , crash_debug_kexeccmd); +string_runtime_param ("crash-debug-debugkey" , crash_debug_debugkey); + +void keyhandler_crash_action (enum crash_reason reason) +{ +const char *action = crash_action[reason]; +struct cpu_user_regs *regs =get_irq_regs () ? :guest_cpu_user_regs (); + +while ( *action ) { +if ( *action =='.' ) +mdelay (1000 ); +else +handle_keypress (*action, regs); + action++; + } +} +/* * Local variables: * mode: C
xen/common/shutdown.c +2 -2
@@ -43,7 +43,7 @@ void hwdom_shutdown(u8 reason)case SHUTDOWN_crash:debugger_trap_immediate ();printk ("Hardware Dom%u crashed: " , hardware_domain->domain_id); -kexec_crash (); +kexec_crash (CRASHREASON_HWDOM );maybe_reboot ();break ;/* not reached */
@@ -56,7 +56,7 @@ void hwdom_shutdown(u8 reason)case SHUTDOWN_watchdog:printk ("Hardware Dom%u shutdown: watchdog rebooting machine\n" , hardware_domain->domain_id); -kexec_crash (); +kexec_crash (CRASHREASON_WATCHDOG );machine_restart (0 );break ;/* not reached */
xen/drivers/char/console.c +1 -1
@@ -1271,7 +1271,7 @@ void panic(const char *fmt, ...)debugger_trap_immediate (); -kexec_crash (); +kexec_crash (CRASHREASON_PANIC );if ( opt_noreboot )machine_halt ();
xen/include/xen/kexec.h +8 -2
@@ -1,6 +1,8 @@#ifndef __XEN_KEXEC_H__#define __XEN_KEXEC_H__ +#include <xen/keyhandler.h> +#ifdef CONFIG_KEXEC #include <public/kexec.h>
@@ -48,7 +50,7 @@ void machine_kexec_unload(struct kexec_image *image);void machine_kexec_reserved (xen_kexec_reserve_t *reservation);void machine_reboot_kexec (struct kexec_image *image);void machine_kexec (struct kexec_image *image); -void kexec_crash (void ); +void kexec_crash (enum crash_reason reason);void kexec_crash_save_cpu (void );struct crash_xen_info *kexec_crash_save_info (void );void machine_crash_shutdown (void );
@@ -82,7 +84,11 @@ void vmcoreinfo_append_str(const char *fmt, ...)#define kexecing 0static inline void kexec_early_calculations (void ) {} -static inline void kexec_crash (void ) {} +static inline void kexec_crash (enum crash_reason reason) +{ +keyhandler_crash_action (reason); +} +static inline void kexec_crash_save_cpu (void ) {}static inline void set_kexec_crash_area_size (u64 system_ram) {}
xen/include/xen/keyhandler.h +11 -0
@@ -48,4 +48,15 @@ void register_irq_keyhandler(unsigned char key,/* Inject a keypress into the key-handling subsystem. */ extern void handle_keypress (unsigned char key,struct cpu_user_regs *regs); +enum crash_reason { +CRASHREASON_PANIC , +CRASHREASON_HWDOM , +CRASHREASON_WATCHDOG , +CRASHREASON_KEXECCMD , +CRASHREASON_DEBUGKEY , +CRASHREASON_N +}; + +void keyhandler_crash_action (enum crash_reason reason); +#endif /* __XEN_KEYHANDLER_H__ */
Signature · 1 line
2.26.2
Quoted 7 lines · Juergen Gross
When the host crashes it would sometimes be nice to have additional debug data available which could be produced via debug keys, but halting the server for manual intervention might be impossible due to the need to reboot/kexec rather sooner than later.
Add support for automatic debug key actions in case of crashes which can be activated via boot- or runtime-parameter.
While I can certainly see this possibly being a useful thing in certain situations, I'm uncertain it's going to be helpful in at least a fair set of cases. What output to request very much depends on the nature of the problem one is running into, and the more keys one adds "just in case", the longer the reboot latency, and the higher the risk (see also below) of the output generation actually causing further problems.
IOW I'm neither fully convinced that we want this, nor fully opposed.
Quoted 5 lines
Depending on the type of crash the desired data might be different, so support different settings for the possible types of crashes.
The parameter is "crash-debug" with the following syntax:
Quoted 8 lines
crash-debug-<type>=<string>
with <type> being one of:
panic, hwdom, watchdog, kexeccmd, debugkey
and <string> a sequence of debug key characters with '.' having the special semantics of a 1 second pause.
1 second is a whole lot of time. To get two successive sets of data, a much shorter delay (if any) would normally suffice.
Also, while '.' may seem like a good choice right now, with the shortage of characters we may want to put a real handler behind it at come point. The one character that clearly won't make much sense to use in this context is 'h', but that's awful as a (kind of) separator. Could we perhaps replace 'h' by '?', freeing up 'h' and allowing '?' to be used for this purpose here?
Quoted 18 lines
docs/misc/xen-command-line.pandoc +12
-0@@ -574,6 +574,29 @@ reduction of features at Xen's disposal to manage guests. ### cpuinfo (x86) > `= <boolean>` +### crash-debug-debugkey +### crash-debug-hwdom +### crash-debug-kexeccmd +### crash-debug-panic +### crash-debug-watchdog +> `= <string>` + +> Can be modified at runtime + +Specify debug-key actions in cases of crashes. Each of the parameters applies +to a different crash reason. The `<string>` is a sequence of debug key +characters, with `.` having the special meaning of a 1 second pause.
docs/misc/xen-command-line.pandoc reduction of features at Xen's disposal to manage guests. · line 598
Quoted 10 lines
docs/misc/xen-command-line.pandoc +10
-0+ +So e.g. `crash-debug-watchdog=0.0r` would dump dom0 state twice with a +second between the two state dumps, followed by the run queues of the +hypervisor, if the system crashes due to a watchdog timeout. + +These parameters should be used carefully, as e.g. specifying +`crash-debug-debugkey=C` would result in an endless loop. Depending on the +reason of the system crash it might happen that triggering some debug key +action will result in a hang instead of dumping data and then doing a +reboot or crash dump.
I think it would be useful if the flavors were (briefly)
explained: At the very least "debugkey" doesn't directly fit "in cases of crashes", as there's no crash involved. kexec_crash() instead gets invoked without there having been any crash.
You may also want to point out that this is a best effort thing only - system state at the point of a crash may be such that the attempt of handling one or the debug keys would have further bad effects on the system, including that the actual kexec may then never occur.
Quoted 14 lines
docs/misc/xen-command-line.pandoc +10
-0@@ -507,6 +509,41 @@ void __init initialize_keytable(void) } } +#define CRASHACTION_SIZE 32 +static char crash_debug_panic[CRASHACTION_SIZE]; +static char crash_debug_hwdom[CRASHACTION_SIZE]; +static char crash_debug_watchdog[CRASHACTION_SIZE]; +static char crash_debug_kexeccmd[CRASHACTION_SIZE]; +static char crash_debug_debugkey[CRASHACTION_SIZE]; + +static char *crash_action[CRASHREASON_N] = { + [CRASHREASON_PANIC] = crash_debug_panic, + [CRASHREASON_HWDOM] = crash_debug_hwdom,
docs/misc/xen-command-line.pandoc void __init initialize_keytable(void) · line 531
Quoted 10 lines
docs/misc/xen-command-line.pandoc +10
-0+ [CRASHREASON_WATCHDOG] = crash_debug_watchdog, + [CRASHREASON_KEXECCMD] = crash_debug_kexeccmd, + [CRASHREASON_DEBUGKEY] = crash_debug_debugkey, +}; + +string_runtime_param("crash-debug-panic", crash_debug_panic); +string_runtime_param("crash-debug-hwdom", crash_debug_hwdom); +string_runtime_param("crash-debug-watchdog", crash_debug_watchdog); +string_runtime_param("crash-debug-kexeccmd", crash_debug_kexeccmd); +string_runtime_param("crash-debug-debugkey", crash_debug_debugkey);
In general I'm not in favor of this (or similar) needing five new command line options, instead of just one. The problem with e.g.
crash-debug=panic:rq,watchdog:0d
is that ',' (or any other separator chosen) could in principle also be a debug key. It would still be possible to use
crash-debug=panic:rq crash-debug=watchdog:0d
though. Thoughts?
docs/misc/xen-command-line.pandoc void __init initialize_keytable(void) · line 537
Quoted 6 lines
docs/misc/xen-command-line.pandoc +6
-0+void keyhandler_crash_action(enum crash_reason reason) +{ + const char *action = crash_action[reason]; + struct cpu_user_regs *regs = get_irq_regs() ? : guest_cpu_user_regs(); + + while ( *action ) {
Misplaced brace.
docs/misc/xen-command-line.pandoc void __init initialize_keytable(void) · line 544
Quoted 7 lines
docs/misc/xen-command-line.pandoc +7
-0+ if ( *action == '.' ) + mdelay(1000); + else + handle_keypress(*action, regs); + action++; + } +}
I think only diagnostic keys should be permitted here.
xen/include/xen/kexec.h line 4
Quoted 7 lines
xen/include/xen/kexec.h +1
-0@@ -1,6 +1,8 @@#ifndef __XEN_KEXEC_H__#define __XEN_KEXEC_H__ +#include <xen/keyhandler.h>
Could we go without this, utilizing the gcc extension of forward declared enums? Otoh ...
xen/include/xen/kexec.h void vmcoreinfo_append_str(const char *fmt, ...) · line 90
Quoted 9 lines
xen/include/xen/kexec.h +4
-1@@ -82,7 +84,11 @@ void vmcoreinfo_append_str(const char *fmt, ...)#define kexecing 0static inline void kexec_early_calculations (void ) {} -static inline void kexec_crash (void ) {} +static inline void kexec_crash (enum crash_reason reason) +{ +keyhandler_crash_action (reason); +}
... if this is to be an inline function and not just a #define, it'll need the declaration of the function to have been seen.
Jan
Quoted 9 lines · Jan Beulich
Quoted 7 lines · Juergen Gross
When the host crashes it would sometimes be nice to have additional debug data available which could be produced via debug keys, but halting the server for manual intervention might be impossible due to the need to reboot/kexec rather sooner than later.
Add support for automatic debug key actions in case of crashes which can be activated via boot- or runtime-parameter.
Quoted 7 lines
While I can certainly see this possibly being a useful thing in certain situations, I'm uncertain it's going to be helpful in at least a fair set of cases. What output to request very much depends on the nature of the problem one is running into, and the more keys one adds "just in case", the longer the reboot latency, and the higher the risk (see also below) of the output generation actually causing further problems.
The obvious case is a watchdog induced crash: at least 2 sets of dom0 state will help in many cases.
Quoted 12 lines
IOW I'm neither fully convinced that we want this, nor fully opposed.
Quoted 9 lines
Depending on the type of crash the desired data might be different, so support different settings for the possible types of crashes.
The parameter is "crash-debug" with the following syntax:
crash-debug-<type>=<string>with <type> being one of:
Quoted 7 lines
Quoted 4 lines
panic, hwdom, watchdog, kexeccmd, debugkey
and <string> a sequence of debug key characters with '.' having the special semantics of a 1 second pause.
1 second is a whole lot of time. To get two successive sets of data, a much shorter delay (if any) would normally suffice.
Yes, I'd be fine to trade that for a shorter period of time.
Quoted 6 lines
Also, while '.' may seem like a good choice right now, with the shortage of characters we may want to put a real handler behind it at come point. The one character that clearly won't make much sense to use in this context is 'h', but that's awful as a (kind of) separator. Could we perhaps replace 'h' by '?', freeing up 'h' and allowing '?' to be used for this purpose here?
Fine with me. Another possibility would be to add '\' as an escape character with '\.' meaning "debug-key .".
Quoted 25 lines
Quoted 25 lines
docs/misc/xen-command-line.pandoc +19
-0@@ -574,6 +574,29 @@ reduction of features at Xen's disposal to manage guests. ### cpuinfo (x86) > `= <boolean>` +### crash-debug-debugkey +### crash-debug-hwdom +### crash-debug-kexeccmd +### crash-debug-panic +### crash-debug-watchdog +> `= <string>` + +> Can be modified at runtime + +Specify debug-key actions in cases of crashes. Each of the parameters applies +to a different crash reason. The `<string>` is a sequence of debug key +characters, with `.` having the special meaning of a 1 second pause. + +So e.g. `crash-debug-watchdog=0.0r` would dump dom0 state twice with a +second between the two state dumps, followed by the run queues of the +hypervisor, if the system crashes due to a watchdog timeout. + +These parameters should be used carefully, as e.g. specifying +`crash-debug-debugkey=C` would result in an endless loop. Depending on the
Quoted 8 lines
docs/misc/xen-command-line.pandoc reduction of features at Xen's disposal to manage guests. · line 598
Quoted 3 lines
docs/misc/xen-command-line.pandoc +3
-0+reason of the system crash it might happen that triggering some debug key +action will result in a hang instead of dumping data and then doing a +reboot or crash dump.I think it would be useful if the flavors were (briefly)
explained: At the very least "debugkey" doesn't directly fit "in cases of crashes", as there's no crash involved.kexec_crash()instead gets invoked without there having been any crash.
Yes, and having some additional state generate for this case might help diagnosis.
Quoted 6 lines
You may also want to point out that this is a best effort thing only - system state at the point of a crash may be such that the attempt of handling one or the debug keys would have further bad effects on the system, including that the actual kexec may then never occur.
True.
Quoted 30 lines
Quoted 15 lines
docs/misc/xen-command-line.pandoc +10
-0@@ -507,6 +509,41 @@ void __init initialize_keytable(void) } } +#define CRASHACTION_SIZE 32 +static char crash_debug_panic[CRASHACTION_SIZE]; +static char crash_debug_hwdom[CRASHACTION_SIZE]; +static char crash_debug_watchdog[CRASHACTION_SIZE]; +static char crash_debug_kexeccmd[CRASHACTION_SIZE]; +static char crash_debug_debugkey[CRASHACTION_SIZE]; + +static char *crash_action[CRASHREASON_N] = { + [CRASHREASON_PANIC] = crash_debug_panic, + [CRASHREASON_HWDOM] = crash_debug_hwdom,docs/misc/xen-command-line.pandoc void __init initialize_keytable(void) · line 531
Quoted 10 lines
docs/misc/xen-command-line.pandoc +10
-0+ [CRASHREASON_WATCHDOG] = crash_debug_watchdog, + [CRASHREASON_KEXECCMD] = crash_debug_kexeccmd, + [CRASHREASON_DEBUGKEY] = crash_debug_debugkey, +}; + +string_runtime_param("crash-debug-panic", crash_debug_panic); +string_runtime_param("crash-debug-hwdom", crash_debug_hwdom); +string_runtime_param("crash-debug-watchdog", crash_debug_watchdog); +string_runtime_param("crash-debug-kexeccmd", crash_debug_kexeccmd); +string_runtime_param("crash-debug-debugkey", crash_debug_debugkey);In general I'm not in favor of this (or similar) needing five new command line options, instead of just one. The problem with e.g.
Quoted 8 lines
crash-debug=panic:rq,watchdog:0d
is that ',' (or any other separator chosen) could in principle also be a debug key. It would still be possible to use
crash-debug=panic:rq crash-debug=watchdog:0d
though. Thoughts?
OTOH the runtime parameters are much easier addressable that way.
Quoted 9 lines
docs/misc/xen-command-line.pandoc void __init initialize_keytable(void) · line 537
Quoted 7 lines
docs/misc/xen-command-line.pandoc +6
-0+void keyhandler_crash_action(enum crash_reason reason) +{ + const char *action = crash_action[reason]; + struct cpu_user_regs *regs = get_irq_regs() ? : guest_cpu_user_regs(); + + while ( *action ) {Misplaced brace.
Will fix.
Quoted 10 lines
docs/misc/xen-command-line.pandoc void __init initialize_keytable(void) · line 544
Quoted 8 lines
docs/misc/xen-command-line.pandoc +7
-0+ if ( *action == '.' ) + mdelay(1000); + else + handle_keypress(*action, regs); + action++; + } +}I think only diagnostic keys should be permitted here.
While I understand that other keys could produce nonsense or do harm, I'm not sure we should really prohibit them. Allowing them would e.g. allow to do just a reboot without kdump for one type of crashes.
Quoted 15 lines
xen/include/xen/kexec.h line 4
Quoted 8 lines
xen/include/xen/kexec.h +1
-0@@ -1,6 +1,8 @@#ifndef __XEN_KEXEC_H__#define __XEN_KEXEC_H__ +#include <xen/keyhandler.h> Could we go without this, utilizing the gcc extension of forward declared enums? Otoh ...
Quoted 3 lines
xen/include/xen/kexec.h +0
-0@@ -82,7 +84,11 @@ void vmcoreinfo_append_str(const char *fmt, ...)#define kexecing 0
Quoted 9 lines
xen/include/xen/kexec.h void vmcoreinfo_append_str(const char *fmt, ...) · line 90
Quoted 6 lines
xen/include/xen/kexec.h +4
-1static inline void kexec_early_calculations (void ) {} -static inline void kexec_crash (void ) {} +static inline void kexec_crash (enum crash_reason reason) +{ +keyhandler_crash_action (reason); +}... if this is to be an inline function and not just a #define, it'll need the declaration of the function to have been seen.
And even being a #define all users of kexec_crash() would need to #include keyhandler.h (and I'm not sure there are any source files including kexec.h which don't use kexec_crash()).
Juergen
Quoted 33 lines · Jürgen Groß
Quoted 32 lines · Jan Beulich
Quoted 14 lines · Juergen Gross
xen/common/keyhandler.c +10
-0@@ -507,6 +509,41 @@ void __init initialize_keytable(void) } } +#define CRASHACTION_SIZE 32 +static char crash_debug_panic[CRASHACTION_SIZE ]; +static char crash_debug_hwdom[CRASHACTION_SIZE ]; +static char crash_debug_watchdog[CRASHACTION_SIZE ]; +static char crash_debug_kexeccmd[CRASHACTION_SIZE ]; +static char crash_debug_debugkey[CRASHACTION_SIZE ]; + +static char *crash_action[CRASHREASON_N ] = { + [CRASHREASON_PANIC ] = crash_debug_panic, + [CRASHREASON_HWDOM ] = crash_debug_hwdom,xen/common/keyhandler.c void __init initialize_keytable(void) · line 531
Quoted 10 lines
xen/common/keyhandler.c +10
-0+ [CRASHREASON_WATCHDOG] = crash_debug_watchdog, + [CRASHREASON_KEXECCMD] = crash_debug_kexeccmd, + [CRASHREASON_DEBUGKEY ] = crash_debug_debugkey, +}; + +string_runtime_param ("crash-debug-panic" , crash_debug_panic); +string_runtime_param ("crash-debug-hwdom" , crash_debug_hwdom); +string_runtime_param ("crash-debug-watchdog" , crash_debug_watchdog); +string_runtime_param ("crash-debug-kexeccmd" , crash_debug_kexeccmd); +string_runtime_param ("crash-debug-debugkey" , crash_debug_debugkey);In general I'm not in favor of this (or similar) needing five new command line options, instead of just one. The problem with e.g.
crash-debug=panic:rq,watchdog:0d
Quoted 8 lines
Quoted 6 lines
is that ',' (or any other separator chosen) could in principle also be a debug key. It would still be possible to use
crash-debug=panic:rq crash-debug=watchdog:0d
though. Thoughts?
OTOH the runtime parameters are much easier addressable that way.
Ah yes, I can see this as a reason. Would make we wonder whether command line and runtime handling may want disconnecting in this specific case then. (But I can also see the argument of this being too much overhead then.)
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
xen/common/keyhandler.c +7
-0+void keyhandler_crash_action (enum crash_reason reason) +{ +const char *action = crash_action[reason]; +struct cpu_user_regs *regs =get_irq_regs () ? :guest_cpu_user_regs (); + +while ( *action ) { +if ( *action =='.' )Quoted 8 lines
xen/common/keyhandler.c void __init initialize_keytable(void) · line 545
Quoted 6 lines
xen/common/keyhandler.c +6
-0+mdelay (1000 ); + else + handle_keypress(*action, regs); + action++; + } +}I think only diagnostic keys should be permitted here.
Quoted 3 lines
While I understand that other keys could produce nonsense or do harm, I'm not sure we should really prohibit them. Allowing them would e.g. allow to do just a reboot without kdump for one type of crashes.
Ah yes, that's a fair point.
Quoted 24 lines
Quoted 14 lines
xen/include/xen/kexec.h line 4
Quoted 7 lines
xen/include/xen/kexec.h +1
-0@@ -1,6 +1,8 @@#ifndef __XEN_KEXEC_H__#define __XEN_KEXEC_H__ +#include <xen/keyhandler.h> Could we go without this, utilizing the gcc extension of forward declared enums? Otoh ...
Quoted 3 lines
xen/include/xen/kexec.h +0
-0@@ -82,7 +84,11 @@ void vmcoreinfo_append_str(const char *fmt, ...)#define kexecing 0Quoted 9 lines
xen/include/xen/kexec.h void vmcoreinfo_append_str(const char *fmt, ...) · line 90
Quoted 6 lines
xen/include/xen/kexec.h +4
-1static inline void kexec_early_calculations (void ) {} -static inline void kexec_crash (void ) {} +static inline void kexec_crash (enum crash_reason reason) +{ +keyhandler_crash_action (reason); +}... if this is to be an inline function and not just a #define, it'll need the declaration of the function to have been seen.
Quoted 3 lines
And even being a #define all users of
kexec_crash()would need to #includekeyhandler.h(and I'm not sure there are any source files includingkexec.hwhich don't usekexec_crash()).
About as many which do as ones which don't. But there's no generally accessible header which includes xen/kexec.h, so perhaps the extra dependency indeed isn't all this problematic.
Jan
Quoted 94 lines · Jan Beulich
Quoted 33 lines · Jürgen Groß
Quoted 32 lines · Jan Beulich
Quoted 14 lines · Juergen Gross
xen/common/keyhandler.c +10
-0@@ -507,6 +509,41 @@ void __init initialize_keytable(void) } } +#define CRASHACTION_SIZE 32 +static char crash_debug_panic[CRASHACTION_SIZE ]; +static char crash_debug_hwdom[CRASHACTION_SIZE ]; +static char crash_debug_watchdog[CRASHACTION_SIZE ]; +static char crash_debug_kexeccmd[CRASHACTION_SIZE ]; +static char crash_debug_debugkey[CRASHACTION_SIZE ]; + +static char *crash_action[CRASHREASON_N ] = { + [CRASHREASON_PANIC ] = crash_debug_panic, + [CRASHREASON_HWDOM ] = crash_debug_hwdom,xen/common/keyhandler.c void __init initialize_keytable(void) · line 531
Quoted 10 lines
xen/common/keyhandler.c +10
-0+ [CRASHREASON_WATCHDOG] = crash_debug_watchdog, + [CRASHREASON_KEXECCMD] = crash_debug_kexeccmd, + [CRASHREASON_DEBUGKEY ] = crash_debug_debugkey, +}; + +string_runtime_param ("crash-debug-panic" , crash_debug_panic); +string_runtime_param ("crash-debug-hwdom" , crash_debug_hwdom); +string_runtime_param ("crash-debug-watchdog" , crash_debug_watchdog); +string_runtime_param ("crash-debug-kexeccmd" , crash_debug_kexeccmd); +string_runtime_param ("crash-debug-debugkey" , crash_debug_debugkey);In general I'm not in favor of this (or similar) needing five new command line options, instead of just one. The problem with e.g.
crash-debug=panic:rq,watchdog:0d
Quoted 8 lines
Quoted 6 lines
is that ',' (or any other separator chosen) could in principle also be a debug key. It would still be possible to use
crash-debug=panic:rq crash-debug=watchdog:0d
though. Thoughts?
OTOH the runtime parameters are much easier addressable that way.
Ah yes, I can see this as a reason. Would make we wonder whether command line and runtime handling may want disconnecting in this specific case then. (But I can also see the argument of this being too much overhead then.)
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
xen/common/keyhandler.c +7
-0+void keyhandler_crash_action (enum crash_reason reason) +{ +const char *action = crash_action[reason]; +struct cpu_user_regs *regs =get_irq_regs () ? :guest_cpu_user_regs (); + +while ( *action ) { +if ( *action =='.' )Quoted 8 lines
xen/common/keyhandler.c void __init initialize_keytable(void) · line 545
Quoted 6 lines
xen/common/keyhandler.c +6
-0+mdelay (1000 ); + else + handle_keypress(*action, regs); + action++; + } +}I think only diagnostic keys should be permitted here.
Quoted 3 lines
While I understand that other keys could produce nonsense or do harm, I'm not sure we should really prohibit them. Allowing them would e.g. allow to do just a reboot without kdump for one type of crashes.
Ah yes, that's a fair point.
Quoted 24 lines
Quoted 23 lines
xen/include/xen/kexec.h line 4
Quoted 7 lines
xen/include/xen/kexec.h +1
-0@@ -1,6 +1,8 @@#ifndef __XEN_KEXEC_H__#define __XEN_KEXEC_H__ +#include <xen/keyhandler.h> Could we go without this, utilizing the gcc extension of forward declared enums? Otoh ...
xen/include/xen/kexec.h void vmcoreinfo_append_str(const char *fmt, ...) · line 90
Quoted 9 lines
xen/include/xen/kexec.h +4
-1@@ -82,7 +84,11 @@ void vmcoreinfo_append_str(const char *fmt, ...)#define kexecing 0static inline void kexec_early_calculations (void ) {} -static inline void kexec_crash (void ) {} +static inline void kexec_crash (enum crash_reason reason) +{ +keyhandler_crash_action (reason); +}... if this is to be an inline function and not just a #define, it'll need the declaration of the function to have been seen.
Quoted 7 lines
Quoted 3 lines
And even being a #define all users of
kexec_crash()would need to #includekeyhandler.h(and I'm not sure there are any source files includingkexec.hwhich don't usekexec_crash()).About as many which do as ones which don't. But there's no generally accessible header which includes
xen/kexec.h, so perhaps the extra dependency indeed isn't all this problematic.
Any further comments, or even better, Acks?
Juergen
Quoted 1 line · Jürgen Groß
Any further comments, or even better, Acks?
To be honest I'd prefer to have at least one of the people Cc-ed minimally indicate they consider this a good idea. No need for a close review or such, just a basic opinion. Anyone?
Jan
Quoted 6 lines · Jan Beulich
Quoted 1 line · Jürgen Groß
Any further comments, or even better, Acks?
To be honest I'd prefer to have at least one of the people Cc-ed minimally indicate they consider this a good idea. No need for a close review or such, just a basic opinion. Anyone?
I see Jan's point that it is not clear how much this is going to help in production. However, it is not going to hurt either, and I have been told a few times recently that debugging Xen is not easy. Anything that helps in that regard would be good. So I think this patch would be an improvement.
Quoted 8 lines · Stefano Stabellini
Quoted 6 lines · Jan Beulich
Quoted 1 line · Jürgen Groß
Any further comments, or even better, Acks?
To be honest I'd prefer to have at least one of the people Cc-ed minimally indicate they consider this a good idea. No need for a close review or such, just a basic opinion. Anyone?
Quoted 6 lines
I see Jan's point that it is not clear how much this is going to help in production. However, it is not going to hurt either, and I have been told a few times recently that debugging Xen is not easy. Anything that helps in that regard would be good. So I think this patch would be an improvement.
This patch is an effort to get better diagnostic data in case of Xen crashes from our largest customer, so clearly intended for production use.
Juergen
Hi,
Quoted 16 lines · Jürgen Groß
Quoted 8 lines · Stefano Stabellini
Quoted 6 lines · Jan Beulich
Quoted 1 line · Jürgen Groß
Any further comments, or even better, Acks?
To be honest I'd prefer to have at least one of the people Cc-ed minimally indicate they consider this a good idea. No need for a close review or such, just a basic opinion. Anyone?
Quoted 6 lines
I see Jan's point that it is not clear how much this is going to help in production. However, it is not going to hurt either, and I have been told a few times recently that debugging Xen is not easy. Anything that helps in that regard would be good. So I think this patch would be an improvement.
Quoted 4 lines
This patch is an effort to get better diagnostic data in case of Xen crashes from our largest customer, so clearly intended for production use.
I agree with this statement. When you get a crash from Xen in production, it can be useful to get as much information as possible dumped. Some of the information printed by the debugkeys cannot be retrieved from a crashkernel.
Cheers,
Signature · 1 line
Julien Grall
Quoted 22 lines · Julien Grall
Quoted 16 lines · Jürgen Groß
Quoted 8 lines · Stefano Stabellini
Quoted 6 lines · Jan Beulich
Quoted 1 line · Jürgen Groß
Any further comments, or even better, Acks?
To be honest I'd prefer to have at least one of the people Cc-ed minimally indicate they consider this a good idea. No need for a close review or such, just a basic opinion. Anyone?
Quoted 6 lines
I see Jan's point that it is not clear how much this is going to help in production. However, it is not going to hurt either, and I have been told a few times recently that debugging Xen is not easy. Anything that helps in that regard would be good. So I think this patch would be an improvement.
Quoted 4 lines
This patch is an effort to get better diagnostic data in case of Xen crashes from our largest customer, so clearly intended for production use.
Quoted 4 lines
I agree with this statement. When you get a crash from Xen in production, it can be useful to get as much information as possible dumped. Some of the information printed by the debugkeys cannot be retrieved from a crashkernel.
So, Jürgen, my request was satisfied, so all that's needed is, I suppose, a re-submission with the few smaller items addressed.
Jan