* [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface
@ 2014-01-14 16:25 Mike Travis
2014-01-14 16:25 ` [PATCH 1/3] KGDB/KDB: Fix no KDB config problem v2 Mike Travis
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Mike Travis @ 2014-01-14 16:25 UTC (permalink / raw)
To: Ingo Molnar, Jason Wessel, Peter Zijlstra, Paul Mackerras,
Arnaldo Carvalho de Melo, H. Peter Anvin, Thomas Gleixner,
Andrew Morton
Cc: Hedi Berriche, Russ Anderson, x86, linux-kernel
v2: Update patch 2/3 to include which problems fixed. Other minor
changes detailed in the patches.
* 1/3: Change the fix for 'KDB not defined' build problem by changing
the kgdb_nmicallin() interface to include the KDB specific reason code.
This removes the dependency on KDB in the debug core. It also requires
a change to the kgdb call in from UV NMI handler to avoid a compile
error.
* 2/3: Fix problems found by the kbuild test robot tip-bot:
Make uv_register_nmi_notifier() and uv_handle_nmi_ping() static to
address sparse warnings. Fix problem where uv_nmi_kexec_failed is
unused when CONFIG_KEXEC is not defined.
* 3/3: 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 the kernel to wait for
gdb to be connected. If it's set to 'kdb' then an error message is
displayed if KDB is not configured.
Also 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
documentation for further information.
--
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] KGDB/KDB: Fix no KDB config problem v2.
2014-01-14 16:25 [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Mike Travis
@ 2014-01-14 16:25 ` Mike Travis
2014-01-25 14:24 ` [tip:core/urgent] kgdb/kdb: Fix no KDB config problem tip-bot for Mike Travis
2014-01-14 16:25 ` [PATCH 2/3] UV/NMI: Fix tip/bot/kbuild test robot problems v2 Mike Travis
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Mike Travis @ 2014-01-14 16:25 UTC (permalink / raw)
To: Ingo Molnar, Jason Wessel, Peter Zijlstra, Paul Mackerras,
Arnaldo Carvalho de Melo, H. Peter Anvin, Thomas Gleixner,
Andrew Morton
Cc: Hedi Berriche, Russ Anderson, x86, linux-kernel
[-- Attachment #1: fix-no-kdb-error.patch --]
[-- Type: text/plain, Size: 2863 bytes --]
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 dependency in the debug core code.
Update the call from the UV NMI handler to conform to the new interface.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Hedi Berriche <hedi@sgi.com>
---
v2: fix checkpatch error: KDB_REASON_SYSTEM_NMI below had a preceding space.
---
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(-)
--- linux.orig/arch/x86/platform/uv/uv_nmi.c
+++ linux/arch/x86/platform/uv/uv_nmi.c
@@ -546,7 +546,7 @@ static void uv_call_kdb(int cpu, struct
if (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);
--- linux.orig/include/linux/kgdb.h
+++ linux/include/linux/kgdb.h
@@ -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;
--- linux.orig/kernel/debug/debug_core.c
+++ linux/kernel/debug/debug_core.c
@@ -736,7 +736,8 @@ int kgdb_nmicallback(int cpu, void *regs
return 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);
--- linux.orig/kernel/debug/debug_core.h
+++ linux/kernel/debug/debug_core.h
@@ -75,13 +75,11 @@ extern int kdb_stub(struct kgdb_state *k
extern 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_ */
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] UV/NMI: Fix tip/bot/kbuild test robot problems v2
2014-01-14 16:25 [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Mike Travis
2014-01-14 16:25 ` [PATCH 1/3] KGDB/KDB: Fix no KDB config problem v2 Mike Travis
@ 2014-01-14 16:25 ` Mike Travis
2014-01-25 14:24 ` [tip:core/urgent] x86/uv/nmi: Fix Sparse warnings tip-bot for Mike Travis
2014-01-14 16:25 ` [PATCH 3/3] UV/NMI/KGDB/KDB: Fix UV NMI handler when KDB not configured v2 Mike Travis
2014-01-14 16:28 ` [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Ingo Molnar
3 siblings, 1 reply; 8+ messages in thread
From: Mike Travis @ 2014-01-14 16:25 UTC (permalink / raw)
To: Ingo Molnar, Jason Wessel, Peter Zijlstra, Paul Mackerras,
Arnaldo Carvalho de Melo, H. Peter Anvin, Thomas Gleixner,
Andrew Morton
Cc: Hedi Berriche, Russ Anderson, x86, linux-kernel
[-- Attachment #1: fix-tip-bot-errs.patch --]
[-- Type: text/plain, Size: 3123 bytes --]
Make uv_register_nmi_notifier() and uv_handle_nmi_ping() static to
address sparse warnings.
Fix problem where uv_nmi_kexec_failed is unused when CONFIG_KEXEC
is not defined.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Hedi Berriche <hedi@sgi.com>
---
v2: update the description to include problems fixed.
---
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(-)
--- linux.orig/arch/x86/include/asm/uv/uv.h
+++ linux/arch/x86/include/asm/uv/uv.h
@@ -12,7 +12,6 @@ extern enum uv_system_type get_uv_system
extern 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 const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
struct mm_struct *mm,
@@ -26,7 +25,6 @@ static inline enum uv_system_type get_uv
static inline int is_uv_system(void) { return 0; }
static inline void uv_cpu_init(void) { }
static inline void uv_system_init(void) { }
-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)
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c
+++ linux/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -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 */
--- linux.orig/arch/x86/platform/uv/uv_nmi.c
+++ linux/arch/x86/platform/uv/uv_nmi.c
@@ -74,7 +74,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 */
@@ -504,6 +503,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 */
@@ -634,7 +634,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;
@@ -651,7 +651,7 @@ int uv_handle_nmi_ping(unsigned int reas
return 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");
@@ -695,6 +695,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();
}
-
-
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] UV/NMI/KGDB/KDB: Fix UV NMI handler when KDB not configured v2
2014-01-14 16:25 [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Mike Travis
2014-01-14 16:25 ` [PATCH 1/3] KGDB/KDB: Fix no KDB config problem v2 Mike Travis
2014-01-14 16:25 ` [PATCH 2/3] UV/NMI: Fix tip/bot/kbuild test robot problems v2 Mike Travis
@ 2014-01-14 16:25 ` Mike Travis
2014-01-25 14:24 ` [tip:core/urgent] x86/uv/nmi, kgdb/kdb: Fix UV NMI handler when KDB not configured tip-bot for Mike Travis
2014-01-14 16:28 ` [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Ingo Molnar
3 siblings, 1 reply; 8+ messages in thread
From: Mike Travis @ 2014-01-14 16:25 UTC (permalink / raw)
To: Ingo Molnar, Jason Wessel, Peter Zijlstra, Paul Mackerras,
Arnaldo Carvalho de Melo, H. Peter Anvin, Thomas Gleixner,
Andrew Morton
Cc: Hedi Berriche, Russ Anderson, x86, linux-kernel
[-- Attachment #1: uv-fix-use-kgdb.patch --]
[-- Type: text/plain, Size: 3720 bytes --]
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.
Also 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 documentation for
further information.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Hedi Berriche <hedi@sgi.com>
---
v2: Fixed some typos.
---
arch/x86/platform/uv/uv_nmi.c | 56 +++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 14 deletions(-)
--- linux.orig/arch/x86/platform/uv/uv_nmi.c
+++ linux/arch/x86/platform/uv/uv_nmi.c
@@ -148,7 +148,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);
@@ -537,18 +538,45 @@ 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_kdb_reason(void)
{
- int ret;
+ return KDB_REASON_SYSTEM_NMI;
+}
+#else /* !CONFIG_KGDB_KDB */
+static inline int uv_nmi_kdb_reason(void)
+{
+ /* Insure user is expecting to attach gdb remote */
+ 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_kdb_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 {
@@ -567,12 +595,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
@@ -606,9 +634,9 @@ int uv_handle_nmi(unsigned int reason, s
if (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);
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface
2014-01-14 16:25 [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Mike Travis
` (2 preceding siblings ...)
2014-01-14 16:25 ` [PATCH 3/3] UV/NMI/KGDB/KDB: Fix UV NMI handler when KDB not configured v2 Mike Travis
@ 2014-01-14 16:28 ` Ingo Molnar
3 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2014-01-14 16:28 UTC (permalink / raw)
To: Mike Travis
Cc: Ingo Molnar, Jason Wessel, Peter Zijlstra, Paul Mackerras,
Arnaldo Carvalho de Melo, H. Peter Anvin, Thomas Gleixner,
Andrew Morton, Hedi Berriche, Russ Anderson, x86, linux-kernel
* Mike Travis <travis@sgi.com> wrote:
>
> v2: Update patch 2/3 to include which problems fixed. Other minor
> changes detailed in the patches.
>
> * 1/3: Change the fix for 'KDB not defined' build problem by changing
> the kgdb_nmicallin() interface to include the KDB specific reason code.
> This removes the dependency on KDB in the debug core. It also requires
> a change to the kgdb call in from UV NMI handler to avoid a compile
> error.
>
> * 2/3: Fix problems found by the kbuild test robot tip-bot:
> Make uv_register_nmi_notifier() and uv_handle_nmi_ping() static to
> address sparse warnings. Fix problem where uv_nmi_kexec_failed is
> unused when CONFIG_KEXEC is not defined.
>
> * 3/3: 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 the kernel to wait for
> gdb to be connected. If it's set to 'kdb' then an error message is
> displayed if KDB is not configured.
>
> Also 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
> documentation for further information.
So unless Jason objects I plan to merge these bits in a day or two,
for a v3.14 merge (if they pass all review and testing).
Thanks,
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:core/urgent] kgdb/kdb: Fix no KDB config problem
2014-01-14 16:25 ` [PATCH 1/3] KGDB/KDB: Fix no KDB config problem v2 Mike Travis
@ 2014-01-25 14:24 ` tip-bot for Mike Travis
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Mike Travis @ 2014-01-25 14:24 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jason.wessel,
travis, acme, hedi, rja, tglx
Commit-ID: fc8b13740b2978b34872650cc8e928392e3758aa
Gitweb: http://git.kernel.org/tip/fc8b13740b2978b34872650cc8e928392e3758aa
Author: Mike Travis <travis@sgi.com>
AuthorDate: Tue, 14 Jan 2014 10:25:52 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 25 Jan 2014 08:55:09 +0100
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 dependency in the debug core code.
Update the call from the UV NMI handler to conform to the new
interface.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Hedi Berriche <hedi@sgi.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Link: http://lkml.kernel.org/r/20140114162551.318251993@asylum.americas.sgi.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
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(-)
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index 8eeccba..7486c21 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -546,7 +546,7 @@ static void uv_call_kdb(int cpu, struct pt_regs *regs, int master)
if (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);
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index dfb4f2f..6b06d37 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -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;
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 7d2f35e..334b398 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -736,7 +736,8 @@ int kgdb_nmicallback(int cpu, void *regs)
return 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, void *regs, atomic_t *send_ready)
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);
diff --git a/kernel/debug/debug_core.h b/kernel/debug/debug_core.h
index 572aa4f..127d9bc 100644
--- a/kernel/debug/debug_core.h
+++ b/kernel/debug/debug_core.h
@@ -75,13 +75,11 @@ extern int kdb_stub(struct kgdb_state *ks);
extern 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_ */
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:core/urgent] x86/uv/nmi: Fix Sparse warnings
2014-01-14 16:25 ` [PATCH 2/3] UV/NMI: Fix tip/bot/kbuild test robot problems v2 Mike Travis
@ 2014-01-25 14:24 ` tip-bot for Mike Travis
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Mike Travis @ 2014-01-25 14:24 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jason.wessel,
travis, acme, hedi, rja, tglx
Commit-ID: 74c93f9d39b556ff9ac2340d568ad5caf8446c65
Gitweb: http://git.kernel.org/tip/74c93f9d39b556ff9ac2340d568ad5caf8446c65
Author: Mike Travis <travis@sgi.com>
AuthorDate: Tue, 14 Jan 2014 10:25:53 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 25 Jan 2014 08:55:10 +0100
x86/uv/nmi: Fix Sparse warnings
Make uv_register_nmi_notifier() and uv_handle_nmi_ping() static
to address sparse warnings.
Fix problem where uv_nmi_kexec_failed is unused when
CONFIG_KEXEC is not defined.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Hedi Berriche <hedi@sgi.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Link: http://lkml.kernel.org/r/20140114162551.480872353@asylum.americas.sgi.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
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(-)
diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h
index 6b964a0..062921e 100644
--- a/arch/x86/include/asm/uv/uv.h
+++ b/arch/x86/include/asm/uv/uv.h
@@ -12,7 +12,6 @@ extern enum uv_system_type get_uv_system_type(void);
extern 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 const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
struct mm_struct *mm,
@@ -26,7 +25,6 @@ static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
static inline int is_uv_system(void) { return 0; }
static inline void uv_cpu_init(void) { }
static inline void uv_system_init(void) { }
-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)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index ad0dc04..d263b13 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -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 */
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index 7486c21..3a3c425 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -74,7 +74,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 */
@@ -504,6 +503,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 */
@@ -634,7 +634,7 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
/*
* 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;
@@ -651,7 +651,7 @@ int uv_handle_nmi_ping(unsigned int reason, struct pt_regs *regs)
return 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");
@@ -695,6 +695,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();
}
-
-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:core/urgent] x86/uv/nmi, kgdb/kdb: Fix UV NMI handler when KDB not configured
2014-01-14 16:25 ` [PATCH 3/3] UV/NMI/KGDB/KDB: Fix UV NMI handler when KDB not configured v2 Mike Travis
@ 2014-01-25 14:24 ` tip-bot for Mike Travis
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Mike Travis @ 2014-01-25 14:24 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jason.wessel,
travis, acme, hedi, rja, tglx
Commit-ID: 64389998151214c71ba59ac893180744fd880052
Gitweb: http://git.kernel.org/tip/64389998151214c71ba59ac893180744fd880052
Author: Mike Travis <travis@sgi.com>
AuthorDate: Tue, 14 Jan 2014 10:25:54 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 25 Jan 2014 08:55:11 +0100
x86/uv/nmi, kgdb/kdb: Fix UV NMI handler when KDB not configured
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.
Also 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
documentation for further information.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Hedi Berriche <hedi@sgi.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Link: http://lkml.kernel.org/r/20140114162551.635540667@asylum.americas.sgi.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/platform/uv/uv_nmi.c | 56 ++++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 14 deletions(-)
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index 3a3c425..be27da6 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -148,7 +148,8 @@ module_param_named(retry_count, uv_nmi_retry_count, int, 0644);
* "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);
@@ -537,18 +538,45 @@ static inline void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
}
#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_kdb_reason(void)
{
- int ret;
+ return KDB_REASON_SYSTEM_NMI;
+}
+#else /* !CONFIG_KGDB_KDB */
+static inline int uv_nmi_kdb_reason(void)
+{
+ /* Insure user is expecting to attach gdb remote */
+ 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_kdb_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 {
@@ -567,12 +595,12 @@ static void uv_call_kdb(int cpu, struct pt_regs *regs, int master)
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
@@ -606,9 +634,9 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
if (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);
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-01-25 14:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14 16:25 [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Mike Travis
2014-01-14 16:25 ` [PATCH 1/3] KGDB/KDB: Fix no KDB config problem v2 Mike Travis
2014-01-25 14:24 ` [tip:core/urgent] kgdb/kdb: Fix no KDB config problem tip-bot for Mike Travis
2014-01-14 16:25 ` [PATCH 2/3] UV/NMI: Fix tip/bot/kbuild test robot problems v2 Mike Travis
2014-01-25 14:24 ` [tip:core/urgent] x86/uv/nmi: Fix Sparse warnings tip-bot for Mike Travis
2014-01-14 16:25 ` [PATCH 3/3] UV/NMI/KGDB/KDB: Fix UV NMI handler when KDB not configured v2 Mike Travis
2014-01-25 14:24 ` [tip:core/urgent] x86/uv/nmi, kgdb/kdb: Fix UV NMI handler when KDB not configured tip-bot for Mike Travis
2014-01-14 16:28 ` [PATCH 0/3] KGDB/KDB/UV: Fixups for UV to KGDB interface Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox