Skip to content

Commit d6f8342

Browse files
hkallweitKAGA-KOKO
authored andcommitted
x86/irq: Move IS_ERR_OR_NULL() check into common do_IRQ() code
Both the 64bit and the 32bit handle_irq() implementation check the irq descriptor pointer with IS_ERR_OR_NULL() and return failure. That can be done simpler in the common do_IRQ() code. This reduces the 64bit handle_irq() function to a wrapper around generic_handle_irq_desc(). Invoke it directly from do_IRQ() to spare the extra function call. [ tglx: Got rid of the #ifdef and massaged changelog ] Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent e30c44e commit d6f8342

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

arch/x86/include/asm/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern __visible void smp_kvm_posted_intr_nested_ipi(struct pt_regs *regs);
3434
extern void (*x86_platform_ipi_callback)(void);
3535
extern void native_init_IRQ(void);
3636

37-
extern bool handle_irq(struct irq_desc *desc, struct pt_regs *regs);
37+
extern void handle_irq(struct irq_desc *desc, struct pt_regs *regs);
3838

3939
extern __visible unsigned int do_IRQ(struct pt_regs *regs);
4040

arch/x86/kernel/irq.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,12 @@ __visible unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
243243
RCU_LOCKDEP_WARN(!rcu_is_watching(), "IRQ failed to wake up RCU");
244244

245245
desc = __this_cpu_read(vector_irq[vector]);
246-
247-
if (!handle_irq(desc, regs)) {
246+
if (likely(!IS_ERR_OR_NULL(desc))) {
247+
if (IS_ENABLED(CONFIG_X86_32))
248+
handle_irq(desc, regs);
249+
else
250+
generic_handle_irq_desc(desc);
251+
} else {
248252
ack_APIC_irq();
249253

250254
if (desc != VECTOR_RETRIGGERED && desc != VECTOR_SHUTDOWN) {

arch/x86/kernel/irq_32.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,13 @@ void do_softirq_own_stack(void)
148148
call_on_stack(__do_softirq, isp);
149149
}
150150

151-
bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
151+
void handle_irq(struct irq_desc *desc, struct pt_regs *regs)
152152
{
153153
int overflow = check_stack_overflow();
154154

155-
if (IS_ERR_OR_NULL(desc))
156-
return false;
157-
158155
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc)) {
159156
if (unlikely(overflow))
160157
print_stack_overflow();
161158
generic_handle_irq_desc(desc);
162159
}
163-
164-
return true;
165160
}

arch/x86/kernel/irq_64.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@
2626
DEFINE_PER_CPU_PAGE_ALIGNED(struct irq_stack, irq_stack_backing_store) __visible;
2727
DECLARE_INIT_PER_CPU(irq_stack_backing_store);
2828

29-
bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
30-
{
31-
if (IS_ERR_OR_NULL(desc))
32-
return false;
33-
34-
generic_handle_irq_desc(desc);
35-
return true;
36-
}
37-
3829
#ifdef CONFIG_VMAP_STACK
3930
/*
4031
* VMAP the backing store with guard pages

0 commit comments

Comments
 (0)