Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kernel.h: split out panic and oops helpers

kernel.h is being used as a dump for all kinds of stuff for a long time.
Here is the attempt to start cleaning it up by splitting out panic and
oops helpers.

There are several purposes of doing this:
- dropping dependency in bug.h
- dropping a loop by moving out panic_notifier.h
- unload kernel.h from something which has its own domain

At the same time convert users tree-wide to use new headers, although for
the time being include new header back to kernel.h to avoid twisted
indirected includes for existing users.

[akpm@linux-foundation.org: thread_info.h needs limits.h]
[andriy.shevchenko@linux.intel.com: ia64 fix]
Link: https://lkml.kernel.org/r/20210520130557.55277-1-andriy.shevchenko@linux.intel.com

Link: https://lkml.kernel.org/r/20210511074137.33666-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Co-developed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Wei Liu <wei.liu@kernel.org>
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Acked-by: Helge Deller <deller@gmx.de> # parisc
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andy Shevchenko and committed by
Linus Torvalds
f39650de 070c4650

+169 -85
+1 -1
arch/alpha/kernel/setup.c
··· 28 28 #include <linux/init.h> 29 29 #include <linux/string.h> 30 30 #include <linux/ioport.h> 31 + #include <linux/panic_notifier.h> 31 32 #include <linux/platform_device.h> 32 33 #include <linux/memblock.h> 33 34 #include <linux/pci.h> ··· 47 46 #include <linux/log2.h> 48 47 #include <linux/export.h> 49 48 50 - extern struct atomic_notifier_head panic_notifier_list; 51 49 static int alpha_panic_event(struct notifier_block *, unsigned long, void *); 52 50 static struct notifier_block alpha_panic_block = { 53 51 alpha_panic_event,
+1
arch/arm64/kernel/setup.c
··· 23 23 #include <linux/interrupt.h> 24 24 #include <linux/smp.h> 25 25 #include <linux/fs.h> 26 + #include <linux/panic_notifier.h> 26 27 #include <linux/proc_fs.h> 27 28 #include <linux/memblock.h> 28 29 #include <linux/of_fdt.h>
+1
arch/ia64/include/asm/pal.h
··· 99 99 100 100 #include <linux/types.h> 101 101 #include <asm/fpu.h> 102 + #include <asm/intrinsics.h> 102 103 103 104 /* 104 105 * Data types needed to pass information into PAL procedures and
+1
arch/mips/kernel/relocate.c
··· 18 18 #include <linux/kernel.h> 19 19 #include <linux/libfdt.h> 20 20 #include <linux/of_fdt.h> 21 + #include <linux/panic_notifier.h> 21 22 #include <linux/sched/task.h> 22 23 #include <linux/start_kernel.h> 23 24 #include <linux/string.h>
+1
arch/mips/sgi-ip22/ip22-reset.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/sched/signal.h> 14 14 #include <linux/notifier.h> 15 + #include <linux/panic_notifier.h> 15 16 #include <linux/pm.h> 16 17 #include <linux/timer.h> 17 18
+1
arch/mips/sgi-ip32/ip32-reset.c
··· 12 12 #include <linux/init.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/module.h> 15 + #include <linux/panic_notifier.h> 15 16 #include <linux/sched.h> 16 17 #include <linux/sched/signal.h> 17 18 #include <linux/notifier.h>
+1
arch/parisc/kernel/pdc_chassis.c
··· 20 20 #include <linux/init.h> 21 21 #include <linux/module.h> 22 22 #include <linux/kernel.h> 23 + #include <linux/panic_notifier.h> 23 24 #include <linux/reboot.h> 24 25 #include <linux/notifier.h> 25 26 #include <linux/cache.h>
+1
arch/powerpc/kernel/setup-common.c
··· 9 9 #undef DEBUG 10 10 11 11 #include <linux/export.h> 12 + #include <linux/panic_notifier.h> 12 13 #include <linux/string.h> 13 14 #include <linux/sched.h> 14 15 #include <linux/init.h>
+1
arch/s390/kernel/ipl.c
··· 13 13 #include <linux/init.h> 14 14 #include <linux/device.h> 15 15 #include <linux/delay.h> 16 + #include <linux/panic_notifier.h> 16 17 #include <linux/reboot.h> 17 18 #include <linux/ctype.h> 18 19 #include <linux/fs.h>
+1
arch/sparc/kernel/sstate.c
··· 6 6 7 7 #include <linux/kernel.h> 8 8 #include <linux/notifier.h> 9 + #include <linux/panic_notifier.h> 9 10 #include <linux/reboot.h> 10 11 #include <linux/init.h> 11 12
+1
arch/um/drivers/mconsole_kern.c
··· 12 12 #include <linux/mm.h> 13 13 #include <linux/module.h> 14 14 #include <linux/notifier.h> 15 + #include <linux/panic_notifier.h> 15 16 #include <linux/reboot.h> 16 17 #include <linux/sched/debug.h> 17 18 #include <linux/proc_fs.h>
+1
arch/um/kernel/um_arch.c
··· 7 7 #include <linux/init.h> 8 8 #include <linux/mm.h> 9 9 #include <linux/module.h> 10 + #include <linux/panic_notifier.h> 10 11 #include <linux/seq_file.h> 11 12 #include <linux/string.h> 12 13 #include <linux/utsname.h>
+1
arch/x86/include/asm/desc.h
··· 9 9 #include <asm/irq_vectors.h> 10 10 #include <asm/cpu_entry_area.h> 11 11 12 + #include <linux/debug_locks.h> 12 13 #include <linux/smp.h> 13 14 #include <linux/percpu.h> 14 15
+1
arch/x86/kernel/cpu/mshyperv.c
··· 17 17 #include <linux/irq.h> 18 18 #include <linux/kexec.h> 19 19 #include <linux/i8253.h> 20 + #include <linux/panic_notifier.h> 20 21 #include <linux/random.h> 21 22 #include <asm/processor.h> 22 23 #include <asm/hypervisor.h>
+1
arch/x86/kernel/setup.c
··· 14 14 #include <linux/initrd.h> 15 15 #include <linux/iscsi_ibft.h> 16 16 #include <linux/memblock.h> 17 + #include <linux/panic_notifier.h> 17 18 #include <linux/pci.h> 18 19 #include <linux/root_dev.h> 19 20 #include <linux/hugetlb.h>
+2
arch/x86/purgatory/purgatory.c
··· 9 9 */ 10 10 11 11 #include <linux/bug.h> 12 + #include <linux/kernel.h> 13 + #include <linux/types.h> 12 14 #include <crypto/sha2.h> 13 15 #include <asm/purgatory.h> 14 16
+1
arch/x86/xen/enlighten.c
··· 6 6 #include <linux/cpu.h> 7 7 #include <linux/kexec.h> 8 8 #include <linux/slab.h> 9 + #include <linux/panic_notifier.h> 9 10 10 11 #include <xen/xen.h> 11 12 #include <xen/features.h>
+1
arch/xtensa/platforms/iss/setup.c
··· 14 14 #include <linux/init.h> 15 15 #include <linux/kernel.h> 16 16 #include <linux/notifier.h> 17 + #include <linux/panic_notifier.h> 17 18 #include <linux/printk.h> 18 19 #include <linux/string.h> 19 20
+1
drivers/bus/brcmstb_gisb.c
··· 6 6 #include <linux/init.h> 7 7 #include <linux/types.h> 8 8 #include <linux/module.h> 9 + #include <linux/panic_notifier.h> 9 10 #include <linux/platform_device.h> 10 11 #include <linux/interrupt.h> 11 12 #include <linux/sysfs.h>
+1
drivers/char/ipmi/ipmi_msghandler.c
··· 16 16 17 17 #include <linux/module.h> 18 18 #include <linux/errno.h> 19 + #include <linux/panic_notifier.h> 19 20 #include <linux/poll.h> 20 21 #include <linux/sched.h> 21 22 #include <linux/seq_file.h>
+4
drivers/clk/analogbits/wrpll-cln28hpc.c
··· 23 23 24 24 #include <linux/bug.h> 25 25 #include <linux/err.h> 26 + #include <linux/limits.h> 26 27 #include <linux/log2.h> 27 28 #include <linux/math64.h> 29 + #include <linux/math.h> 30 + #include <linux/minmax.h> 31 + 28 32 #include <linux/clk/analogbits-wrpll-cln28hpc.h> 29 33 30 34 /* MIN_INPUT_FREQ: minimum input clock frequency, in Hz (Fref_min) */
+1
drivers/edac/altera_edac.c
··· 20 20 #include <linux/of_address.h> 21 21 #include <linux/of_irq.h> 22 22 #include <linux/of_platform.h> 23 + #include <linux/panic_notifier.h> 23 24 #include <linux/platform_device.h> 24 25 #include <linux/regmap.h> 25 26 #include <linux/types.h>
+1
drivers/firmware/google/gsmi.c
··· 19 19 #include <linux/dma-mapping.h> 20 20 #include <linux/fs.h> 21 21 #include <linux/slab.h> 22 + #include <linux/panic_notifier.h> 22 23 #include <linux/ioctl.h> 23 24 #include <linux/acpi.h> 24 25 #include <linux/io.h>
+1
drivers/hv/vmbus_drv.c
··· 25 25 26 26 #include <linux/delay.h> 27 27 #include <linux/notifier.h> 28 + #include <linux/panic_notifier.h> 28 29 #include <linux/ptrace.h> 29 30 #include <linux/screen_info.h> 30 31 #include <linux/kdebug.h>
+1
drivers/hwtracing/coresight/coresight-cpu-debug.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/module.h> 19 19 #include <linux/moduleparam.h> 20 + #include <linux/panic_notifier.h> 20 21 #include <linux/pm_qos.h> 21 22 #include <linux/slab.h> 22 23 #include <linux/smp.h>
+1
drivers/leds/trigger/ledtrig-activity.c
··· 11 11 #include <linux/kernel_stat.h> 12 12 #include <linux/leds.h> 13 13 #include <linux/module.h> 14 + #include <linux/panic_notifier.h> 14 15 #include <linux/reboot.h> 15 16 #include <linux/sched.h> 16 17 #include <linux/slab.h>
+1
drivers/leds/trigger/ledtrig-heartbeat.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/kernel.h> 13 13 #include <linux/init.h> 14 + #include <linux/panic_notifier.h> 14 15 #include <linux/slab.h> 15 16 #include <linux/timer.h> 16 17 #include <linux/sched.h>
+1
drivers/leds/trigger/ledtrig-panic.c
··· 8 8 #include <linux/kernel.h> 9 9 #include <linux/init.h> 10 10 #include <linux/notifier.h> 11 + #include <linux/panic_notifier.h> 11 12 #include <linux/leds.h> 12 13 #include "../leds.h" 13 14
+1
drivers/misc/bcm-vk/bcm_vk_dev.c
··· 9 9 #include <linux/fs.h> 10 10 #include <linux/idr.h> 11 11 #include <linux/interrupt.h> 12 + #include <linux/panic_notifier.h> 12 13 #include <linux/kref.h> 13 14 #include <linux/module.h> 14 15 #include <linux/mutex.h>
+1
drivers/misc/ibmasm/heartbeat.c
··· 9 9 */ 10 10 11 11 #include <linux/notifier.h> 12 + #include <linux/panic_notifier.h> 12 13 #include "ibmasm.h" 13 14 #include "dot_command.h" 14 15 #include "lowlevel.h"
+1
drivers/misc/pvpanic/pvpanic.c
··· 13 13 #include <linux/mod_devicetable.h> 14 14 #include <linux/module.h> 15 15 #include <linux/platform_device.h> 16 + #include <linux/panic_notifier.h> 16 17 #include <linux/types.h> 17 18 #include <linux/cdev.h> 18 19 #include <linux/list.h>
+1
drivers/net/ipa/ipa_smp2p.c
··· 8 8 #include <linux/device.h> 9 9 #include <linux/interrupt.h> 10 10 #include <linux/notifier.h> 11 + #include <linux/panic_notifier.h> 11 12 #include <linux/soc/qcom/smem.h> 12 13 #include <linux/soc/qcom/smem_state.h> 13 14
+1
drivers/parisc/power.c
··· 38 38 #include <linux/init.h> 39 39 #include <linux/kernel.h> 40 40 #include <linux/notifier.h> 41 + #include <linux/panic_notifier.h> 41 42 #include <linux/reboot.h> 42 43 #include <linux/sched/signal.h> 43 44 #include <linux/kthread.h>
+1
drivers/power/reset/ltc2952-poweroff.c
··· 52 52 #include <linux/slab.h> 53 53 #include <linux/kmod.h> 54 54 #include <linux/module.h> 55 + #include <linux/panic_notifier.h> 55 56 #include <linux/mod_devicetable.h> 56 57 #include <linux/gpio/consumer.h> 57 58 #include <linux/reboot.h>
+1
drivers/remoteproc/remoteproc_core.c
··· 20 20 #include <linux/kernel.h> 21 21 #include <linux/module.h> 22 22 #include <linux/device.h> 23 + #include <linux/panic_notifier.h> 23 24 #include <linux/slab.h> 24 25 #include <linux/mutex.h> 25 26 #include <linux/dma-map-ops.h>
+1
drivers/s390/char/con3215.c
··· 19 19 #include <linux/console.h> 20 20 #include <linux/interrupt.h> 21 21 #include <linux/err.h> 22 + #include <linux/panic_notifier.h> 22 23 #include <linux/reboot.h> 23 24 #include <linux/serial.h> /* ASYNC_* flags */ 24 25 #include <linux/slab.h>
+1
drivers/s390/char/con3270.c
··· 13 13 #include <linux/init.h> 14 14 #include <linux/interrupt.h> 15 15 #include <linux/list.h> 16 + #include <linux/panic_notifier.h> 16 17 #include <linux/types.h> 17 18 #include <linux/slab.h> 18 19 #include <linux/err.h>
+1
drivers/s390/char/sclp.c
··· 11 11 #include <linux/kernel_stat.h> 12 12 #include <linux/module.h> 13 13 #include <linux/err.h> 14 + #include <linux/panic_notifier.h> 14 15 #include <linux/spinlock.h> 15 16 #include <linux/interrupt.h> 16 17 #include <linux/timer.h>
+1
drivers/s390/char/sclp_con.c
··· 10 10 #include <linux/kmod.h> 11 11 #include <linux/console.h> 12 12 #include <linux/init.h> 13 + #include <linux/panic_notifier.h> 13 14 #include <linux/timer.h> 14 15 #include <linux/jiffies.h> 15 16 #include <linux/termios.h>
+1
drivers/s390/char/sclp_vt220.c
··· 9 9 10 10 #include <linux/module.h> 11 11 #include <linux/spinlock.h> 12 + #include <linux/panic_notifier.h> 12 13 #include <linux/list.h> 13 14 #include <linux/wait.h> 14 15 #include <linux/timer.h>
+1
drivers/s390/char/zcore.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/slab.h> 17 17 #include <linux/debugfs.h> 18 + #include <linux/panic_notifier.h> 18 19 #include <linux/reboot.h> 19 20 20 21 #include <asm/asm-offsets.h>
+1
drivers/soc/bcm/brcmstb/pm/pm-arm.c
··· 28 28 #include <linux/notifier.h> 29 29 #include <linux/of.h> 30 30 #include <linux/of_address.h> 31 + #include <linux/panic_notifier.h> 31 32 #include <linux/platform_device.h> 32 33 #include <linux/pm.h> 33 34 #include <linux/printk.h>
+1
drivers/staging/olpc_dcon/olpc_dcon.c
··· 22 22 #include <linux/device.h> 23 23 #include <linux/uaccess.h> 24 24 #include <linux/ctype.h> 25 + #include <linux/panic_notifier.h> 25 26 #include <linux/reboot.h> 26 27 #include <linux/olpc-ec.h> 27 28 #include <asm/tsc.h>
+1
drivers/video/fbdev/hyperv_fb.c
··· 52 52 #include <linux/completion.h> 53 53 #include <linux/fb.h> 54 54 #include <linux/pci.h> 55 + #include <linux/panic_notifier.h> 55 56 #include <linux/efi.h> 56 57 #include <linux/console.h> 57 58
+2 -1
include/asm-generic/bug.h
··· 17 17 #endif 18 18 19 19 #ifndef __ASSEMBLY__ 20 - #include <linux/kernel.h> 20 + #include <linux/panic.h> 21 + #include <linux/printk.h> 21 22 22 23 #ifdef CONFIG_BUG 23 24
+1 -83
include/linux/kernel.h
··· 14 14 #include <linux/math.h> 15 15 #include <linux/minmax.h> 16 16 #include <linux/typecheck.h> 17 + #include <linux/panic.h> 17 18 #include <linux/printk.h> 18 19 #include <linux/build_bug.h> 19 20 #include <linux/static_call_types.h> ··· 73 72 #define lower_32_bits(n) ((u32)((n) & 0xffffffff)) 74 73 75 74 struct completion; 76 - struct pt_regs; 77 75 struct user; 78 76 79 77 #ifdef CONFIG_PREEMPT_VOLUNTARY ··· 177 177 static inline void might_fault(void) { } 178 178 #endif 179 179 180 - extern struct atomic_notifier_head panic_notifier_list; 181 - extern long (*panic_blink)(int state); 182 - __printf(1, 2) 183 - void panic(const char *fmt, ...) __noreturn __cold; 184 - void nmi_panic(struct pt_regs *regs, const char *msg); 185 - extern void oops_enter(void); 186 - extern void oops_exit(void); 187 - extern bool oops_may_print(void); 188 180 void do_exit(long error_code) __noreturn; 189 181 void complete_and_exit(struct completion *, long) __noreturn; 190 182 ··· 364 372 extern int kernel_text_address(unsigned long addr); 365 373 extern int func_ptr_is_kernel_text(void *ptr); 366 374 367 - #ifdef CONFIG_SMP 368 - extern unsigned int sysctl_oops_all_cpu_backtrace; 369 - #else 370 - #define sysctl_oops_all_cpu_backtrace 0 371 - #endif /* CONFIG_SMP */ 372 - 373 375 extern void bust_spinlocks(int yes); 374 - extern int panic_timeout; 375 - extern unsigned long panic_print; 376 - extern int panic_on_oops; 377 - extern int panic_on_unrecovered_nmi; 378 - extern int panic_on_io_nmi; 379 - extern int panic_on_warn; 380 - extern unsigned long panic_on_taint; 381 - extern bool panic_on_taint_nousertaint; 382 - extern int sysctl_panic_on_rcu_stall; 383 - extern int sysctl_max_rcu_stall_to_panic; 384 - extern int sysctl_panic_on_stackoverflow; 385 376 386 - extern bool crash_kexec_post_notifiers; 387 - 388 - /* 389 - * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It 390 - * holds a CPU number which is executing panic() currently. A value of 391 - * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec(). 392 - */ 393 - extern atomic_t panic_cpu; 394 - #define PANIC_CPU_INVALID -1 395 - 396 - /* 397 - * Only to be used by arch init code. If the user over-wrote the default 398 - * CONFIG_PANIC_TIMEOUT, honor it. 399 - */ 400 - static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout) 401 - { 402 - if (panic_timeout == arch_default_timeout) 403 - panic_timeout = timeout; 404 - } 405 - extern const char *print_tainted(void); 406 - enum lockdep_ok { 407 - LOCKDEP_STILL_OK, 408 - LOCKDEP_NOW_UNRELIABLE 409 - }; 410 - extern void add_taint(unsigned flag, enum lockdep_ok); 411 - extern int test_taint(unsigned flag); 412 - extern unsigned long get_taint(void); 413 377 extern int root_mountflags; 414 378 415 379 extern bool early_boot_irqs_disabled; ··· 383 435 SYSTEM_RESTART, 384 436 SYSTEM_SUSPEND, 385 437 } system_state; 386 - 387 - /* This cannot be an enum because some may be used in assembly source. */ 388 - #define TAINT_PROPRIETARY_MODULE 0 389 - #define TAINT_FORCED_MODULE 1 390 - #define TAINT_CPU_OUT_OF_SPEC 2 391 - #define TAINT_FORCED_RMMOD 3 392 - #define TAINT_MACHINE_CHECK 4 393 - #define TAINT_BAD_PAGE 5 394 - #define TAINT_USER 6 395 - #define TAINT_DIE 7 396 - #define TAINT_OVERRIDDEN_ACPI_TABLE 8 397 - #define TAINT_WARN 9 398 - #define TAINT_CRAP 10 399 - #define TAINT_FIRMWARE_WORKAROUND 11 400 - #define TAINT_OOT_MODULE 12 401 - #define TAINT_UNSIGNED_MODULE 13 402 - #define TAINT_SOFTLOCKUP 14 403 - #define TAINT_LIVEPATCH 15 404 - #define TAINT_AUX 16 405 - #define TAINT_RANDSTRUCT 17 406 - #define TAINT_FLAGS_COUNT 18 407 - #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1) 408 - 409 - struct taint_flag { 410 - char c_true; /* character printed when tainted */ 411 - char c_false; /* character printed when not tainted */ 412 - bool module; /* also show as a per-module taint flag */ 413 - }; 414 - 415 - extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT]; 416 438 417 439 extern const char hex_asc[]; 418 440 #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
+98
include/linux/panic.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _LINUX_PANIC_H 3 + #define _LINUX_PANIC_H 4 + 5 + #include <linux/compiler_attributes.h> 6 + #include <linux/types.h> 7 + 8 + struct pt_regs; 9 + 10 + extern long (*panic_blink)(int state); 11 + __printf(1, 2) 12 + void panic(const char *fmt, ...) __noreturn __cold; 13 + void nmi_panic(struct pt_regs *regs, const char *msg); 14 + extern void oops_enter(void); 15 + extern void oops_exit(void); 16 + extern bool oops_may_print(void); 17 + 18 + #ifdef CONFIG_SMP 19 + extern unsigned int sysctl_oops_all_cpu_backtrace; 20 + #else 21 + #define sysctl_oops_all_cpu_backtrace 0 22 + #endif /* CONFIG_SMP */ 23 + 24 + extern int panic_timeout; 25 + extern unsigned long panic_print; 26 + extern int panic_on_oops; 27 + extern int panic_on_unrecovered_nmi; 28 + extern int panic_on_io_nmi; 29 + extern int panic_on_warn; 30 + 31 + extern unsigned long panic_on_taint; 32 + extern bool panic_on_taint_nousertaint; 33 + 34 + extern int sysctl_panic_on_rcu_stall; 35 + extern int sysctl_max_rcu_stall_to_panic; 36 + extern int sysctl_panic_on_stackoverflow; 37 + 38 + extern bool crash_kexec_post_notifiers; 39 + 40 + /* 41 + * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It 42 + * holds a CPU number which is executing panic() currently. A value of 43 + * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec(). 44 + */ 45 + extern atomic_t panic_cpu; 46 + #define PANIC_CPU_INVALID -1 47 + 48 + /* 49 + * Only to be used by arch init code. If the user over-wrote the default 50 + * CONFIG_PANIC_TIMEOUT, honor it. 51 + */ 52 + static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout) 53 + { 54 + if (panic_timeout == arch_default_timeout) 55 + panic_timeout = timeout; 56 + } 57 + 58 + /* This cannot be an enum because some may be used in assembly source. */ 59 + #define TAINT_PROPRIETARY_MODULE 0 60 + #define TAINT_FORCED_MODULE 1 61 + #define TAINT_CPU_OUT_OF_SPEC 2 62 + #define TAINT_FORCED_RMMOD 3 63 + #define TAINT_MACHINE_CHECK 4 64 + #define TAINT_BAD_PAGE 5 65 + #define TAINT_USER 6 66 + #define TAINT_DIE 7 67 + #define TAINT_OVERRIDDEN_ACPI_TABLE 8 68 + #define TAINT_WARN 9 69 + #define TAINT_CRAP 10 70 + #define TAINT_FIRMWARE_WORKAROUND 11 71 + #define TAINT_OOT_MODULE 12 72 + #define TAINT_UNSIGNED_MODULE 13 73 + #define TAINT_SOFTLOCKUP 14 74 + #define TAINT_LIVEPATCH 15 75 + #define TAINT_AUX 16 76 + #define TAINT_RANDSTRUCT 17 77 + #define TAINT_FLAGS_COUNT 18 78 + #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1) 79 + 80 + struct taint_flag { 81 + char c_true; /* character printed when tainted */ 82 + char c_false; /* character printed when not tainted */ 83 + bool module; /* also show as a per-module taint flag */ 84 + }; 85 + 86 + extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT]; 87 + 88 + enum lockdep_ok { 89 + LOCKDEP_STILL_OK, 90 + LOCKDEP_NOW_UNRELIABLE, 91 + }; 92 + 93 + extern const char *print_tainted(void); 94 + extern void add_taint(unsigned flag, enum lockdep_ok); 95 + extern int test_taint(unsigned flag); 96 + extern unsigned long get_taint(void); 97 + 98 + #endif /* _LINUX_PANIC_H */
+12
include/linux/panic_notifier.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _LINUX_PANIC_NOTIFIERS_H 3 + #define _LINUX_PANIC_NOTIFIERS_H 4 + 5 + #include <linux/notifier.h> 6 + #include <linux/types.h> 7 + 8 + extern struct atomic_notifier_head panic_notifier_list; 9 + 10 + extern bool crash_kexec_post_notifiers; 11 + 12 + #endif /* _LINUX_PANIC_NOTIFIERS_H */
+1
include/linux/thread_info.h
··· 9 9 #define _LINUX_THREAD_INFO_H 10 10 11 11 #include <linux/types.h> 12 + #include <linux/limits.h> 12 13 #include <linux/bug.h> 13 14 #include <linux/restart_block.h> 14 15 #include <linux/errno.h>
+1
kernel/hung_task.c
··· 15 15 #include <linux/kthread.h> 16 16 #include <linux/lockdep.h> 17 17 #include <linux/export.h> 18 + #include <linux/panic_notifier.h> 18 19 #include <linux/sysctl.h> 19 20 #include <linux/suspend.h> 20 21 #include <linux/utsname.h>
+1
kernel/kexec_core.c
··· 26 26 #include <linux/suspend.h> 27 27 #include <linux/device.h> 28 28 #include <linux/freezer.h> 29 + #include <linux/panic_notifier.h> 29 30 #include <linux/pm.h> 30 31 #include <linux/cpu.h> 31 32 #include <linux/uaccess.h>
+1
kernel/panic.c
··· 23 23 #include <linux/reboot.h> 24 24 #include <linux/delay.h> 25 25 #include <linux/kexec.h> 26 + #include <linux/panic_notifier.h> 26 27 #include <linux/sched.h> 27 28 #include <linux/sysrq.h> 28 29 #include <linux/init.h>
+2
kernel/rcu/tree.c
··· 32 32 #include <linux/export.h> 33 33 #include <linux/completion.h> 34 34 #include <linux/moduleparam.h> 35 + #include <linux/panic.h> 36 + #include <linux/panic_notifier.h> 35 37 #include <linux/percpu.h> 36 38 #include <linux/notifier.h> 37 39 #include <linux/cpu.h>
+1
kernel/sysctl.c
··· 27 27 #include <linux/sysctl.h> 28 28 #include <linux/bitmap.h> 29 29 #include <linux/signal.h> 30 + #include <linux/panic.h> 30 31 #include <linux/printk.h> 31 32 #include <linux/proc_fs.h> 32 33 #include <linux/security.h>
+1
kernel/trace/trace.c
··· 39 39 #include <linux/slab.h> 40 40 #include <linux/ctype.h> 41 41 #include <linux/init.h> 42 + #include <linux/panic_notifier.h> 42 43 #include <linux/poll.h> 43 44 #include <linux/nmi.h> 44 45 #include <linux/fs.h>