Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136688
b: refs/heads/master
c: 9b2b76a
h: refs/heads/master
v: v3
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Feb 9, 2009
1 parent aa38a2f commit fdda699
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc6c50066ec1ac98bef97117e2f078bb89bbccc7
refs/heads/master: 9b2b76a3344146c4d8d300874e73af8161204f87
1 change: 1 addition & 0 deletions trunk/arch/x86/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern void fixup_irqs(void);
extern unsigned int do_IRQ(struct pt_regs *regs);
extern void init_IRQ(void);
extern void native_init_IRQ(void);
extern bool handle_irq(unsigned irq, struct pt_regs *regs);

/* Interrupt vector management */
extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
Expand Down
34 changes: 21 additions & 13 deletions trunk/arch/x86/kernel/irq_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,26 @@ static inline int
execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) { return 0; }
#endif

bool handle_irq(unsigned irq, struct pt_regs *regs)
{
struct irq_desc *desc;
int overflow;

overflow = check_stack_overflow();

desc = irq_to_desc(irq);
if (unlikely(!desc))
return false;

if (!execute_on_irq_stack(overflow, desc, irq)) {
if (unlikely(overflow))
print_stack_overflow();
desc->handle_irq(irq, desc);
}

return true;
}

/*
* do_IRQ handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific
Expand All @@ -200,31 +220,19 @@ unsigned int do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs;
/* high bit used in ret_from_ code */
int overflow;
unsigned vector = ~regs->orig_ax;
struct irq_desc *desc;
unsigned irq;


old_regs = set_irq_regs(regs);
irq_enter();
irq = __get_cpu_var(vector_irq)[vector];

overflow = check_stack_overflow();

desc = irq_to_desc(irq);
if (unlikely(!desc)) {
if (!handle_irq(irq, regs)) {
printk(KERN_EMERG "%s: cannot handle IRQ %d vector %#x cpu %d\n",
__func__, irq, vector, smp_processor_id());
BUG();
}

if (!execute_on_irq_stack(overflow, desc, irq)) {
if (unlikely(overflow))
print_stack_overflow();
desc->handle_irq(irq, desc);
}

irq_exit();
set_irq_regs(old_regs);
return 1;
Expand Down
23 changes: 16 additions & 7 deletions trunk/arch/x86/kernel/irq_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ static inline void stack_overflow_check(struct pt_regs *regs)
#endif
}

bool handle_irq(unsigned irq, struct pt_regs *regs)
{
struct irq_desc *desc;

stack_overflow_check(regs);

desc = irq_to_desc(irq);
if (unlikely(!desc))
return false;

generic_handle_irq_desc(irq, desc);
return true;
}

/*
* do_IRQ handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific
Expand All @@ -56,22 +70,17 @@ static inline void stack_overflow_check(struct pt_regs *regs)
asmlinkage unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
struct irq_desc *desc;

/* high bit used in ret_from_ code */
unsigned vector = ~regs->orig_ax;
unsigned irq;

exit_idle();
irq_enter();
irq = __get_cpu_var(vector_irq)[vector];

stack_overflow_check(regs);
irq = __get_cpu_var(vector_irq)[vector];

desc = irq_to_desc(irq);
if (likely(desc))
generic_handle_irq_desc(irq, desc);
else {
if (!handle_irq(irq, regs)) {
if (!disable_apic)
ack_APIC_irq();

Expand Down

0 comments on commit fdda699

Please sign in to comment.