]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/hardirq.h
ceph: quota: add initial infrastructure to support cephfs quotas
[mirror_ubuntu-bionic-kernel.git] / include / linux / hardirq.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef LINUX_HARDIRQ_H
3#define LINUX_HARDIRQ_H
4
92cf2118 5#include <linux/preempt.h>
fbb9ce95 6#include <linux/lockdep.h>
6a60dd12 7#include <linux/ftrace_irq.h>
dcbf832e 8#include <linux/vtime.h>
0bd3a173 9#include <asm/hardirq.h>
1da177e4 10
1da177e4 11
1da177e4 12extern void synchronize_irq(unsigned int irq);
02cea395 13extern bool synchronize_hardirq(unsigned int irq);
1da177e4 14
127781d1 15#if defined(CONFIG_TINY_RCU)
9b1d82fa
PM
16
17static inline void rcu_nmi_enter(void)
18{
19}
20
21static inline void rcu_nmi_exit(void)
22{
23}
24
25#else
64db4cff
PM
26extern void rcu_nmi_enter(void);
27extern void rcu_nmi_exit(void);
9b1d82fa 28#endif
2232c2d8 29
de30a2b3
IM
30/*
31 * It is safe to do non-atomic ops on ->hardirq_context,
32 * because NMI handlers may not preempt and the ops are
33 * always balanced, so the interrupted value of ->hardirq_context
34 * will always be restored.
35 */
79bf2bb3
TG
36#define __irq_enter() \
37 do { \
6a61671b 38 account_irq_enter_time(current); \
bdb43806 39 preempt_count_add(HARDIRQ_OFFSET); \
79bf2bb3
TG
40 trace_hardirq_enter(); \
41 } while (0)
42
43/*
44 * Enter irq context (on NO_HZ, update jiffies):
45 */
dde4b2b5 46extern void irq_enter(void);
de30a2b3
IM
47
48/*
49 * Exit irq context without processing softirqs:
50 */
51#define __irq_exit() \
52 do { \
53 trace_hardirq_exit(); \
6a61671b 54 account_irq_exit_time(current); \
bdb43806 55 preempt_count_sub(HARDIRQ_OFFSET); \
1da177e4
LT
56 } while (0)
57
de30a2b3
IM
58/*
59 * Exit irq context and process softirqs if needed:
60 */
1da177e4
LT
61extern void irq_exit(void);
62
2a7b8df0
SR
63#define nmi_enter() \
64 do { \
42a0bb3f 65 printk_nmi_enter(); \
0f1ac8fd 66 lockdep_off(); \
2a7b8df0
SR
67 ftrace_nmi_enter(); \
68 BUG_ON(in_nmi()); \
bdb43806 69 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
2a7b8df0
SR
70 rcu_nmi_enter(); \
71 trace_hardirq_enter(); \
17666f02 72 } while (0)
5f34fe1c 73
2a7b8df0
SR
74#define nmi_exit() \
75 do { \
76 trace_hardirq_exit(); \
77 rcu_nmi_exit(); \
2a7b8df0 78 BUG_ON(!in_nmi()); \
bdb43806 79 preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
2a7b8df0 80 ftrace_nmi_exit(); \
0f1ac8fd 81 lockdep_on(); \
42a0bb3f 82 printk_nmi_exit(); \
17666f02 83 } while (0)
de30a2b3 84
1da177e4 85#endif /* LINUX_HARDIRQ_H */