2 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
4 * This file contains the lowest level x86_64-specific interrupt
5 * entry and irq statistics code. All the remaining irq logic is
6 * done by the generic kernel/irq/ code and in the
7 * x86_64-specific irq controller code. (e.g. i8259.c and
11 #include <linux/kernel_stat.h>
12 #include <linux/interrupt.h>
13 #include <linux/seq_file.h>
14 #include <linux/module.h>
15 #include <linux/delay.h>
16 #include <asm/uaccess.h>
17 #include <asm/io_apic.h>
22 * 'what should we do if we get a hw irq event on an illegal vector'.
23 * each architecture has to answer this themselves.
25 void ack_bad_irq(unsigned int irq
)
27 printk(KERN_WARNING
"unexpected IRQ trap at vector %02x\n", irq
);
29 * Currently unexpected vectors happen only on SMP and APIC.
30 * We _must_ ack these because every local APIC has only N
31 * irq slots per priority level, and a 'hanging, unacked' IRQ
32 * holds up an irq slot - in excessive cases (when multiple
33 * unexpected vectors occur) that might lock up the APIC
35 * But don't ack when the APIC is disabled. -AK
41 #ifdef CONFIG_DEBUG_STACKOVERFLOW
43 * Probabilistic stack overflow check:
45 * Only check the stack in process context, because everything else
46 * runs on the big interrupt stacks. Checking reliably is too expensive,
47 * so we just check from interrupts.
49 static inline void stack_overflow_check(struct pt_regs
*regs
)
51 u64 curbase
= (u64
)task_stack_page(current
);
52 static unsigned long warned
= -60*HZ
;
54 if (regs
->sp
>= curbase
&& regs
->sp
<= curbase
+ THREAD_SIZE
&&
55 regs
->sp
< curbase
+ sizeof(struct thread_info
) + 128 &&
56 time_after(jiffies
, warned
+ 60*HZ
)) {
57 printk("do_IRQ: %s near stack overflow (cur:%Lx,sp:%lx)\n",
58 current
->comm
, curbase
, regs
->sp
);
59 show_stack(NULL
,NULL
);
66 * do_IRQ handles all normal device IRQ's (the special
67 * SMP cross-CPU interrupts have their own specific
70 asmlinkage
unsigned int do_IRQ(struct pt_regs
*regs
)
72 struct pt_regs
*old_regs
= set_irq_regs(regs
);
73 struct irq_desc
*desc
;
75 /* high bit used in ret_from_ code */
76 unsigned vector
= ~regs
->orig_ax
;
81 irq
= __get_cpu_var(vector_irq
)[vector
];
83 #ifdef CONFIG_DEBUG_STACKOVERFLOW
84 stack_overflow_check(regs
);
87 desc
= irq_to_desc(irq
);
89 generic_handle_irq_desc(irq
, desc
);
94 if (printk_ratelimit())
95 printk(KERN_EMERG
"%s: %d.%d No irq handler for vector\n",
96 __func__
, smp_processor_id(), vector
);
101 set_irq_regs(old_regs
);
105 #ifdef CONFIG_HOTPLUG_CPU
106 void fixup_irqs(cpumask_t map
)
110 struct irq_desc
*desc
;
112 for_each_irq_desc(irq
, desc
) {
114 int break_affinity
= 0;
115 int set_affinity
= 1;
120 /* interrupt's are disabled at this point */
121 spin_lock(&desc
->lock
);
123 if (!irq_has_action(irq
) ||
124 cpus_equal(desc
->affinity
, map
)) {
125 spin_unlock(&desc
->lock
);
129 cpus_and(mask
, desc
->affinity
, map
);
130 if (cpus_empty(mask
)) {
135 if (desc
->chip
->mask
)
136 desc
->chip
->mask(irq
);
138 if (desc
->chip
->set_affinity
)
139 desc
->chip
->set_affinity(irq
, mask
);
140 else if (!(warned
++))
143 if (desc
->chip
->unmask
)
144 desc
->chip
->unmask(irq
);
146 spin_unlock(&desc
->lock
);
148 if (break_affinity
&& set_affinity
)
149 printk("Broke affinity for irq %i\n", irq
);
150 else if (!set_affinity
)
151 printk("Cannot set affinity for irq %i\n", irq
);
154 /* That doesn't seem sufficient. Give it 1ms. */
161 extern void call_softirq(void);
163 asmlinkage
void do_softirq(void)
171 local_irq_save(flags
);
172 pending
= local_softirq_pending();
173 /* Switch to interrupt stack */
176 WARN_ON_ONCE(softirq_count());
178 local_irq_restore(flags
);
This page took 0.034342 seconds and 5 git commands to generate.