Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f92bac3b authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Petr Mladek
Browse files

printk: rename nmi.c and exported api

A preparation patch for printk_safe work. No functional change.
- rename nmi.c to print_safe.c
- add `printk_safe' prefix to some (which used both by printk-safe
  and printk-nmi) of the exported functions.

Link: http://lkml.kernel.org/r/20161227141611.940-3-sergey.senozhatsky@gmail.com


Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Cc: Calvin Owens <calvinowens@fb.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
parent bd66a892
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -147,17 +147,17 @@ void early_printk(const char *s, ...) { }
#endif

#ifdef CONFIG_PRINTK_NMI
extern void printk_nmi_init(void);
extern void printk_safe_init(void);
extern void printk_nmi_enter(void);
extern void printk_nmi_exit(void);
extern void printk_nmi_flush(void);
extern void printk_nmi_flush_on_panic(void);
extern void printk_safe_flush(void);
extern void printk_safe_flush_on_panic(void);
#else
static inline void printk_nmi_init(void) { }
static inline void printk_safe_init(void) { }
static inline void printk_nmi_enter(void) { }
static inline void printk_nmi_exit(void) { }
static inline void printk_nmi_flush(void) { }
static inline void printk_nmi_flush_on_panic(void) { }
static inline void printk_safe_flush(void) { }
static inline void printk_safe_flush_on_panic(void) { }
#endif /* PRINTK_NMI */

#ifdef CONFIG_PRINTK
+9 −7
Original line number Diff line number Diff line
@@ -875,17 +875,19 @@ config LOG_CPU_MAX_BUF_SHIFT
		     13 =>   8 KB for each CPU
		     12 =>   4 KB for each CPU

config NMI_LOG_BUF_SHIFT
	int "Temporary per-CPU NMI log buffer size (12 => 4KB, 13 => 8KB)"
config PRINTK_SAFE_LOG_BUF_SHIFT
	int "Temporary per-CPU printk log buffer size (12 => 4KB, 13 => 8KB)"
	range 10 21
	default 13
	depends on PRINTK_NMI
	depends on PRINTK
	help
	  Select the size of a per-CPU buffer where NMI messages are temporary
	  stored. They are copied to the main log buffer in a safe context
	  to avoid a deadlock. The value defines the size as a power of 2.
	  Select the size of an alternate printk per-CPU buffer where messages
	  printed from usafe contexts are temporary stored. One example would
	  be NMI messages, another one - printk recursion. The messages are
	  copied to the main log buffer in a safe context to avoid a deadlock.
	  The value defines the size as a power of 2.

	  NMI messages are rare and limited. The largest one is when
	  Those messages are rare and limited. The largest one is when
	  a backtrace is printed. It usually fits into 4KB. Select
	  8KB if you want to be on the safe side.

+1 −1
Original line number Diff line number Diff line
@@ -580,7 +580,7 @@ asmlinkage __visible void __init start_kernel(void)
	timekeeping_init();
	time_init();
	sched_clock_postinit();
	printk_nmi_init();
	printk_safe_init();
	perf_event_init();
	profile_init();
	call_function_init();
+1 −1
Original line number Diff line number Diff line
@@ -916,7 +916,7 @@ void crash_kexec(struct pt_regs *regs)
	old_cpu = atomic_cmpxchg(&panic_cpu, PANIC_CPU_INVALID, this_cpu);
	if (old_cpu == PANIC_CPU_INVALID) {
		/* This is the 1st CPU which comes here, so go ahead. */
		printk_nmi_flush_on_panic();
		printk_safe_flush_on_panic();
		__crash_kexec(regs);

		/*
+2 −2
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ void panic(const char *fmt, ...)
	 * Bypass the panic_cpu check and call __crash_kexec directly.
	 */
	if (!_crash_kexec_post_notifiers) {
		printk_nmi_flush_on_panic();
		printk_safe_flush_on_panic();
		__crash_kexec(NULL);

		/*
@@ -213,7 +213,7 @@ void panic(const char *fmt, ...)
	atomic_notifier_call_chain(&panic_notifier_list, 0, buf);

	/* Call flush even twice. It tries harder with a single online CPU */
	printk_nmi_flush_on_panic();
	printk_safe_flush_on_panic();
	kmsg_dump(KMSG_DUMP_PANIC);

	/*
Loading