Release 4.11 arch/x86/kernel/irq_32.c
/*
* Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
*
* This file contains the lowest level x86-specific interrupt
* entry, irq-stacks and irq statistics code. All the remaining
* irq logic is done by the generic kernel/irq/ code and
* by the x86-specific irq controller code. (e.g. i8259.c and
* io_apic.c.)
*/
#include <linux/seq_file.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
#include <linux/percpu.h>
#include <linux/mm.h>
#include <asm/apic.h>
#ifdef CONFIG_DEBUG_STACKOVERFLOW
int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
static int check_stack_overflow(void)
{
long sp;
__asm__ __volatile__("andl %%esp,%0" :
"=r" (sp) : "0" (THREAD_SIZE - 1));
return sp < (sizeof(struct thread_info) + STACK_WARN);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Thomas Gleixner | 27 | 100.00% | 1 | 100.00% |
Total | 27 | 100.00% | 1 | 100.00% |
static void print_stack_overflow(void)
{
printk(KERN_WARNING "low stack detected by irq handler\n");
dump_stack();
if (sysctl_panic_on_stackoverflow)
panic("low stack detected by irq handler - check messages\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Thomas Gleixner | 17 | 65.38% | 1 | 50.00% |
Mitsuo Hayasaka | 9 | 34.62% | 1 | 50.00% |
Total | 26 | 100.00% | 2 | 100.00% |
#else
static inline int check_stack_overflow(void) { return 0; }
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Thomas Gleixner | 12 | 100.00% | 1 | 100.00% |
Total | 12 | 100.00% | 1 | 100.00% |
static inline void print_stack_overflow(void) { }
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Thomas Gleixner | 8 | 100.00% | 1 | 100.00% |
Total | 8 | 100.00% | 1 | 100.00% |
#endif
DEFINE_PER_CPU(struct irq_stack *, hardirq_stack);
DEFINE_PER_CPU(struct irq_stack *, softirq_stack);
static void call_on_stack(void *func, void *stack)
{
asm volatile("xchgl %%ebx,%%esp \n"
"call *%%edi \n"
"movl %%ebx,%%esp \n"
: "=b" (stack)
: "0" (stack),
"D"(func)
: "memory", "cc", "edx", "ecx", "eax");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andi Kleen | 11 | 64.71% | 1 | 14.29% |
Linus Torvalds | 2 | 11.76% | 2 | 28.57% |
Thomas Gleixner | 2 | 11.76% | 2 | 28.57% |
Linus Torvalds (pre-git) | 1 | 5.88% | 1 | 14.29% |
Ingo Molnar | 1 | 5.88% | 1 | 14.29% |
Total | 17 | 100.00% | 7 | 100.00% |
static inline void *current_stack(void)
{
return (void *)(current_stack_pointer() & ~(THREAD_SIZE - 1));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven Rostedt | 26 | 96.30% | 1 | 50.00% |
Andrew Lutomirski | 1 | 3.70% | 1 | 50.00% |
Total | 27 | 100.00% | 2 | 100.00% |
static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
u32 *isp, *prev_esp, arg1;
curstk = (struct irq_stack *) current_stack();
irqstk = __this_cpu_read(hardirq_stack);
/*
* this is where we switch to the IRQ stack. However, if we are
* already using the IRQ stack (because we interrupted a hardirq
* handler) we can't do that and just have to keep using the
* current stack (which is the irq stack already after all)
*/
if (unlikely(curstk == irqstk))
return 0;
isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
/* Save the next esp at the bottom of the stack */
prev_esp = (u32 *)irqstk;
*prev_esp = current_stack_pointer();
if (unlikely(overflow))
call_on_stack(print_stack_overflow, isp);
asm volatile("xchgl %%ebx,%%esp \n"
"call *%%edi \n"
"movl %%ebx,%%esp \n"
: "=a" (arg1), "=b" (isp)
: "0" (desc), "1" (isp),
"D" (desc->handle_irq)
: "memory", "cc", "ecx");
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 36 | 30.77% | 2 | 9.09% |
Steven Rostedt | 28 | 23.93% | 2 | 9.09% |
Thomas Gleixner | 21 | 17.95% | 3 | 13.64% |
Linus Torvalds (pre-git) | 18 | 15.38% | 10 | 45.45% |
Andi Kleen | 7 | 5.98% | 1 | 4.55% |
David Howells | 3 | 2.56% | 1 | 4.55% |
Lai Jiangshan | 2 | 1.71% | 1 | 4.55% |
Andrew Lutomirski | 1 | 0.85% | 1 | 4.55% |
Tejun Heo | 1 | 0.85% | 1 | 4.55% |
Total | 117 | 100.00% | 22 | 100.00% |
/*
* allocate per-cpu stacks for hardirq and for softirq processing
*/
void irq_ctx_init(int cpu)
{
struct irq_stack *irqstk;
if (per_cpu(hardirq_stack, cpu))
return;
irqstk = page_address(alloc_pages_node(cpu_to_node(cpu),
THREADINFO_GFP,
THREAD_SIZE_ORDER));
per_cpu(hardirq_stack, cpu) = irqstk;
irqstk = page_address(alloc_pages_node(cpu_to_node(cpu),
THREADINFO_GFP,
THREAD_SIZE_ORDER));
per_cpu(softirq_stack, cpu) = irqstk;
printk(KERN_DEBUG "CPU %u irqstacks, hard=%p soft=%p\n",
cpu, per_cpu(hardirq_stack, cpu), per_cpu(softirq_stack, cpu));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lai Jiangshan | 26 | 26.80% | 1 | 7.69% |
Eric Dumazet | 18 | 18.56% | 1 | 7.69% |
Ingo Molnar | 18 | 18.56% | 1 | 7.69% |
Linus Torvalds (pre-git) | 15 | 15.46% | 6 | 46.15% |
Steven Rostedt | 12 | 12.37% | 1 | 7.69% |
Thomas Gleixner | 5 | 5.15% | 2 | 15.38% |
Andrew Morton | 3 | 3.09% | 1 | 7.69% |
Total | 97 | 100.00% | 13 | 100.00% |
void do_softirq_own_stack(void)
{
struct irq_stack *irqstk;
u32 *isp, *prev_esp;
irqstk = __this_cpu_read(softirq_stack);
/* build the stack frame on the softirq stack */
isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
/* Push the previous esp onto the stack */
prev_esp = (u32 *)irqstk;
*prev_esp = current_stack_pointer();
call_on_stack(__do_softirq, isp);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 24 | 34.78% | 1 | 8.33% |
Steven Rostedt | 23 | 33.33% | 2 | 16.67% |
Thomas Gleixner | 7 | 10.14% | 1 | 8.33% |
Linus Torvalds | 4 | 5.80% | 1 | 8.33% |
Andrew Morton | 3 | 4.35% | 2 | 16.67% |
Linus Torvalds (pre-git) | 3 | 4.35% | 1 | 8.33% |
Lai Jiangshan | 2 | 2.90% | 1 | 8.33% |
Tejun Heo | 1 | 1.45% | 1 | 8.33% |
Andrew Lutomirski | 1 | 1.45% | 1 | 8.33% |
Frédéric Weisbecker | 1 | 1.45% | 1 | 8.33% |
Total | 69 | 100.00% | 12 | 100.00% |
bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
{
int overflow = check_stack_overflow();
if (IS_ERR_OR_NULL(desc))
return false;
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc)) {
if (unlikely(overflow))
print_stack_overflow();
generic_handle_irq_desc(desc);
}
return true;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeremy Fitzhardinge | 53 | 80.30% | 1 | 20.00% |
Thomas Gleixner | 8 | 12.12% | 2 | 40.00% |
Linus Torvalds | 4 | 6.06% | 1 | 20.00% |
Andrew Lutomirski | 1 | 1.52% | 1 | 20.00% |
Total | 66 | 100.00% | 5 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Thomas Gleixner | 116 | 21.97% | 6 | 12.24% |
Steven Rostedt | 95 | 17.99% | 2 | 4.08% |
Ingo Molnar | 85 | 16.10% | 3 | 6.12% |
Jeremy Fitzhardinge | 53 | 10.04% | 1 | 2.04% |
Linus Torvalds (pre-git) | 45 | 8.52% | 16 | 32.65% |
Lai Jiangshan | 44 | 8.33% | 1 | 2.04% |
Eric Dumazet | 21 | 3.98% | 1 | 2.04% |
Andi Kleen | 18 | 3.41% | 1 | 2.04% |
Linus Torvalds | 10 | 1.89% | 4 | 8.16% |
Zwane Mwaikambo | 9 | 1.70% | 1 | 2.04% |
Mitsuo Hayasaka | 9 | 1.70% | 1 | 2.04% |
Andrew Morton | 8 | 1.52% | 4 | 8.16% |
Andrew Lutomirski | 4 | 0.76% | 2 | 4.08% |
David Howells | 3 | 0.57% | 1 | 2.04% |
Stéphane Eranian | 2 | 0.38% | 1 | 2.04% |
Jaswinder Singh Rajput | 2 | 0.38% | 1 | 2.04% |
Tejun Heo | 2 | 0.38% | 1 | 2.04% |
Dave Jones | 1 | 0.19% | 1 | 2.04% |
Frédéric Weisbecker | 1 | 0.19% | 1 | 2.04% |
Total | 528 | 100.00% | 49 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.