: KGDB/KDB/UV updates.
Subsystems (3)
cover : KGDB/KDB/UV updates.
* Change the fix for KDB not defined build problem by changing the kgdb_nmicallin() interface to include the KDB specific reason code. This removes a dependency on KDB in the debug core. Also requires a change the call in from UV NMI handler.
* Fix some problems found by the kbuild test robot.
* Fix UV call into kgdb to depend only on whether KGDB is defined and not both KGDB and KDB. This allows the power nmi command to use the gdb remote connection if enabled. Note new action of 'kgdb' needs to be set as well to indicate user wants to wait for gdb to be connected. If it's set to 'kdb' then an error message is displayed if KDB is not configured.
--
PATCH 1/3 PATCH: KGDB/KDB Fix no KDB config problem.
Some code added to the debug_core module had KDB dependencies that it shouldn't have. Move the KDB dependent REASON back to the caller to remove the dependence in KGDB code.
--- arch/x86/platform/uv/uv_nmi.c | 2 +- include/linux/kgdb.h | 3 ++- kernel/debug/debug_core.c | 5 +++-- kernel/debug/debug_core.h | 2 -- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/platform/uv/uv_nmi.c +1 -1
@@ -553,7 +553,7 @@ static void uv_call_kdb(int cpu, structif (master) {/* call KGDB NMI handler as MASTER */ ret =kgdb_nmicallin (cpu,X86_TRAP_NMI , regs, - &uv_nmi_slave_continue); +KDB_REASON_SYSTEM_NMI , &uv_nmi_slave_continue);if (ret) {pr_alert ("KDB returned error, is kgdboc set?\n" );atomic_set (&uv_nmi_slave_continue,SLAVE_EXIT );
include/linux/kgdb.h +2 -1
@@ -310,7 +310,8 @@ extern int kgdb_handle_exception(int ex_vector, int signo, int err_code, struct pt_regs *regs);extern int kgdb_nmicallback (int cpu,void *regs); -extern int kgdb_nmicallin (int cpu,int trapnr,void *regs,atomic_t *snd_rdy); +extern int kgdb_nmicallin (int cpu,int trapnr,void *regs,int err_code, +atomic_t *snd_rdy);extern void gdbstub_exit (int status);extern int kgdb_single_step;
kernel/debug/debug_core.c +3 -2
@@ -736,7 +736,8 @@ int kgdb_nmicallback(int cpu, void *regsreturn 1 ; } -int kgdb_nmicallin (int cpu,int trapnr,void *regs,atomic_t *send_ready) +int kgdb_nmicallin (int cpu,int trapnr,void *regs,int err_code, +atomic_t *send_ready) {#ifdef CONFIG_SMP if (!kgdb_io_ready (0 ) || !send_ready)
@@ -750,7 +751,7 @@ int kgdb_nmicallin(int cpu, int trapnr, ks->cpu = cpu; ks->ex_vector = trapnr; ks->signo =SIGTRAP ; - ks->err_code =KGDB_KDB_REASON_SYSTEM_NMI ; + ks->err_code = err_code; ks->linux_regs = regs; ks->send_ready = send_ready;kgdb_cpu_enter (ks, regs,DCPU_WANT_MASTER );
kernel/debug/debug_core.h +0 -2
@@ -75,13 +75,11 @@ extern int kdb_stub(struct kgdb_state *kextern int kdb_parse (const char *cmdstr);extern int kdb_common_init_state (struct kgdb_state *ks);extern int kdb_common_deinit_state (void ); -#define KGDB_KDB_REASON_SYSTEM_NMI KDB_REASON_SYSTEM_NMI#else /* ! CONFIG_KGDB_KDB */ static inline int kdb_stub (struct kgdb_state *ks) {return DBG_PASS_EVENT ; } -#define KGDB_KDB_REASON_SYSTEM_NMI 0#endif /* CONFIG_KGDB_KDB */ #endif /* _DEBUG_CORE_H_ */
PATCH 2/3 PATCH: UV/NMI Fix tip/bot/kbuild test robot problems
In reply to Mike TravisFix some problems found by the kbuild test robot.
--- arch/x86/include/asm/uv/uv.h | 2 -- arch/x86/kernel/apic/x2apic_uv_x.c | 1 - arch/x86/platform/uv/uv_nmi.c | 9 ++++----- 3 files changed, 4 insertions(+), 8 deletions(-)
arch/x86/include/asm/uv/uv.h +0 -2
@@ -12,7 +12,6 @@ extern enum uv_system_type get_uv_systemextern int is_uv_system (void );extern void uv_cpu_init (void );extern void uv_nmi_init (void ); -extern void uv_register_nmi_notifier (void );extern void uv_system_init (void );extern void (*uv_trace_nmi_func)(unsigned int reason,struct pt_regs *regs);extern void (*uv_trace_func)(const char *f,const int l,const char *fmt, ...);
@@ -34,7 +33,6 @@ static inline int is_uv_system(void) { rstatic inline void uv_cpu_init (void ) { }static inline void uv_system_init (void ) { }static inline void uv_trace (void *fmt, ...) { } -static inline void uv_register_nmi_notifier (void ) { }static inline const struct cpumask *uv_flush_tlb_others (const struct cpumask *cpumask,struct mm_struct *mm,unsigned long start,unsigned long end,unsigned int cpu)
arch/x86/kernel/apic/x2apic_uv_x.c +0 -1
@@ -980,7 +980,6 @@ void __init uv_system_init(void)uv_nmi_setup ();uv_cpu_init ();uv_scir_register_cpu_notifier (); -uv_register_nmi_notifier ();proc_mkdir ("sgi_uv" ,NULL );/* register Legacy VGA I/O redirection handler */
arch/x86/platform/uv/uv_nmi.c +4 -5
@@ -81,7 +81,6 @@ static atomic_t uv_in_nmi;static atomic_t uv_nmi_cpu =ATOMIC_INIT (-1 );static atomic_t uv_nmi_cpus_in_nmi =ATOMIC_INIT (-1 );static atomic_t uv_nmi_slave_continue; -static atomic_t uv_nmi_kexec_failed;static cpumask_var_t uv_nmi_cpu_mask;/* Values for uv_nmi_slave_continue */
@@ -511,6 +510,7 @@ static void uv_nmi_touch_watchdogs(void) }#if defined(CONFIG_KEXEC ) +static atomic_t uv_nmi_kexec_failed;static void uv_nmi_kdump (int cpu,int master,struct pt_regs *regs) {/* Call crash to dump system state */
@@ -645,7 +645,7 @@ int uv_handle_nmi(unsigned int reason, s/* * NMI handler for pulling in CPUs when perf events are grabbing our NMI */ -int uv_handle_nmi_ping (unsigned int reason,struct pt_regs *regs) +static int uv_handle_nmi_ping (unsigned int reason,struct pt_regs *regs) {int ret;
@@ -662,7 +662,7 @@ int uv_handle_nmi_ping(unsigned int reasreturn ret; } -void uv_register_nmi_notifier (void ) +static void uv_register_nmi_notifier (void ) {if (register_nmi_handler (NMI_UNKNOWN , uv_handle_nmi,0 ,"uv" ))pr_warn ("UV: NMI handler failed to register\n" );
@@ -706,6 +706,5 @@ void uv_nmi_setup(void)uv_hub_nmi_per (cpu) = uv_hub_nmi_list[nid]; }BUG_ON (!alloc_cpumask_var (&uv_nmi_cpu_mask,GFP_KERNEL )); +uv_register_nmi_notifier (); } - -
PATCH 3/3 PATCH: UV/NMI/KGDB/KDB Fix UV NMI handler when KDB not configed.
In reply to Mike TravisFix UV call into kgdb to depend only on whether KGDB is defined and not both KGDB and KDB. This allows the power nmi command to use the gdb remote connection if enabled. Note new action of 'kgdb' needs to be set as well to indicate user wants to wait for gdb to be connected. If it's set to 'kdb' then an error message is displayed if KDB is not configured.
Note that if both KGDB and KDB are enabled, then the action of 'kgdb' or 'kdb' has no affect on which is used. See the KGDB documention for further information.
--- arch/x86/platform/uv/uv_nmi.c | 57 +++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 14 deletions(-)
arch/x86/platform/uv/uv_nmi.c +43 -14
@@ -155,7 +155,8 @@ module_param_named(retry_count, uv_nmi_r* "dump" - dump process stack for each cpu * "ips" - dump IP info for each cpu * "kdump" - do crash dump -* "kdb" - enter KDB/KGDB (default) +* "kdb" - enter KDB (default) +* "kgdb" - enter KGDB */ static char uv_nmi_action[8 ] ="kdb" ;module_param_string (action, uv_nmi_action,sizeof (uv_nmi_action),0644 );
@@ -544,18 +545,46 @@ static inline void uv_nmi_kdump(int cpu, }#endif /* !CONFIG_KEXEC */ +#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB_KDB -/* Call KDB from NMI handler */ -static void uv_call_kdb (int cpu,struct pt_regs *regs,int master) +static inline int uv_nmi_kgdb_reason (void ) { -int ret; +if (uv_nmi_action_is ("kdb" )) +return KDB_REASON_SYSTEM_NMI ; +return 0 ; +} +#else /* !CONFIG_KGDB_KDB */ +static inline int uv_nmi_kgdb_reason (void ) +{ +if (uv_nmi_action_is ("kgdb" )) +return 0 ; +pr_err ("UV: NMI error: KDB is not enabled in this kernel\n" ); +return -1 ; +} +#endif /* CONFIG_KGDB_KDB */ + +/* +* Call KGDB/KDB from NMI handler +* +* Note that if both KGDB and KDB are configured, then the action of 'kgdb' or +* 'kdb' has no affect on which is used. See the KGDB documention for further +* information. +*/ +static void uv_call_kgdb_kdb (int cpu,struct pt_regs *regs,int master) +{if (master) { +int reason =uv_nmi_kgdb_reason (); +int ret; + +if (reason <0 ) +return ; +/* call KGDB NMI handler as MASTER */ - ret =kgdb_nmicallin (cpu,X86_TRAP_NMI , regs, -KDB_REASON_SYSTEM_NMI , &uv_nmi_slave_continue); + ret =kgdb_nmicallin (cpu,X86_TRAP_NMI , regs, reason, + &uv_nmi_slave_continue);if (ret) { -pr_alert ("KDB returned error, is kgdboc set?\n" ); +pr_alert ("KGDB returned error, is kgdboc set?\n" );atomic_set (&uv_nmi_slave_continue,SLAVE_EXIT ); } }else {
@@ -574,12 +603,12 @@ static void uv_call_kdb(int cpu, struct uv_nmi_sync_exit(master); } -#else /* !CONFIG_KGDB_KDB */ -static inline void uv_call_kdb (int cpu,struct pt_regs *regs,int master) +#else /* !CONFIG_KGDB */ +static inline void uv_call_kgdb_kdb (int cpu,struct pt_regs *regs,int master) { -pr_err ("UV: NMI error: KGDB/KDB is not enabled in this kernel\n" ); +pr_err ("UV: NMI error: KGDB is not enabled in this kernel\n" ); } -#endif /* !CONFIG_KGDB_KDB */ +#endif /* !CONFIG_KGDB */ /* * UV NMI handler
@@ -617,9 +646,9 @@ int uv_handle_nmi(unsigned int reason, sif (uv_nmi_action_is ("ips" ) ||uv_nmi_action_is ("dump" ))uv_nmi_dump_state (cpu, regs, master); -/* Call KDB if enabled */ -else if (uv_nmi_action_is ("kdb" )) -uv_call_kdb (cpu, regs, master); +/* Call KGDB/KDB if enabled */ +else if (uv_nmi_action_is ("kdb" ) ||uv_nmi_action_is ("kgdb" )) +uv_call_kgdb_kdb (cpu, regs, master);/* Clear per_cpu "in nmi" flag */ atomic_set (&uv_cpu_nmi.state,UV_NMI_STATE_OUT );
Quoted 8 lines · Mike Travis
* Change the fix for KDB not defined build problem by changing the
kgdb_nmicallin()interface to include the KDB specific reason code. This removes a dependency on KDB in the debug core. Also requires a change the call in from UV NMI handler.* Fix some problems found by the kbuild test robot.
Quoted 7 lines
* Fix UV call into kgdb to depend only on whether KGDB is defined and not both KGDB and KDB. This allows the power nmi command to use the gdb remote connection if enabled. Note new action of 'kgdb' needs to be set as well to indicate user wants to wait for gdb to be connected. If it's set to 'kdb' then an error message is displayed if KDB is not configured.
--
This looks better.
Jason, any objections?
Thanks,
Ingo
Quoted 19 lines · Ingo Molnar
Quoted 8 lines · Mike Travis
* Change the fix for KDB not defined build problem by changing the
kgdb_nmicallin()interface to include the KDB specific reason code. This removes a dependency on KDB in the debug core. Also requires a change the call in from UV NMI handler.* Fix some problems found by the kbuild test robot.
Quoted 7 lines
* Fix UV call into kgdb to depend only on whether KGDB is defined and not both KGDB and KDB. This allows the power nmi command to use the gdb remote connection if enabled. Note new action of 'kgdb' needs to be set as well to indicate user wants to wait for gdb to be connected. If it's set to 'kdb' then an error message is displayed if KDB is not configured.
--
Quoted 8 lines
This looks better.
Jason, any objections?
Thanks,
Ingo
I haven't heard anything back about this update. Were there objections? Looks like another merge window is closing?
Thanks,
Mike
Quoted 24 lines · Mike Travis
Quoted 23 lines · Ingo Molnar
Quoted 8 lines · Mike Travis
* Change the fix for KDB not defined build problem by changing the
kgdb_nmicallin()interface to include the KDB specific reason code. This removes a dependency on KDB in the debug core. Also requires a change the call in from UV NMI handler.* Fix some problems found by the kbuild test robot.
Quoted 7 lines
* Fix UV call into kgdb to depend only on whether KGDB is defined and not both KGDB and KDB. This allows the power nmi command to use the gdb remote connection if enabled. Note new action of 'kgdb' needs to be set as well to indicate user wants to wait for gdb to be connected. If it's set to 'kdb' then an error message is displayed if KDB is not configured.
--This looks better.
Jason, any objections?
Quoted 7 lines
Quoted 4 lines
Thanks,
Ingo
I haven't heard anything back about this update. Were there objections? Looks like another merge window is closing?
Please resend the series.
Thanks,
Ingo