Skip to content

Commit c2b1063

Browse files
committed
genirq: Add a IRQF_NO_DEBUG flag
The whole call to note_interrupt() can be avoided or return early when interrupts would be marked accordingly. For IPI handlers which always return HANDLED the whole procedure is pretty pointless to begin with. Add a IRQF_NO_DEBUG flag and mark the interrupt accordingly if supplied when the interrupt is requested. When noirqdebug is set on the kernel commandline, then the interrupt is marked unconditionally so that there is only one condition in the hotpath to evaluate. [ clg: Add changelog ] Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Cédric Le Goater <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d07f6ca commit c2b1063

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

include/linux/interrupt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
* IRQF_NO_AUTOEN - Don't enable IRQ or NMI automatically when users request it.
6565
* Users will enable it explicitly by enable_irq() or enable_nmi()
6666
* later.
67+
* IRQF_NO_DEBUG - Exclude from runnaway detection for IPI and similar handlers,
68+
* depends on IRQF_PERCPU.
6769
*/
6870
#define IRQF_SHARED 0x00000080
6971
#define IRQF_PROBE_SHARED 0x00000100
@@ -78,6 +80,7 @@
7880
#define IRQF_EARLY_RESUME 0x00020000
7981
#define IRQF_COND_SUSPEND 0x00040000
8082
#define IRQF_NO_AUTOEN 0x00080000
83+
#define IRQF_NO_DEBUG 0x00100000
8184

8285
#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
8386

include/linux/irq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ enum irqchip_irq_state;
7272
* mechanism and from core side polling.
7373
* IRQ_DISABLE_UNLAZY - Disable lazy irq disable
7474
* IRQ_HIDDEN - Don't show up in /proc/interrupts
75+
* IRQ_NO_DEBUG - Exclude from note_interrupt() debugging
7576
*/
7677
enum {
7778
IRQ_TYPE_NONE = 0x00000000,
@@ -99,6 +100,7 @@ enum {
99100
IRQ_IS_POLLED = (1 << 18),
100101
IRQ_DISABLE_UNLAZY = (1 << 19),
101102
IRQ_HIDDEN = (1 << 20),
103+
IRQ_NO_DEBUG = (1 << 21),
102104
};
103105

104106
#define IRQF_MODIFY_MASK \

kernel/irq/chip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ void handle_nested_irq(unsigned int irq)
481481
for_each_action_of_desc(desc, action)
482482
action_ret |= action->thread_fn(action->irq, action->dev_id);
483483

484-
if (!noirqdebug)
484+
if (!irq_settings_no_debug(desc))
485485
note_interrupt(desc, action_ret);
486486

487487
raw_spin_lock_irq(&desc->lock);

kernel/irq/handle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
197197

198198
add_interrupt_randomness(desc->irq_data.irq, flags);
199199

200-
if (!noirqdebug)
200+
if (!irq_settings_no_debug(desc))
201201
note_interrupt(desc, retval);
202202
return retval;
203203
}

kernel/irq/manage.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,8 +1686,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
16861686
if (new->flags & IRQF_PERCPU) {
16871687
irqd_set(&desc->irq_data, IRQD_PER_CPU);
16881688
irq_settings_set_per_cpu(desc);
1689+
if (new->flags & IRQF_NO_DEBUG)
1690+
irq_settings_set_no_debug(desc);
16891691
}
16901692

1693+
if (noirqdebug)
1694+
irq_settings_set_no_debug(desc);
1695+
16911696
if (new->flags & IRQF_ONESHOT)
16921697
desc->istate |= IRQS_ONESHOT;
16931698

kernel/irq/settings.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ enum {
1818
_IRQ_IS_POLLED = IRQ_IS_POLLED,
1919
_IRQ_DISABLE_UNLAZY = IRQ_DISABLE_UNLAZY,
2020
_IRQ_HIDDEN = IRQ_HIDDEN,
21+
_IRQ_NO_DEBUG = IRQ_NO_DEBUG,
2122
_IRQF_MODIFY_MASK = IRQF_MODIFY_MASK,
2223
};
2324

@@ -33,6 +34,7 @@ enum {
3334
#define IRQ_IS_POLLED GOT_YOU_MORON
3435
#define IRQ_DISABLE_UNLAZY GOT_YOU_MORON
3536
#define IRQ_HIDDEN GOT_YOU_MORON
37+
#define IRQ_NO_DEBUG GOT_YOU_MORON
3638
#undef IRQF_MODIFY_MASK
3739
#define IRQF_MODIFY_MASK GOT_YOU_MORON
3840

@@ -174,3 +176,13 @@ static inline bool irq_settings_is_hidden(struct irq_desc *desc)
174176
{
175177
return desc->status_use_accessors & _IRQ_HIDDEN;
176178
}
179+
180+
static inline void irq_settings_set_no_debug(struct irq_desc *desc)
181+
{
182+
desc->status_use_accessors |= _IRQ_NO_DEBUG;
183+
}
184+
185+
static inline bool irq_settings_no_debug(struct irq_desc *desc)
186+
{
187+
return desc->status_use_accessors & _IRQ_NO_DEBUG;
188+
}

0 commit comments

Comments
 (0)