// SPDX-License-Identifier: GPL-2.0-only /* Pseudo NMI support on sparc64 systems. * * Copyright (C) 2009 David S. Miller <davem@davemloft.net> * * The NMI watchdog support and infrastructure is based almost * entirely upon the x86 NMI support code.
*/ #include <linux/kernel.h> #include <linux/param.h> #include <linux/init.h> #include <linux/percpu.h> #include <linux/nmi.h> #include <linux/export.h> #include <linux/kprobes.h> #include <linux/kernel_stat.h> #include <linux/reboot.h> #include <linux/slab.h> #include <linux/kdebug.h> #include <linux/delay.h> #include <linux/smp.h>
/* We don't have a real NMI on sparc64, but we can fake one * up using profiling counter overflow interrupts and interrupt * levels. * * The profile overflow interrupts at level 15, so we use * level 14 as our IRQ off level.
*/
staticint panic_on_timeout;
/* nmi_active: * >0: the NMI watchdog is active, but can be disabled * <0: the NMI watchdog has not been set up, and cannot be enabled * 0: the NMI watchdog is disabled, but can be enabled
*/
atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */
EXPORT_SYMBOL(nmi_active); staticint nmi_init_done; staticunsignedint nmi_hz = HZ; static DEFINE_PER_CPU(short, wd_enabled); staticint endflag __initdata;
int __init watchdog_hardlockup_probe(void)
{ return 0;
}
staticvoid die_nmi(constchar *str, struct pt_regs *regs, int do_panic)
{ int this_cpu = smp_processor_id();
if (notify_die(DIE_NMIWATCHDOG, str, regs, 0,
pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) return;
if (do_panic || panic_on_oops)
panic("Watchdog detected hard LOCKUP on cpu %d", this_cpu); else
WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu);
}
/* * sparc specific NMI watchdog enable function. * Enables watchdog if it is not enabled already.
*/ void watchdog_hardlockup_enable(unsignedint cpu)
{ if (atomic_read(&nmi_active) == -1) {
pr_warn("NMI watchdog cannot be enabled or disabled\n"); return;
}
/* * watchdog thread could start even before nmi_init is called. * Just Return in that case. Let nmi_init finish the init * process first.
*/ if (!nmi_init_done) return;
smp_call_function_single(cpu, start_nmi_watchdog, NULL, 1);
} /* * sparc specific NMI watchdog disable function. * Disables watchdog if it is not disabled already.
*/ void watchdog_hardlockup_disable(unsignedint cpu)
{ if (atomic_read(&nmi_active) == -1)
pr_warn_once("NMI watchdog cannot be enabled or disabled\n"); else
smp_call_function_single(cpu, stop_nmi_watchdog, NULL, 1);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.