~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/irqflags.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/irqflags.h (Version linux-6.11.5) and /include/linux/irqflags.h (Version linux-5.7.19)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * include/linux/irqflags.h                         3  * include/linux/irqflags.h
  4  *                                                  4  *
  5  * IRQ flags tracing: follow the state of the       5  * IRQ flags tracing: follow the state of the hardirq and softirq flags and
  6  * provide callbacks for transitions between O      6  * provide callbacks for transitions between ON and OFF states.
  7  *                                                  7  *
  8  * This file gets included from lowlevel asm h      8  * This file gets included from lowlevel asm headers too, to provide
  9  * wrapped versions of the local_irq_*() APIs,      9  * wrapped versions of the local_irq_*() APIs, based on the
 10  * raw_local_irq_*() macros from the lowlevel      10  * raw_local_irq_*() macros from the lowlevel headers.
 11  */                                                11  */
 12 #ifndef _LINUX_TRACE_IRQFLAGS_H                    12 #ifndef _LINUX_TRACE_IRQFLAGS_H
 13 #define _LINUX_TRACE_IRQFLAGS_H                    13 #define _LINUX_TRACE_IRQFLAGS_H
 14                                                    14 
 15 #include <linux/irqflags_types.h>              << 
 16 #include <linux/typecheck.h>                       15 #include <linux/typecheck.h>
 17 #include <linux/cleanup.h>                     << 
 18 #include <asm/irqflags.h>                          16 #include <asm/irqflags.h>
 19 #include <asm/percpu.h>                        << 
 20                                                    17 
 21 /* Currently lockdep_softirqs_on/off is used o     18 /* Currently lockdep_softirqs_on/off is used only by lockdep */
 22 #ifdef CONFIG_PROVE_LOCKING                        19 #ifdef CONFIG_PROVE_LOCKING
 23   extern void lockdep_softirqs_on(unsigned lon     20   extern void lockdep_softirqs_on(unsigned long ip);
 24   extern void lockdep_softirqs_off(unsigned lo     21   extern void lockdep_softirqs_off(unsigned long ip);
 25   extern void lockdep_hardirqs_on_prepare(void << 
 26   extern void lockdep_hardirqs_on(unsigned lon     22   extern void lockdep_hardirqs_on(unsigned long ip);
 27   extern void lockdep_hardirqs_off(unsigned lo     23   extern void lockdep_hardirqs_off(unsigned long ip);
 28 #else                                              24 #else
 29   static inline void lockdep_softirqs_on(unsig     25   static inline void lockdep_softirqs_on(unsigned long ip) { }
 30   static inline void lockdep_softirqs_off(unsi     26   static inline void lockdep_softirqs_off(unsigned long ip) { }
 31   static inline void lockdep_hardirqs_on_prepa << 
 32   static inline void lockdep_hardirqs_on(unsig     27   static inline void lockdep_hardirqs_on(unsigned long ip) { }
 33   static inline void lockdep_hardirqs_off(unsi     28   static inline void lockdep_hardirqs_off(unsigned long ip) { }
 34 #endif                                             29 #endif
 35                                                    30 
 36 #ifdef CONFIG_TRACE_IRQFLAGS                       31 #ifdef CONFIG_TRACE_IRQFLAGS
 37                                                !!  32   extern void trace_hardirqs_on(void);
 38 DECLARE_PER_CPU(int, hardirqs_enabled);        !!  33   extern void trace_hardirqs_off(void);
 39 DECLARE_PER_CPU(int, hardirq_context);         !!  34 # define lockdep_hardirq_context(p)     ((p)->hardirq_context)
 40                                                << 
 41 extern void trace_hardirqs_on_prepare(void);   << 
 42 extern void trace_hardirqs_off_finish(void);   << 
 43 extern void trace_hardirqs_on(void);           << 
 44 extern void trace_hardirqs_off(void);          << 
 45                                                << 
 46 # define lockdep_hardirq_context()      (raw_c << 
 47 # define lockdep_softirq_context(p)     ((p)->     35 # define lockdep_softirq_context(p)     ((p)->softirq_context)
 48 # define lockdep_hardirqs_enabled()     (this_ !!  36 # define lockdep_hardirqs_enabled(p)    ((p)->hardirqs_enabled)
 49 # define lockdep_softirqs_enabled(p)    ((p)->     37 # define lockdep_softirqs_enabled(p)    ((p)->softirqs_enabled)
 50 # define lockdep_hardirq_enter()               !!  38 # define lockdep_hardirq_enter()                \
 51 do {                                           !!  39 do {                                            \
 52         if (__this_cpu_inc_return(hardirq_cont !!  40         if (!current->hardirq_context++)        \
 53                 current->hardirq_threaded = 0; !!  41                 current->hardirq_threaded = 0;  \
 54 } while (0)                                        42 } while (0)
 55 # define lockdep_hardirq_threaded()                43 # define lockdep_hardirq_threaded()             \
 56 do {                                               44 do {                                            \
 57         current->hardirq_threaded = 1;             45         current->hardirq_threaded = 1;          \
 58 } while (0)                                        46 } while (0)
 59 # define lockdep_hardirq_exit()                    47 # define lockdep_hardirq_exit()                 \
 60 do {                                               48 do {                                            \
 61         __this_cpu_dec(hardirq_context);       !!  49         current->hardirq_context--;             \
                                                   >>  50 } while (0)
                                                   >>  51 # define lockdep_softirq_enter()                \
                                                   >>  52 do {                                            \
                                                   >>  53         current->softirq_context++;             \
                                                   >>  54 } while (0)
                                                   >>  55 # define lockdep_softirq_exit()                 \
                                                   >>  56 do {                                            \
                                                   >>  57         current->softirq_context--;             \
 62 } while (0)                                        58 } while (0)
 63                                                    59 
 64 # define lockdep_hrtimer_enter(__hrtimer)          60 # define lockdep_hrtimer_enter(__hrtimer)               \
 65 ({                                                 61 ({                                                      \
 66         bool __expires_hardirq = true;             62         bool __expires_hardirq = true;                  \
 67                                                    63                                                         \
 68         if (!__hrtimer->is_hard) {                 64         if (!__hrtimer->is_hard) {                      \
 69                 current->irq_config = 1;           65                 current->irq_config = 1;                \
 70                 __expires_hardirq = false;         66                 __expires_hardirq = false;              \
 71         }                                          67         }                                               \
 72         __expires_hardirq;                         68         __expires_hardirq;                              \
 73 })                                                 69 })
 74                                                    70 
 75 # define lockdep_hrtimer_exit(__expires_hardir     71 # define lockdep_hrtimer_exit(__expires_hardirq)        \
 76         do {                                       72         do {                                            \
 77                 if (!__expires_hardirq)            73                 if (!__expires_hardirq)                 \
 78                         current->irq_config =      74                         current->irq_config = 0;        \
 79         } while (0)                                75         } while (0)
 80                                                    76 
 81 # define lockdep_posixtimer_enter()                77 # define lockdep_posixtimer_enter()                             \
 82           do {                                     78           do {                                                  \
 83                   current->irq_config = 1;         79                   current->irq_config = 1;                      \
 84           } while (0)                              80           } while (0)
 85                                                    81 
 86 # define lockdep_posixtimer_exit()                 82 # define lockdep_posixtimer_exit()                              \
 87           do {                                     83           do {                                                  \
 88                   current->irq_config = 0;         84                   current->irq_config = 0;                      \
 89           } while (0)                              85           } while (0)
 90                                                    86 
 91 # define lockdep_irq_work_enter(_flags)        !!  87 # define lockdep_irq_work_enter(__work)                                 \
 92           do {                                     88           do {                                                          \
 93                   if (!((_flags) & IRQ_WORK_HA !!  89                   if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\
 94                         current->irq_config =      90                         current->irq_config = 1;                        \
 95           } while (0)                              91           } while (0)
 96 # define lockdep_irq_work_exit(_flags)         !!  92 # define lockdep_irq_work_exit(__work)                                  \
 97           do {                                     93           do {                                                          \
 98                   if (!((_flags) & IRQ_WORK_HA !!  94                   if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\
 99                         current->irq_config =      95                         current->irq_config = 0;                        \
100           } while (0)                              96           } while (0)
101                                                    97 
102 #else                                              98 #else
103 # define trace_hardirqs_on_prepare()           !!  99 # define trace_hardirqs_on()            do { } while (0)
104 # define trace_hardirqs_off_finish()           !! 100 # define trace_hardirqs_off()           do { } while (0)
105 # define trace_hardirqs_on()                   !! 101 # define lockdep_hardirq_context(p)     0
106 # define trace_hardirqs_off()                  !! 102 # define lockdep_softirq_context(p)     0
107 # define lockdep_hardirq_context()             !! 103 # define lockdep_hardirqs_enabled(p)    0
108 # define lockdep_softirq_context(p)            !! 104 # define lockdep_softirqs_enabled(p)    0
109 # define lockdep_hardirqs_enabled()            !! 105 # define lockdep_hardirq_enter()        do { } while (0)
110 # define lockdep_softirqs_enabled(p)           !! 106 # define lockdep_hardirq_threaded()     do { } while (0)
111 # define lockdep_hardirq_enter()               !! 107 # define lockdep_hardirq_exit()         do { } while (0)
112 # define lockdep_hardirq_threaded()            !! 108 # define lockdep_softirq_enter()        do { } while (0)
113 # define lockdep_hardirq_exit()                !! 109 # define lockdep_softirq_exit()         do { } while (0)
114 # define lockdep_softirq_enter()               << 
115 # define lockdep_softirq_exit()                << 
116 # define lockdep_hrtimer_enter(__hrtimer)         110 # define lockdep_hrtimer_enter(__hrtimer)       false
117 # define lockdep_hrtimer_exit(__context)       !! 111 # define lockdep_hrtimer_exit(__context)        do { } while (0)
118 # define lockdep_posixtimer_enter()               112 # define lockdep_posixtimer_enter()             do { } while (0)
119 # define lockdep_posixtimer_exit()                113 # define lockdep_posixtimer_exit()              do { } while (0)
120 # define lockdep_irq_work_enter(__work)           114 # define lockdep_irq_work_enter(__work)         do { } while (0)
121 # define lockdep_irq_work_exit(__work)            115 # define lockdep_irq_work_exit(__work)          do { } while (0)
122 #endif                                            116 #endif
123                                                   117 
124 #if defined(CONFIG_TRACE_IRQFLAGS) && !defined << 
125 # define lockdep_softirq_enter()               << 
126 do {                                           << 
127         current->softirq_context++;            << 
128 } while (0)                                    << 
129 # define lockdep_softirq_exit()                << 
130 do {                                           << 
131         current->softirq_context--;            << 
132 } while (0)                                    << 
133                                                << 
134 #else                                          << 
135 # define lockdep_softirq_enter()               << 
136 # define lockdep_softirq_exit()                << 
137 #endif                                         << 
138                                                << 
139 #if defined(CONFIG_IRQSOFF_TRACER) || \           118 #if defined(CONFIG_IRQSOFF_TRACER) || \
140         defined(CONFIG_PREEMPT_TRACER)            119         defined(CONFIG_PREEMPT_TRACER)
141  extern void stop_critical_timings(void);         120  extern void stop_critical_timings(void);
142  extern void start_critical_timings(void);        121  extern void start_critical_timings(void);
143 #else                                             122 #else
144 # define stop_critical_timings() do { } while     123 # define stop_critical_timings() do { } while (0)
145 # define start_critical_timings() do { } while    124 # define start_critical_timings() do { } while (0)
146 #endif                                            125 #endif
147                                                   126 
148 #ifdef CONFIG_DEBUG_IRQFLAGS                   << 
149 extern void warn_bogus_irq_restore(void);      << 
150 #define raw_check_bogus_irq_restore()          << 
151         do {                                   << 
152                 if (unlikely(!arch_irqs_disabl << 
153                         warn_bogus_irq_restore << 
154         } while (0)                            << 
155 #else                                          << 
156 #define raw_check_bogus_irq_restore() do { } w << 
157 #endif                                         << 
158                                                << 
159 /*                                                127 /*
160  * Wrap the arch provided IRQ routines to prov    128  * Wrap the arch provided IRQ routines to provide appropriate checks.
161  */                                               129  */
162 #define raw_local_irq_disable()         arch_l    130 #define raw_local_irq_disable()         arch_local_irq_disable()
163 #define raw_local_irq_enable()          arch_l    131 #define raw_local_irq_enable()          arch_local_irq_enable()
164 #define raw_local_irq_save(flags)                 132 #define raw_local_irq_save(flags)                       \
165         do {                                      133         do {                                            \
166                 typecheck(unsigned long, flags    134                 typecheck(unsigned long, flags);        \
167                 flags = arch_local_irq_save();    135                 flags = arch_local_irq_save();          \
168         } while (0)                               136         } while (0)
169 #define raw_local_irq_restore(flags)              137 #define raw_local_irq_restore(flags)                    \
170         do {                                      138         do {                                            \
171                 typecheck(unsigned long, flags    139                 typecheck(unsigned long, flags);        \
172                 raw_check_bogus_irq_restore(); << 
173                 arch_local_irq_restore(flags);    140                 arch_local_irq_restore(flags);          \
174         } while (0)                               141         } while (0)
175 #define raw_local_save_flags(flags)               142 #define raw_local_save_flags(flags)                     \
176         do {                                      143         do {                                            \
177                 typecheck(unsigned long, flags    144                 typecheck(unsigned long, flags);        \
178                 flags = arch_local_save_flags(    145                 flags = arch_local_save_flags();        \
179         } while (0)                               146         } while (0)
180 #define raw_irqs_disabled_flags(flags)            147 #define raw_irqs_disabled_flags(flags)                  \
181         ({                                        148         ({                                              \
182                 typecheck(unsigned long, flags    149                 typecheck(unsigned long, flags);        \
183                 arch_irqs_disabled_flags(flags    150                 arch_irqs_disabled_flags(flags);        \
184         })                                        151         })
185 #define raw_irqs_disabled()             (arch_    152 #define raw_irqs_disabled()             (arch_irqs_disabled())
186 #define raw_safe_halt()                 arch_s    153 #define raw_safe_halt()                 arch_safe_halt()
187                                                   154 
188 /*                                                155 /*
189  * The local_irq_*() APIs are equal to the raw    156  * The local_irq_*() APIs are equal to the raw_local_irq*()
190  * if !TRACE_IRQFLAGS.                            157  * if !TRACE_IRQFLAGS.
191  */                                               158  */
192 #ifdef CONFIG_TRACE_IRQFLAGS                      159 #ifdef CONFIG_TRACE_IRQFLAGS
193                                                !! 160 #define local_irq_enable() \
194 #define local_irq_enable()                     !! 161         do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
195         do {                                   !! 162 #define local_irq_disable() \
196                 trace_hardirqs_on();           !! 163         do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
197                 raw_local_irq_enable();        << 
198         } while (0)                            << 
199                                                << 
200 #define local_irq_disable()                    << 
201         do {                                   << 
202                 bool was_disabled = raw_irqs_d << 
203                 raw_local_irq_disable();       << 
204                 if (!was_disabled)             << 
205                         trace_hardirqs_off();  << 
206         } while (0)                            << 
207                                                << 
208 #define local_irq_save(flags)                     164 #define local_irq_save(flags)                           \
209         do {                                      165         do {                                            \
210                 raw_local_irq_save(flags);        166                 raw_local_irq_save(flags);              \
211                 if (!raw_irqs_disabled_flags(f !! 167                 trace_hardirqs_off();                   \
212                         trace_hardirqs_off();  << 
213         } while (0)                               168         } while (0)
214                                                   169 
                                                   >> 170 
215 #define local_irq_restore(flags)                  171 #define local_irq_restore(flags)                        \
216         do {                                      172         do {                                            \
217                 if (!raw_irqs_disabled_flags(f !! 173                 if (raw_irqs_disabled_flags(flags)) {   \
                                                   >> 174                         raw_local_irq_restore(flags);   \
                                                   >> 175                         trace_hardirqs_off();           \
                                                   >> 176                 } else {                                \
218                         trace_hardirqs_on();      177                         trace_hardirqs_on();            \
219                 raw_local_irq_restore(flags);  !! 178                         raw_local_irq_restore(flags);   \
                                                   >> 179                 }                                       \
220         } while (0)                               180         } while (0)
221                                                   181 
222 #define safe_halt()                               182 #define safe_halt()                             \
223         do {                                      183         do {                                    \
224                 trace_hardirqs_on();              184                 trace_hardirqs_on();            \
225                 raw_safe_halt();                  185                 raw_safe_halt();                \
226         } while (0)                               186         } while (0)
227                                                   187 
228                                                   188 
229 #else /* !CONFIG_TRACE_IRQFLAGS */                189 #else /* !CONFIG_TRACE_IRQFLAGS */
230                                                   190 
231 #define local_irq_enable()      do { raw_local    191 #define local_irq_enable()      do { raw_local_irq_enable(); } while (0)
232 #define local_irq_disable()     do { raw_local    192 #define local_irq_disable()     do { raw_local_irq_disable(); } while (0)
233 #define local_irq_save(flags)   do { raw_local !! 193 #define local_irq_save(flags)                                   \
                                                   >> 194         do {                                                    \
                                                   >> 195                 raw_local_irq_save(flags);                      \
                                                   >> 196         } while (0)
234 #define local_irq_restore(flags) do { raw_loca    197 #define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
235 #define safe_halt()             do { raw_safe_    198 #define safe_halt()             do { raw_safe_halt(); } while (0)
236                                                   199 
237 #endif /* CONFIG_TRACE_IRQFLAGS */                200 #endif /* CONFIG_TRACE_IRQFLAGS */
238                                                   201 
239 #define local_save_flags(flags) raw_local_save    202 #define local_save_flags(flags) raw_local_save_flags(flags)
240                                                   203 
241 /*                                                204 /*
242  * Some architectures don't define arch_irqs_d    205  * Some architectures don't define arch_irqs_disabled(), so even if either
243  * definition would be fine we need to use dif    206  * definition would be fine we need to use different ones for the time being
244  * to avoid build issues.                         207  * to avoid build issues.
245  */                                               208  */
246 #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT              209 #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
247 #define irqs_disabled()                           210 #define irqs_disabled()                                 \
248         ({                                        211         ({                                              \
249                 unsigned long _flags;             212                 unsigned long _flags;                   \
250                 raw_local_save_flags(_flags);     213                 raw_local_save_flags(_flags);           \
251                 raw_irqs_disabled_flags(_flags    214                 raw_irqs_disabled_flags(_flags);        \
252         })                                        215         })
253 #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */        216 #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
254 #define irqs_disabled() raw_irqs_disabled()       217 #define irqs_disabled() raw_irqs_disabled()
255 #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */        218 #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
256                                                   219 
257 #define irqs_disabled_flags(flags) raw_irqs_di    220 #define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
258                                                << 
259 DEFINE_LOCK_GUARD_0(irq, local_irq_disable(),  << 
260 DEFINE_LOCK_GUARD_0(irqsave,                   << 
261                     local_irq_save(_T->flags), << 
262                     local_irq_restore(_T->flag << 
263                     unsigned long flags)       << 
264                                                   221 
265 #endif                                            222 #endif
266                                                   223 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php