2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/include/linux/nmi.h
|
|
|
|
*/
|
|
|
|
#ifndef LINUX_NMI_H
|
|
|
|
#define LINUX_NMI_H
|
|
|
|
|
2006-09-29 16:59:03 +08:00
|
|
|
#include <linux/sched.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/irq.h>
|
2017-07-13 05:35:43 +08:00
|
|
|
#if defined(CONFIG_HAVE_NMI_WATCHDOG)
|
|
|
|
#include <asm/nmi.h>
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-02-02 18:17:23 +08:00
|
|
|
#ifdef CONFIG_LOCKUP_DETECTOR
|
2017-07-13 05:35:46 +08:00
|
|
|
void lockup_detector_init(void);
|
2017-09-13 03:36:57 +08:00
|
|
|
void lockup_detector_soft_poweroff(void);
|
2017-09-13 03:37:04 +08:00
|
|
|
void lockup_detector_cleanup(void);
|
2017-09-13 03:37:13 +08:00
|
|
|
bool is_hardlockup(void);
|
|
|
|
|
|
|
|
extern int watchdog_user_enabled;
|
|
|
|
extern int nmi_watchdog_enabled;
|
|
|
|
extern int soft_watchdog_enabled;
|
|
|
|
extern int watchdog_thresh;
|
|
|
|
extern unsigned long watchdog_enabled;
|
|
|
|
|
|
|
|
extern struct cpumask watchdog_cpumask;
|
|
|
|
extern unsigned long *watchdog_cpumask_bits;
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
extern int sysctl_softlockup_all_cpu_backtrace;
|
|
|
|
extern int sysctl_hardlockup_all_cpu_backtrace;
|
2017-07-13 05:35:46 +08:00
|
|
|
#else
|
2017-09-13 03:37:13 +08:00
|
|
|
#define sysctl_softlockup_all_cpu_backtrace 0
|
|
|
|
#define sysctl_hardlockup_all_cpu_backtrace 0
|
|
|
|
#endif /* !CONFIG_SMP */
|
|
|
|
|
|
|
|
#else /* CONFIG_LOCKUP_DETECTOR */
|
2017-09-13 03:36:57 +08:00
|
|
|
static inline void lockup_detector_init(void) { }
|
|
|
|
static inline void lockup_detector_soft_poweroff(void) { }
|
2017-09-13 03:37:04 +08:00
|
|
|
static inline void lockup_detector_cleanup(void) { }
|
2017-09-13 03:37:13 +08:00
|
|
|
#endif /* !CONFIG_LOCKUP_DETECTOR */
|
2017-07-13 05:35:46 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_SOFTLOCKUP_DETECTOR
|
2017-02-02 18:17:23 +08:00
|
|
|
extern void touch_softlockup_watchdog_sched(void);
|
|
|
|
extern void touch_softlockup_watchdog(void);
|
|
|
|
extern void touch_softlockup_watchdog_sync(void);
|
|
|
|
extern void touch_all_softlockup_watchdogs(void);
|
|
|
|
extern unsigned int softlockup_panic;
|
|
|
|
#else
|
2017-09-13 03:37:13 +08:00
|
|
|
static inline void touch_softlockup_watchdog_sched(void) { }
|
|
|
|
static inline void touch_softlockup_watchdog(void) { }
|
|
|
|
static inline void touch_softlockup_watchdog_sync(void) { }
|
|
|
|
static inline void touch_all_softlockup_watchdogs(void) { }
|
2017-02-02 18:17:23 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_DETECT_HUNG_TASK
|
|
|
|
void reset_hung_task_detector(void);
|
|
|
|
#else
|
2017-09-13 03:37:13 +08:00
|
|
|
static inline void reset_hung_task_detector(void) { }
|
2017-02-02 18:17:23 +08:00
|
|
|
#endif
|
|
|
|
|
2016-12-15 07:06:21 +08:00
|
|
|
/*
|
|
|
|
* The run state of the lockup detectors is controlled by the content of the
|
|
|
|
* 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
|
|
|
|
* bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
|
|
|
|
*
|
|
|
|
* 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled'
|
|
|
|
* are variables that are only used as an 'interface' between the parameters
|
|
|
|
* in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The
|
|
|
|
* 'watchdog_thresh' variable is handled differently because its value is not
|
|
|
|
* boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh'
|
|
|
|
* is equal zero.
|
|
|
|
*/
|
|
|
|
#define NMI_WATCHDOG_ENABLED_BIT 0
|
|
|
|
#define SOFT_WATCHDOG_ENABLED_BIT 1
|
|
|
|
#define NMI_WATCHDOG_ENABLED (1 << NMI_WATCHDOG_ENABLED_BIT)
|
|
|
|
#define SOFT_WATCHDOG_ENABLED (1 << SOFT_WATCHDOG_ENABLED_BIT)
|
|
|
|
|
2017-07-13 05:35:43 +08:00
|
|
|
#if defined(CONFIG_HARDLOCKUP_DETECTOR)
|
|
|
|
extern void hardlockup_detector_disable(void);
|
2017-07-13 05:35:46 +08:00
|
|
|
extern unsigned int hardlockup_panic;
|
2017-07-13 05:35:43 +08:00
|
|
|
#else
|
|
|
|
static inline void hardlockup_detector_disable(void) {}
|
|
|
|
#endif
|
|
|
|
|
2017-09-13 03:37:14 +08:00
|
|
|
#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
|
|
|
|
# define NMI_WATCHDOG_SYSCTL_PERM 0644
|
|
|
|
#else
|
|
|
|
# define NMI_WATCHDOG_SYSCTL_PERM 0444
|
|
|
|
#endif
|
|
|
|
|
2017-07-13 05:35:46 +08:00
|
|
|
#if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
|
2017-07-13 05:35:43 +08:00
|
|
|
extern void arch_touch_nmi_watchdog(void);
|
2017-09-13 03:36:55 +08:00
|
|
|
extern void hardlockup_detector_perf_stop(void);
|
|
|
|
extern void hardlockup_detector_perf_restart(void);
|
2017-09-13 03:37:04 +08:00
|
|
|
extern void hardlockup_detector_perf_disable(void);
|
|
|
|
extern void hardlockup_detector_perf_cleanup(void);
|
2017-07-13 05:35:43 +08:00
|
|
|
#else
|
2017-09-13 03:36:55 +08:00
|
|
|
static inline void hardlockup_detector_perf_stop(void) { }
|
|
|
|
static inline void hardlockup_detector_perf_restart(void) { }
|
2017-09-13 03:37:04 +08:00
|
|
|
static inline void hardlockup_detector_perf_disable(void) { }
|
|
|
|
static inline void hardlockup_detector_perf_cleanup(void) { }
|
2017-07-13 05:35:46 +08:00
|
|
|
#if !defined(CONFIG_HAVE_NMI_WATCHDOG)
|
2017-07-13 05:35:43 +08:00
|
|
|
static inline void arch_touch_nmi_watchdog(void) {}
|
|
|
|
#endif
|
2017-07-13 05:35:46 +08:00
|
|
|
#endif
|
2017-07-13 05:35:43 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/**
|
|
|
|
* touch_nmi_watchdog - restart NMI watchdog timeout.
|
2017-09-13 03:37:13 +08:00
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* If the architecture supports the NMI watchdog, touch_nmi_watchdog()
|
|
|
|
* may be used to reset the timeout - for code which intentionally
|
|
|
|
* disables interrupts for a long time. This call is stateless.
|
|
|
|
*/
|
2007-02-13 20:26:24 +08:00
|
|
|
static inline void touch_nmi_watchdog(void)
|
|
|
|
{
|
2017-07-13 05:35:43 +08:00
|
|
|
arch_touch_nmi_watchdog();
|
2007-02-13 20:26:24 +08:00
|
|
|
touch_softlockup_watchdog();
|
|
|
|
}
|
2014-10-14 06:55:35 +08:00
|
|
|
|
2009-08-03 15:31:54 +08:00
|
|
|
/*
|
|
|
|
* Create trigger_all_cpu_backtrace() out of the arch-provided
|
|
|
|
* base function. Return whether such support was available,
|
|
|
|
* to allow calling code to fall back to some other mechanism:
|
|
|
|
*/
|
nmi_backtrace: add more trigger_*_cpu_backtrace() methods
Patch series "improvements to the nmi_backtrace code" v9.
This patch series modifies the trigger_xxx_backtrace() NMI-based remote
backtracing code to make it more flexible, and makes a few small
improvements along the way.
The motivation comes from the task isolation code, where there are
scenarios where we want to be able to diagnose a case where some cpu is
about to interrupt a task-isolated cpu. It can be helpful to see both
where the interrupting cpu is, and also an approximation of where the
cpu that is being interrupted is. The nmi_backtrace framework allows us
to discover the stack of the interrupted cpu.
I've tested that the change works as desired on tile, and build-tested
x86, arm, mips, and sparc64. For x86 I confirmed that the generic
cpuidle stuff as well as the architecture-specific routines are in the
new cpuidle section. For arm, mips, and sparc I just build-tested it
and made sure the generic cpuidle routines were in the new cpuidle
section, but I didn't attempt to figure out which the platform-specific
idle routines might be. That might be more usefully done by someone
with platform experience in follow-up patches.
This patch (of 4):
Currently you can only request a backtrace of either all cpus, or all
cpus but yourself. It can also be helpful to request a remote backtrace
of a single cpu, and since we want that, the logical extension is to
support a cpumask as the underlying primitive.
This change modifies the existing lib/nmi_backtrace.c code to take a
cpumask as its basic primitive, and modifies the linux/nmi.h code to use
the new "cpumask" method instead.
The existing clients of nmi_backtrace (arm and x86) are converted to
using the new cpumask approach in this change.
The other users of the backtracing API (sparc64 and mips) are converted
to use the cpumask approach rather than the all/allbutself approach.
The mips code ignored the "include_self" boolean but with this change it
will now also dump a local backtrace if requested.
Link: http://lkml.kernel.org/r/1472487169-14923-2-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-08 08:02:45 +08:00
|
|
|
#ifdef arch_trigger_cpumask_backtrace
|
2009-08-03 15:31:54 +08:00
|
|
|
static inline bool trigger_all_cpu_backtrace(void)
|
|
|
|
{
|
nmi_backtrace: add more trigger_*_cpu_backtrace() methods
Patch series "improvements to the nmi_backtrace code" v9.
This patch series modifies the trigger_xxx_backtrace() NMI-based remote
backtracing code to make it more flexible, and makes a few small
improvements along the way.
The motivation comes from the task isolation code, where there are
scenarios where we want to be able to diagnose a case where some cpu is
about to interrupt a task-isolated cpu. It can be helpful to see both
where the interrupting cpu is, and also an approximation of where the
cpu that is being interrupted is. The nmi_backtrace framework allows us
to discover the stack of the interrupted cpu.
I've tested that the change works as desired on tile, and build-tested
x86, arm, mips, and sparc64. For x86 I confirmed that the generic
cpuidle stuff as well as the architecture-specific routines are in the
new cpuidle section. For arm, mips, and sparc I just build-tested it
and made sure the generic cpuidle routines were in the new cpuidle
section, but I didn't attempt to figure out which the platform-specific
idle routines might be. That might be more usefully done by someone
with platform experience in follow-up patches.
This patch (of 4):
Currently you can only request a backtrace of either all cpus, or all
cpus but yourself. It can also be helpful to request a remote backtrace
of a single cpu, and since we want that, the logical extension is to
support a cpumask as the underlying primitive.
This change modifies the existing lib/nmi_backtrace.c code to take a
cpumask as its basic primitive, and modifies the linux/nmi.h code to use
the new "cpumask" method instead.
The existing clients of nmi_backtrace (arm and x86) are converted to
using the new cpumask approach in this change.
The other users of the backtracing API (sparc64 and mips) are converted
to use the cpumask approach rather than the all/allbutself approach.
The mips code ignored the "include_self" boolean but with this change it
will now also dump a local backtrace if requested.
Link: http://lkml.kernel.org/r/1472487169-14923-2-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-08 08:02:45 +08:00
|
|
|
arch_trigger_cpumask_backtrace(cpu_online_mask, false);
|
2009-08-03 15:31:54 +08:00
|
|
|
return true;
|
|
|
|
}
|
nmi_backtrace: add more trigger_*_cpu_backtrace() methods
Patch series "improvements to the nmi_backtrace code" v9.
This patch series modifies the trigger_xxx_backtrace() NMI-based remote
backtracing code to make it more flexible, and makes a few small
improvements along the way.
The motivation comes from the task isolation code, where there are
scenarios where we want to be able to diagnose a case where some cpu is
about to interrupt a task-isolated cpu. It can be helpful to see both
where the interrupting cpu is, and also an approximation of where the
cpu that is being interrupted is. The nmi_backtrace framework allows us
to discover the stack of the interrupted cpu.
I've tested that the change works as desired on tile, and build-tested
x86, arm, mips, and sparc64. For x86 I confirmed that the generic
cpuidle stuff as well as the architecture-specific routines are in the
new cpuidle section. For arm, mips, and sparc I just build-tested it
and made sure the generic cpuidle routines were in the new cpuidle
section, but I didn't attempt to figure out which the platform-specific
idle routines might be. That might be more usefully done by someone
with platform experience in follow-up patches.
This patch (of 4):
Currently you can only request a backtrace of either all cpus, or all
cpus but yourself. It can also be helpful to request a remote backtrace
of a single cpu, and since we want that, the logical extension is to
support a cpumask as the underlying primitive.
This change modifies the existing lib/nmi_backtrace.c code to take a
cpumask as its basic primitive, and modifies the linux/nmi.h code to use
the new "cpumask" method instead.
The existing clients of nmi_backtrace (arm and x86) are converted to
using the new cpumask approach in this change.
The other users of the backtracing API (sparc64 and mips) are converted
to use the cpumask approach rather than the all/allbutself approach.
The mips code ignored the "include_self" boolean but with this change it
will now also dump a local backtrace if requested.
Link: http://lkml.kernel.org/r/1472487169-14923-2-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-08 08:02:45 +08:00
|
|
|
|
2014-06-24 04:22:05 +08:00
|
|
|
static inline bool trigger_allbutself_cpu_backtrace(void)
|
|
|
|
{
|
nmi_backtrace: add more trigger_*_cpu_backtrace() methods
Patch series "improvements to the nmi_backtrace code" v9.
This patch series modifies the trigger_xxx_backtrace() NMI-based remote
backtracing code to make it more flexible, and makes a few small
improvements along the way.
The motivation comes from the task isolation code, where there are
scenarios where we want to be able to diagnose a case where some cpu is
about to interrupt a task-isolated cpu. It can be helpful to see both
where the interrupting cpu is, and also an approximation of where the
cpu that is being interrupted is. The nmi_backtrace framework allows us
to discover the stack of the interrupted cpu.
I've tested that the change works as desired on tile, and build-tested
x86, arm, mips, and sparc64. For x86 I confirmed that the generic
cpuidle stuff as well as the architecture-specific routines are in the
new cpuidle section. For arm, mips, and sparc I just build-tested it
and made sure the generic cpuidle routines were in the new cpuidle
section, but I didn't attempt to figure out which the platform-specific
idle routines might be. That might be more usefully done by someone
with platform experience in follow-up patches.
This patch (of 4):
Currently you can only request a backtrace of either all cpus, or all
cpus but yourself. It can also be helpful to request a remote backtrace
of a single cpu, and since we want that, the logical extension is to
support a cpumask as the underlying primitive.
This change modifies the existing lib/nmi_backtrace.c code to take a
cpumask as its basic primitive, and modifies the linux/nmi.h code to use
the new "cpumask" method instead.
The existing clients of nmi_backtrace (arm and x86) are converted to
using the new cpumask approach in this change.
The other users of the backtracing API (sparc64 and mips) are converted
to use the cpumask approach rather than the all/allbutself approach.
The mips code ignored the "include_self" boolean but with this change it
will now also dump a local backtrace if requested.
Link: http://lkml.kernel.org/r/1472487169-14923-2-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-08 08:02:45 +08:00
|
|
|
arch_trigger_cpumask_backtrace(cpu_online_mask, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool trigger_cpumask_backtrace(struct cpumask *mask)
|
|
|
|
{
|
|
|
|
arch_trigger_cpumask_backtrace(mask, false);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool trigger_single_cpu_backtrace(int cpu)
|
|
|
|
{
|
|
|
|
arch_trigger_cpumask_backtrace(cpumask_of(cpu), false);
|
2014-06-24 04:22:05 +08:00
|
|
|
return true;
|
|
|
|
}
|
2014-09-04 06:57:13 +08:00
|
|
|
|
|
|
|
/* generic implementation */
|
nmi_backtrace: add more trigger_*_cpu_backtrace() methods
Patch series "improvements to the nmi_backtrace code" v9.
This patch series modifies the trigger_xxx_backtrace() NMI-based remote
backtracing code to make it more flexible, and makes a few small
improvements along the way.
The motivation comes from the task isolation code, where there are
scenarios where we want to be able to diagnose a case where some cpu is
about to interrupt a task-isolated cpu. It can be helpful to see both
where the interrupting cpu is, and also an approximation of where the
cpu that is being interrupted is. The nmi_backtrace framework allows us
to discover the stack of the interrupted cpu.
I've tested that the change works as desired on tile, and build-tested
x86, arm, mips, and sparc64. For x86 I confirmed that the generic
cpuidle stuff as well as the architecture-specific routines are in the
new cpuidle section. For arm, mips, and sparc I just build-tested it
and made sure the generic cpuidle routines were in the new cpuidle
section, but I didn't attempt to figure out which the platform-specific
idle routines might be. That might be more usefully done by someone
with platform experience in follow-up patches.
This patch (of 4):
Currently you can only request a backtrace of either all cpus, or all
cpus but yourself. It can also be helpful to request a remote backtrace
of a single cpu, and since we want that, the logical extension is to
support a cpumask as the underlying primitive.
This change modifies the existing lib/nmi_backtrace.c code to take a
cpumask as its basic primitive, and modifies the linux/nmi.h code to use
the new "cpumask" method instead.
The existing clients of nmi_backtrace (arm and x86) are converted to
using the new cpumask approach in this change.
The other users of the backtracing API (sparc64 and mips) are converted
to use the cpumask approach rather than the all/allbutself approach.
The mips code ignored the "include_self" boolean but with this change it
will now also dump a local backtrace if requested.
Link: http://lkml.kernel.org/r/1472487169-14923-2-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-08 08:02:45 +08:00
|
|
|
void nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
|
|
|
|
bool exclude_self,
|
2014-09-04 06:57:13 +08:00
|
|
|
void (*raise)(cpumask_t *mask));
|
|
|
|
bool nmi_cpu_backtrace(struct pt_regs *regs);
|
|
|
|
|
2009-08-03 15:31:54 +08:00
|
|
|
#else
|
|
|
|
static inline bool trigger_all_cpu_backtrace(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-06-24 04:22:05 +08:00
|
|
|
static inline bool trigger_allbutself_cpu_backtrace(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
nmi_backtrace: add more trigger_*_cpu_backtrace() methods
Patch series "improvements to the nmi_backtrace code" v9.
This patch series modifies the trigger_xxx_backtrace() NMI-based remote
backtracing code to make it more flexible, and makes a few small
improvements along the way.
The motivation comes from the task isolation code, where there are
scenarios where we want to be able to diagnose a case where some cpu is
about to interrupt a task-isolated cpu. It can be helpful to see both
where the interrupting cpu is, and also an approximation of where the
cpu that is being interrupted is. The nmi_backtrace framework allows us
to discover the stack of the interrupted cpu.
I've tested that the change works as desired on tile, and build-tested
x86, arm, mips, and sparc64. For x86 I confirmed that the generic
cpuidle stuff as well as the architecture-specific routines are in the
new cpuidle section. For arm, mips, and sparc I just build-tested it
and made sure the generic cpuidle routines were in the new cpuidle
section, but I didn't attempt to figure out which the platform-specific
idle routines might be. That might be more usefully done by someone
with platform experience in follow-up patches.
This patch (of 4):
Currently you can only request a backtrace of either all cpus, or all
cpus but yourself. It can also be helpful to request a remote backtrace
of a single cpu, and since we want that, the logical extension is to
support a cpumask as the underlying primitive.
This change modifies the existing lib/nmi_backtrace.c code to take a
cpumask as its basic primitive, and modifies the linux/nmi.h code to use
the new "cpumask" method instead.
The existing clients of nmi_backtrace (arm and x86) are converted to
using the new cpumask approach in this change.
The other users of the backtracing API (sparc64 and mips) are converted
to use the cpumask approach rather than the all/allbutself approach.
The mips code ignored the "include_self" boolean but with this change it
will now also dump a local backtrace if requested.
Link: http://lkml.kernel.org/r/1472487169-14923-2-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-08 08:02:45 +08:00
|
|
|
static inline bool trigger_cpumask_backtrace(struct cpumask *mask)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
static inline bool trigger_single_cpu_backtrace(int cpu)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-12-07 09:14:01 +08:00
|
|
|
#endif
|
|
|
|
|
2017-07-13 05:35:46 +08:00
|
|
|
#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
|
2011-05-23 13:10:23 +08:00
|
|
|
u64 hw_nmi_get_sample_period(int watchdog_thresh);
|
2017-07-13 05:35:46 +08:00
|
|
|
#endif
|
|
|
|
|
2017-08-15 15:50:13 +08:00
|
|
|
#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
|
|
|
|
defined(CONFIG_HARDLOCKUP_DETECTOR)
|
|
|
|
void watchdog_update_hrtimer_threshold(u64 period);
|
|
|
|
#else
|
|
|
|
static inline void watchdog_update_hrtimer_threshold(u64 period) { }
|
|
|
|
#endif
|
|
|
|
|
2010-02-13 06:19:19 +08:00
|
|
|
struct ctl_table;
|
2015-04-15 06:44:08 +08:00
|
|
|
extern int proc_watchdog(struct ctl_table *, int ,
|
|
|
|
void __user *, size_t *, loff_t *);
|
|
|
|
extern int proc_nmi_watchdog(struct ctl_table *, int ,
|
|
|
|
void __user *, size_t *, loff_t *);
|
|
|
|
extern int proc_soft_watchdog(struct ctl_table *, int ,
|
|
|
|
void __user *, size_t *, loff_t *);
|
|
|
|
extern int proc_watchdog_thresh(struct ctl_table *, int ,
|
|
|
|
void __user *, size_t *, loff_t *);
|
2015-06-25 07:55:45 +08:00
|
|
|
extern int proc_watchdog_cpumask(struct ctl_table *, int,
|
|
|
|
void __user *, size_t *, loff_t *);
|
2010-02-06 10:47:05 +08:00
|
|
|
|
2014-07-22 17:20:12 +08:00
|
|
|
#ifdef CONFIG_HAVE_ACPI_APEI_NMI
|
|
|
|
#include <asm/nmi.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|