xen: make keyhanler configurable
PATCH 1/1 xen: make keyhanler configurable
keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console.
--- xen/arch/arm/gic.c | 2 ++ xen/arch/x86/apic.c | 2 ++ xen/common/Kconfig | 9 +++++++++ xen/common/Makefile | 2 +- xen/common/cpupool.c | 2 ++ xen/common/schedule.c | 2 ++ xen/include/xen/keyhandler.h | 14 ++++++++++++++ xen/include/xen/lib.h | 2 ++ xen/include/xen/sched.h | 2 ++ 9 files changed, 36 insertions(+), 1 deletion(-)
xen/arch/arm/gic.c +2 -0
@@ -361,7 +361,9 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)/* Nothing to do, will check for events on return path */ break ;case GIC_SGI_DUMP_STATE : +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate (regs); +#endif break ;case GIC_SGI_CALL_FUNCTION :smp_call_function_interrupt ();
xen/arch/x86/apic.c +2 -0
@@ -1410,7 +1410,9 @@ void spurious_interrupt(struct cpu_user_regs *regs)ack_APIC_irq ();if (this_cpu (state_dump_pending)) {this_cpu (state_dump_pending) = false; +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate (regs); +#endif return ; } }
xen/common/Kconfig +9 -0
@@ -368,4 +368,13 @@ config DOM0_MEM Leave empty if you are not sure what to specify. +config HAS_KEYHANDLER + bool "Enable/Disable keyhandler" + default y + ---help--- + Enable or disable keyhandler function. + keyhandler mainly used for debug usage by developers which can dump + xen module(eg. timer, scheduler) status at runtime by input character + from console. + endmenu
xen/common/Makefile +1 -1
@@ -16,7 +16,7 @@ obj-y += guestcopy.o obj-bin-y += gunzip.init.o obj-y += irq.o obj-y += kernel.o -obj-y += keyhandler.o +obj-$(CONFIG_HAS_KEYHANDLER) += keyhandler.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_KEXEC) += kimage.o obj-y += lib.o
xen/common/cpupool.c +2 -0
@@ -699,6 +699,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)return ret; } +#ifdef CONFIG_HAS_KEYHANDLER void dump_runq (unsigned char key) {unsigned long flags;
@@ -730,6 +731,7 @@ void dump_runq(unsigned char key)local_irq_restore (flags); spin_unlock(&cpupool_lock); } +#endif static int cpu_callback (struct notifier_block *nfb,unsigned long action,void *hcpu)
xen/common/schedule.c +2 -0
@@ -1913,6 +1913,7 @@ void scheduler_free(struct scheduler *sched)xfree (sched); } +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c) {unsigned int i;
@@ -1941,6 +1942,7 @@ void schedule_dump(struct cpupool *c) SCHED_OP(sched, dump_cpu_state, i); } } +#endif void sched_tick_suspend (void ) {
xen/include/xen/keyhandler.h +14 -0
@@ -28,6 +28,7 @@ struct cpu_user_regs;typedef void (irq_keyhandler_fn_t )(unsigned char key,struct cpu_user_regs *regs); +#ifdef CONFIG_HAS_KEYHANDLER /* Initialize keytable with default handlers. */ void initialize_keytable (void );
@@ -48,4 +49,17 @@ 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); +#else +static inline void initialize_keytable (void ) {} +static inline void register_keyhandler (unsigned char key,keyhandler_fn_t *fn, +const char *desc,bool_t diagnostic) {} +static inline void register_irq_keyhandler (unsigned char key, +irq_keyhandler_fn_t *fn, +const char *desc, +bool_t diagnostic) {} + +static inline void handle_keypress (unsigned char key, +struct cpu_user_regs *regs) {} +#endif +#endif /* __XEN_KEYHANDLER_H__ */
xen/include/xen/lib.h +2 -0
@@ -171,8 +171,10 @@ extern unsigned int tainted;extern char *print_tainted (char *str);extern void add_taint (unsigned int taint); +#ifdef CONFIG_HAS_KEYHANDLER struct cpu_user_regs ;void dump_execstate (struct cpu_user_regs *); +#endif void init_constructors (void );
xen/include/xen/sched.h +2 -0
@@ -994,8 +994,10 @@ int cpupool_add_domain(struct domain *d, int poolid);void cpupool_rm_domain (struct domain *d);int cpupool_move_domain (struct domain *d,struct cpupool *c);int cpupool_do_sysctl (struct xen_sysctl_cpupool_op *op); +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c);extern void dump_runq (unsigned char key); +#endif void arch_do_physinfo (struct xen_sysctl_physinfo *pi);
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 23 lines · Baodong Chen
keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console.
Signed-off-by Baodong Chen <[email protected]>---
xen/common/Kconfig +6
-0@@ -368,4 +368,13 @@ config DOM0_MEM Leave empty if you are not sure what to specify. +config HAS_KEYHANDLER + bool "Enable/Disable keyhandler" + default y + ---help--- + Enable or disable keyhandler function. + keyhandler mainly used for debug usage by developers whichcan dump
xen/common/Kconfig +1
-0+ xen module(eg. timer, scheduler) status at runtime by inputcharacter
xen/common/Kconfig config DOM0_MEM · line 380
Quoted 3 lines
xen/common/Kconfig +2
-0+ from console. + endmenu
I personally like the idea.
I've probably would have called the option CONFIG_KEYHANDLERS, even if I can see that we have quite a few CONFIG_HAS_*.
But it's not for me to ask/decide, and I don't have a too strong opinion on this anyway, so let's hear what others think.
I'd at least add the 'S', though (as in CONFIG_HAS_KEYHANDLERS).
Quoted 31 lines
xen/common/cpupool.c +1
-0@@ -699,6 +699,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)return ret; } +#ifdef CONFIG_HAS_KEYHANDLER void dump_runq (unsigned char key) {unsigned long flags;xen/common/cpupool.c +1
-0@@ -730,6 +731,7 @@ void dump_runq(unsigned char key)local_irq_restore (flags); spin_unlock(&cpupool_lock); } +#endif static int cpu_callback (struct notifier_block *nfb,unsigned long action,void *hcpu)xen/common/schedule.c +1
-0@@ -1913,6 +1913,7 @@ void scheduler_free(struct scheduler *sched)xfree (sched); } +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c) {unsigned int i;
xen/common/schedule.c void schedule_dump(struct cpupool *c) · line 1948
Quoted 7 lines
xen/common/schedule.c +1
-0@@ -1941,6 +1942,7 @@ void schedule_dump(struct cpupool *c) SCHED_OP(sched, dump_cpu_state, i); } } +#endif void sched_tick_suspend (void ) {
Mmm... a lot of #ifdef-fery spread around quite a bit.. I have to admit I don't especially like that.
Quoted 14 lines
xen/include/xen/keyhandler.h +3
-0@@ -48,4 +49,17 @@ 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); +#else +static inline void initialize_keytable (void ) {} +static inline void register_keyhandler(unsigned char key,
keyhandler_fn_t*fn,
+ const char *desc,bool_t
diagnostic) {}
xen/include/xen/keyhandler.h void register_irq_keyhandler(unsigned char key, · line 62
Quoted 7 lines
xen/include/xen/keyhandler.h +7
-0+static inline void register_irq_keyhandler (unsigned char key, +irq_keyhandler_fn_t *fn, +const char *desc, +bool_t diagnostic) {} + +static inline void handle_keypress (unsigned char key, +struct cpu_user_regs *regs) {}
So, with this last change, we have:
static DECLARE_TASKLET(keypress_tasklet, keypress_action, 0);
But since all keypress_action() does is calling handle_keypress(), which is becoming a nop... can't we kill the tasklet alltogether?
xen/include/xen/lib.h extern unsigned int tainted; · line 178
Quoted 11 lines
xen/include/xen/lib.h +2
-0@@ -171,8 +171,10 @@ extern unsigned int tainted;extern char *print_tainted (char *str);extern void add_taint (unsigned int taint); +#ifdef CONFIG_HAS_KEYHANDLER struct cpu_user_regs ;void dump_execstate (struct cpu_user_regs *); +#endif
Yes. Or, you provide an empty stub of dump_execstate(), if CONFIG_HAS_KEYHANDLER is not defined, which means we don't have to mess with #ifdef-s at the caller site(s).
Of course, I'm not maintainer of this specific piece of code, but I'd prefer this stub-based approach to be used in general.... ... ...
Quoted 4 lines
xen/include/xen/sched.h int cpupool_add_domain(struct domain *d, int · line 1003
Quoted 10 lines
xen/include/xen/sched.h +2
-0@@ -994,8 +994,10 @@ int cpupool_add_domain(struct domain *d, int poolid);void cpupool_rm_domain (struct domain *d);int cpupool_move_domain (struct domain *d,struct cpupool *c);int cpupool_do_sysctl (struct xen_sysctl_cpupool_op *op); +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c);extern void dump_runq (unsigned char key); +#endif void arch_do_physinfo (struct xen_sysctl_physinfo *pi);
... ... ... Like, for instance, in here.
But again, sine these changes are spread around many files, let's see what others prefer, and use the same strategy everywhere.
Regards
Signature · 6 lines
Dario Faggioli, Ph.D http://about.me/dario.faggioli Virtualization Software Engineer SUSE Labs, SUSE https://www.suse.com/ ------------------------------------------------------------------- <<This happens because _I_ choose it to happen!>> (Raistlin Majere)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 28 lines · Dario Faggioli
Quoted 22 lines · Baodong Chen
keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console.
Signed-off-by Baodong Chen <[email protected]>---
xen/common/Kconfig +6
-0@@ -368,4 +368,13 @@ config DOM0_MEM Leave empty if you are not sure what to specify. +config HAS_KEYHANDLER + bool "Enable/Disable keyhandler" + default y + ---help--- + Enable or disable keyhandler function. + keyhandler mainly used for debug usage by developers whichcan dump
xen/common/Kconfig +1
-0+ xen module(eg. timer, scheduler) status at runtime by inputcharacter
xen/common/Kconfig config DOM0_MEM · line 380
Quoted 3 lines
xen/common/Kconfig +2
-0+ from console. + endmenuI personally like the idea.
Quoted 7 lines
I've probably would have called the option
CONFIG_KEYHANDLERS, even if I can see that we have quite a few CONFIG_HAS_*.But it's not for me to ask/decide, and I don't have a too strong opinion on this anyway, so let's hear what others think.
I'd at least add the 'S', though (as in
CONFIG_HAS_KEYHANDLERS).
Yes, can be fixed.
Quoted 36 lines
Quoted 36 lines
xen/common/cpupool.c +1
-0@@ -699,6 +699,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)return ret; } +#ifdef CONFIG_HAS_KEYHANDLER void dump_runq (unsigned char key) {unsigned long flags;xen/common/cpupool.c +1
-0@@ -730,6 +731,7 @@ void dump_runq(unsigned char key)local_irq_restore (flags); spin_unlock(&cpupool_lock); } +#endif static int cpu_callback (struct notifier_block *nfb,unsigned long action,void *hcpu)xen/common/schedule.c +2
-0@@ -1913,6 +1913,7 @@ void scheduler_free(struct scheduler *sched)xfree (sched); } +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c) {unsigned int i;@@ -1941,6 +1942,7 @@ void schedule_dump(struct cpupool *c) SCHED_OP(sched, dump_cpu_state, i); } } +#endif
Quoted 4 lines
xen/common/schedule.c void schedule_dump(struct cpupool *c) · line 1948
Quoted 2 lines
xen/common/schedule.c +0
-0void sched_tick_suspend (void ) {Mmm... a lot of #ifdef-fery spread around quite a bit.. I have to admit I don't especially like that.
Me too, can leave it as what is was.
but since schedule_dump prototype have external linkage.
so even no one will call it, it maybe still in output executable file, right?
Quoted 23 lines
Quoted 14 lines
xen/include/xen/keyhandler.h +3
-0@@ -48,4 +49,17 @@ 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); +#else +static inline void initialize_keytable (void ) {} +static inline void register_keyhandler(unsigned char key,
keyhandler_fn_t*fn,
+ const char *desc,bool_t
diagnostic) {}xen/include/xen/keyhandler.h void register_irq_keyhandler(unsigned char key, · line 62
Quoted 7 lines
xen/include/xen/keyhandler.h +7
-0+static inline void register_irq_keyhandler (unsigned char key, +irq_keyhandler_fn_t *fn, +const char *desc, +bool_t diagnostic) {} + +static inline void handle_keypress (unsigned char key, +struct cpu_user_regs *regs) {}So, with this last change, we have:
Quoted 4 lines
static
DECLARE_TASKLET(keypress_tasklet, keypress_action, 0);But since all
keypress_action()does is callinghandle_keypress(), which is becoming a nop... can't we kill the tasklet alltogether?
the whole keyhandler.c will not compiled when config disabled.
am i misunderstood something?
Quoted 16 lines
xen/include/xen/lib.h extern unsigned int tainted; · line 178
Quoted 12 lines
xen/include/xen/lib.h +2
-0@@ -171,8 +171,10 @@ extern unsigned int tainted;extern char *print_tainted (char *str);extern void add_taint (unsigned int taint); +#ifdef CONFIG_HAS_KEYHANDLER struct cpu_user_regs ;void dump_execstate (struct cpu_user_regs *); +#endif Yes. Or, you provide an empty stub of
dump_execstate(), ifCONFIG_HAS_KEYHANDLERis not defined, which means we don't have to mess with #ifdef-s at the caller site(s).
Quoted 2 lines
Of course, I'm not maintainer of this specific piece of code, but I'd prefer this stub-based approach to be used in general.... ... ...
Agree, can be fixed.
Quoted 13 lines
Quoted 13 lines
xen/include/xen/sched.h +2
-0@@ -994,8 +994,10 @@ int cpupool_add_domain(struct domain *d, int poolid);void cpupool_rm_domain (struct domain *d);int cpupool_move_domain (struct domain *d,struct cpupool *c);int cpupool_do_sysctl (struct xen_sysctl_cpupool_op *op); +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c);extern void dump_runq (unsigned char key); +#endif
Quoted 8 lines
xen/include/xen/sched.h int cpupool_add_domain(struct domain *d, int poolid); · line 1002
Quoted 2 lines
xen/include/xen/sched.h +0
-0void arch_do_physinfo (struct xen_sysctl_physinfo *pi);... ... ... Like, for instance, in here.
But again, sine these changes are spread around many files, let's see what others prefer, and use the same strategy everywhere.
Regards
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 50 lines · Baodong Chen
keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console.
Signed-off-by Baodong Chen <[email protected]>--- xen/arch/arm/gic.c | 2 ++ xen/arch/x86/apic.c | 2 ++ xen/common/Kconfig | 9 +++++++++ xen/common/Makefile | 2 +- xen/common/cpupool.c | 2 ++ xen/common/schedule.c | 2 ++ xen/include/xen/keyhandler.h | 14 ++++++++++++++ xen/include/xen/lib.h | 2 ++ xen/include/xen/sched.h | 2 ++ 9 files changed, 36 insertions(+), 1 deletion(-)xen/arch/arm/gic.c +2
-0@@ -361,7 +361,9 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)/* Nothing to do, will check for events on return path */ break ;case GIC_SGI_DUMP_STATE : +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate (regs); +#endif break ;case GIC_SGI_CALL_FUNCTION :smp_call_function_interrupt ();xen/arch/x86/apic.c +2
-0@@ -1410,7 +1410,9 @@ void spurious_interrupt(struct cpu_user_regs *regs)ack_APIC_irq ();if (this_cpu (state_dump_pending)) {this_cpu (state_dump_pending) = false; +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate (regs); +#endif return ; } }xen/common/Kconfig +0
-0
xen/common/Kconfig config DOM0_MEM · line 371
Quoted 4 lines
xen/common/Kconfig +1
-0@@ -368,4 +368,13 @@ config DOM0_MEM Leave empty if you are not sure what to specify. +config HAS_KEYHANDLER
AFAIK the HAS_* config options are meant to be selected by other options and not be user selectable.
So I think you should drop the "HAS_" and maybe use the plural as Dario already suggested ("KEYHANDLERS").
xen/common/Kconfig config DOM0_MEM · line 378
Quoted 7 lines
xen/common/Kconfig +7
-0+ bool "Enable/Disable keyhandler" + default y + ---help--- + Enable or disable keyhandler function. + keyhandler mainly used for debug usage by developers which can dump + xen module(eg. timer, scheduler) status at runtime by input character + from console.
I'd drop the "by developers". In case of customer problems with Xen hosts the output of keyhandlers is requested on a rather regular base.
Quoted 105 lines
xen/common/Kconfig +1
-0+ endmenuxen/common/Makefile +1
-1@@ -16,7 +16,7 @@ obj-y += guestcopy.o obj-bin-y += gunzip.init.o obj-y += irq.o obj-y += kernel.o -obj-y += keyhandler.o +obj-$(CONFIG_HAS_KEYHANDLER) += keyhandler.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_KEXEC) += kimage.o obj-y += lib.oxen/common/cpupool.c +2
-0@@ -699,6 +699,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)return ret; } +#ifdef CONFIG_HAS_KEYHANDLER void dump_runq (unsigned char key) {unsigned long flags;@@ -730,6 +731,7 @@ void dump_runq(unsigned char key)local_irq_restore (flags); spin_unlock(&cpupool_lock); } +#endif static int cpu_callback (struct notifier_block *nfb,unsigned long action,void *hcpu)xen/common/schedule.c +2
-0@@ -1913,6 +1913,7 @@ void scheduler_free(struct scheduler *sched)xfree (sched); } +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c) {unsigned int i;@@ -1941,6 +1942,7 @@ void schedule_dump(struct cpupool *c) SCHED_OP(sched, dump_cpu_state, i); } } +#endif void sched_tick_suspend (void ) {xen/include/xen/keyhandler.h +14
-0@@ -28,6 +28,7 @@ struct cpu_user_regs;typedef void (irq_keyhandler_fn_t )(unsigned char key,struct cpu_user_regs *regs); +#ifdef CONFIG_HAS_KEYHANDLER /* Initialize keytable with default handlers. */ void initialize_keytable (void );@@ -48,4 +49,17 @@ 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); +#else +static inline void initialize_keytable (void ) {} +static inline void register_keyhandler (unsigned char key,keyhandler_fn_t *fn, +const char *desc,bool_t diagnostic) {} +static inline void register_irq_keyhandler (unsigned char key, +irq_keyhandler_fn_t *fn, +const char *desc, +bool_t diagnostic) {} + +static inline void handle_keypress (unsigned char key, +struct cpu_user_regs *regs) {} +#endif +#endif /* __XEN_KEYHANDLER_H__ */ xen/include/xen/lib.h +2
-0@@ -171,8 +171,10 @@ extern unsigned int tainted;extern char *print_tainted (char *str);extern void add_taint (unsigned int taint); +#ifdef CONFIG_HAS_KEYHANDLER struct cpu_user_regs ;void dump_execstate (struct cpu_user_regs *); +#endif void init_constructors (void );xen/include/xen/sched.h +0
-0
xen/include/xen/sched.h int cpupool_add_domain(struct domain *d, int poolid); · line 1002
Quoted 9 lines
xen/include/xen/sched.h +2
-0@@ -994,8 +994,10 @@ int cpupool_add_domain(struct domain *d, int poolid);void cpupool_rm_domain (struct domain *d);int cpupool_move_domain (struct domain *d,struct cpupool *c);int cpupool_do_sysctl (struct xen_sysctl_cpupool_op *op); +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c);extern void dump_runq (unsigned char key); +#endif void arch_do_physinfo (struct xen_sysctl_physinfo *pi);
Why stopping halfway here? There are lots of other keyhandlers which can be removed for the hypervisor in case there is no code calling them.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 52 lines · Juergen Gross
Quoted 51 lines · Baodong Chen
keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console.
Signed-off-by Baodong Chen <[email protected]>--- xen/arch/arm/gic.c | 2 ++ xen/arch/x86/apic.c | 2 ++ xen/common/Kconfig | 9 +++++++++ xen/common/Makefile | 2 +- xen/common/cpupool.c | 2 ++ xen/common/schedule.c | 2 ++ xen/include/xen/keyhandler.h | 14 ++++++++++++++ xen/include/xen/lib.h | 2 ++ xen/include/xen/sched.h | 2 ++ 9 files changed, 36 insertions(+), 1 deletion(-)xen/arch/arm/gic.c +2
-0@@ -361,7 +361,9 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)/* Nothing to do, will check for events on return path */ break ;case GIC_SGI_DUMP_STATE : +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate (regs); +#endif break ;case GIC_SGI_CALL_FUNCTION :smp_call_function_interrupt ();xen/arch/x86/apic.c +2
-0@@ -1410,7 +1410,9 @@ void spurious_interrupt(struct cpu_user_regs *regs)ack_APIC_irq ();if (this_cpu (state_dump_pending)) {this_cpu (state_dump_pending) = false; +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate (regs); +#endif return ; } }xen/common/Kconfig +0
-0@@ -368,4 +368,13 @@ config DOM0_MEM
Quoted 8 lines
xen/common/Kconfig config DOM0_MEM · line 371
Quoted 3 lines
xen/common/Kconfig +1
-0Leave empty if you are not sure what to specify. +config HAS_KEYHANDLERAFAIK the HAS_* config options are meant to be selected by other options and not be user selectable.
So I think you should drop the "
HAS_" and maybe use the plural as Dario already suggested ("KEYHANDLERS").
Yes.
Quoted 10 lines
xen/common/Kconfig config DOM0_MEM · line 378
Quoted 8 lines
xen/common/Kconfig +7
-0+ bool "Enable/Disable keyhandler" + default y + ---help--- + Enable or disable keyhandler function. + keyhandler mainly used for debug usage by developers which can dump + xen module(eg. timer, scheduler) status at runtime by input character + from console.I'd drop the "by developers". In case of customer problems with Xen hosts the output of keyhandlers is requested on a rather regular base.
Agree, can be fixed.
Quoted 114 lines
Quoted 114 lines
xen/common/Kconfig +1
-0+ endmenuxen/common/Makefile +1
-1@@ -16,7 +16,7 @@ obj-y += guestcopy.o obj-bin-y += gunzip.init.o obj-y += irq.o obj-y += kernel.o -obj-y += keyhandler.o +obj-$(CONFIG_HAS_KEYHANDLER) += keyhandler.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_KEXEC) += kimage.o obj-y += lib.oxen/common/cpupool.c +2
-0@@ -699,6 +699,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)return ret; } +#ifdef CONFIG_HAS_KEYHANDLER void dump_runq (unsigned char key) {unsigned long flags;@@ -730,6 +731,7 @@ void dump_runq(unsigned char key)local_irq_restore (flags); spin_unlock(&cpupool_lock); } +#endif static int cpu_callback (struct notifier_block *nfb,unsigned long action,void *hcpu)xen/common/schedule.c +2
-0@@ -1913,6 +1913,7 @@ void scheduler_free(struct scheduler *sched)xfree (sched); } +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c) {unsigned int i;@@ -1941,6 +1942,7 @@ void schedule_dump(struct cpupool *c) SCHED_OP(sched, dump_cpu_state, i); } } +#endif void sched_tick_suspend (void ) {xen/include/xen/keyhandler.h +14
-0@@ -28,6 +28,7 @@ struct cpu_user_regs;typedef void (irq_keyhandler_fn_t )(unsigned char key,struct cpu_user_regs *regs); +#ifdef CONFIG_HAS_KEYHANDLER /* Initialize keytable with default handlers. */ void initialize_keytable (void );@@ -48,4 +49,17 @@ 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); +#else +static inline void initialize_keytable (void ) {} +static inline void register_keyhandler (unsigned char key,keyhandler_fn_t *fn, +const char *desc,bool_t diagnostic) {} +static inline void register_irq_keyhandler (unsigned char key, +irq_keyhandler_fn_t *fn, +const char *desc, +bool_t diagnostic) {} + +static inline void handle_keypress (unsigned char key, +struct cpu_user_regs *regs) {} +#endif +#endif /* __XEN_KEYHANDLER_H__ */ xen/include/xen/lib.h +2
-0@@ -171,8 +171,10 @@ extern unsigned int tainted;extern char *print_tainted (char *str);extern void add_taint (unsigned int taint); +#ifdef CONFIG_HAS_KEYHANDLER struct cpu_user_regs ;void dump_execstate (struct cpu_user_regs *); +#endif void init_constructors (void );xen/include/xen/sched.h +2
-0@@ -994,8 +994,10 @@ int cpupool_add_domain(struct domain *d, int poolid);void cpupool_rm_domain (struct domain *d);int cpupool_move_domain (struct domain *d,struct cpupool *c);int cpupool_do_sysctl (struct xen_sysctl_cpupool_op *op); +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump (struct cpupool *c);extern void dump_runq (unsigned char key); +#endif
Quoted 3 lines
xen/include/xen/sched.h int cpupool_add_domain(struct domain *d, int poolid); · line 1002
Quoted 1 line
xen/include/xen/sched.h +0
-0void arch_do_physinfo (struct xen_sysctl_physinfo *pi);Why stopping halfway here? There are lots of other keyhandlers which can be removed for the hypervisor in case there is no code calling them.
Not sure about 'halfway' this.
Most of the callers for key hander will register a handler function with
**static** prefix. so when config disabled, the static handler function
will not be in final executable file.
so there is no need to spread '#ifdef CONFIG_KEYHANDLERS' to many files.
right?
Quoted 4 lines
Juergen
.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Baodong Chen
keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console.
Signed-off-by Baodong Chen <[email protected]>
What is the motivation here? I don't have a specific objection to making this configurable (so long as it excises the entire keyhandler infrastructure, which is rather more than this patch does), but I also don't see why we would want to do so in the first place.
In particular, it doesn't require a serial console to function correctly in the first place. This functionality can be used with xl debug-keys $char; xl dmesg
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · Baodong Chen
keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console.
Signed-off-by Baodong Chen <[email protected]>
Quoted 8 lines
What is the motivation here? I don't have a specific objection to making this configurable (so long as it excises the entire keyhandler infrastructure, which is rather more than this patch does), but I also don't see why we would want to do so in the first place.
In particular, it doesn't require a serial console to function correctly in the first place. This functionality can be used with
xl debug-keys $char; xl dmesg
IIUC the config cut nearly the entire keyhandler infrastructure.
I'm interested in arm64 automotive use case, safety certification
is nice to have.
so the smaller code base is preferred.
BTW, i heard the works "dom0less", is it possible run vms over xen without xl?
Quoted 3 lines
~Andrew
.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel