aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/percpu.h
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-06-19 17:33:31 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-11-19 22:01:21 -0500
commitafdc34a3d3b823a12a93b822ee1efb566f884032 (patch)
treed770a2806476751adba361918edb8826762db730 /include/linux/percpu.h
parentseq_buf: Move the seq_buf code to lib/ (diff)
downloadwireguard-linux-afdc34a3d3b823a12a93b822ee1efb566f884032.tar.xz
wireguard-linux-afdc34a3d3b823a12a93b822ee1efb566f884032.zip
printk: Add per_cpu printk func to allow printk to be diverted
Being able to divert printk to call another function besides the normal logging is useful for such things like NMI handling. If some functions are to be called from NMI that does printk() it is possible to lock up the box if the nmi handler triggers when another printk is happening. One example of this use is to perform a stack trace on all CPUs via NMI. But if the NMI is to do the printk() it can cause the system to lock up. By allowing the printk to be diverted to another function that can safely record the printk output and then print it when it in a safe context then NMIs will be safe to call these functions like show_regs(). Link: http://lkml.kernel.org/p/20140619213952.209176403@goodmis.org Tested-by: Jiri Kosina <jkosina@suse.cz> Acked-by: Jiri Kosina <jkosina@suse.cz> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Petr Mladek <pmladek@suse.cz> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r--include/linux/percpu.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index a3aa63e47637..ba2e85a0ff5b 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -134,4 +134,7 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
(typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
__alignof__(type))
+/* To avoid include hell, as printk can not declare this, we declare it here */
+DECLARE_PER_CPU(printk_func_t, printk_func);
+
#endif /* __LINUX_PERCPU_H */