LCOV - code coverage report
Current view: top level - arch/x86/kernel/apic - hw_nmi.c (source / functions) Hit Total Coverage
Test: landlock.info Lines: 3 12 25.0 %
Date: 2021-04-22 12:43:58 Functions: 1 4 25.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0
       2             : /*
       3             :  *  HW NMI watchdog support
       4             :  *
       5             :  *  started by Don Zickus, Copyright (C) 2010 Red Hat, Inc.
       6             :  *
       7             :  *  Arch specific calls to support NMI watchdog
       8             :  *
       9             :  *  Bits copied from original nmi.c file
      10             :  *
      11             :  */
      12             : #include <linux/thread_info.h>
      13             : #include <asm/apic.h>
      14             : #include <asm/nmi.h>
      15             : 
      16             : #include <linux/cpumask.h>
      17             : #include <linux/kdebug.h>
      18             : #include <linux/notifier.h>
      19             : #include <linux/kprobes.h>
      20             : #include <linux/nmi.h>
      21             : #include <linux/init.h>
      22             : #include <linux/delay.h>
      23             : 
      24             : #ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
      25             : u64 hw_nmi_get_sample_period(int watchdog_thresh)
      26             : {
      27             :         return (u64)(cpu_khz) * 1000 * watchdog_thresh;
      28             : }
      29             : #endif
      30             : 
      31             : #ifdef arch_trigger_cpumask_backtrace
      32           0 : static void nmi_raise_cpu_backtrace(cpumask_t *mask)
      33             : {
      34           0 :         apic->send_IPI_mask(mask, NMI_VECTOR);
      35           0 : }
      36             : 
      37           0 : void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
      38             : {
      39           0 :         nmi_trigger_cpumask_backtrace(mask, exclude_self,
      40             :                                       nmi_raise_cpu_backtrace);
      41           0 : }
      42             : 
      43           0 : static int nmi_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
      44             : {
      45           0 :         if (nmi_cpu_backtrace(regs))
      46           0 :                 return NMI_HANDLED;
      47             : 
      48             :         return NMI_DONE;
      49             : }
      50             : NOKPROBE_SYMBOL(nmi_cpu_backtrace_handler);
      51             : 
      52           1 : static int __init register_nmi_cpu_backtrace_handler(void)
      53             : {
      54           1 :         register_nmi_handler(NMI_LOCAL, nmi_cpu_backtrace_handler,
      55             :                                 0, "arch_bt");
      56           1 :         return 0;
      57             : }
      58             : early_initcall(register_nmi_cpu_backtrace_handler);
      59             : #endif

Generated by: LCOV version 1.14