2008-10-23 05:26:29 +00:00
|
|
|
#ifndef _ASM_X86_HW_IRQ_H
|
|
|
|
#define _ASM_X86_HW_IRQ_H
|
2008-05-02 17:00:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
|
|
|
|
*
|
|
|
|
* moved some of the old arch/i386/kernel/irq.h to here. VY
|
|
|
|
*
|
|
|
|
* IRQ/IPI changes taken from work by Thomas Radke
|
|
|
|
* <tomsoft@informatik.tu-chemnitz.de>
|
|
|
|
*
|
|
|
|
* hacked by Andi Kleen for x86-64.
|
|
|
|
* unified by tglx
|
|
|
|
*/
|
|
|
|
|
2008-05-02 18:10:09 +00:00
|
|
|
#include <asm/irq_vectors.h>
|
2008-05-02 17:00:30 +00:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
|
|
#include <linux/percpu.h>
|
|
|
|
#include <linux/profile.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
|
2011-07-26 23:09:06 +00:00
|
|
|
#include <linux/atomic.h>
|
2008-05-02 17:00:30 +00:00
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/sections.h>
|
|
|
|
|
|
|
|
/* Interrupt handlers registered during init_IRQ */
|
2013-08-05 22:02:37 +00:00
|
|
|
extern asmlinkage void apic_timer_interrupt(void);
|
|
|
|
extern asmlinkage void x86_platform_ipi(void);
|
|
|
|
extern asmlinkage void kvm_posted_intr_ipi(void);
|
|
|
|
extern asmlinkage void error_interrupt(void);
|
|
|
|
extern asmlinkage void irq_work_interrupt(void);
|
|
|
|
|
|
|
|
extern asmlinkage void spurious_interrupt(void);
|
|
|
|
extern asmlinkage void thermal_interrupt(void);
|
|
|
|
extern asmlinkage void reschedule_interrupt(void);
|
|
|
|
|
|
|
|
extern asmlinkage void invalidate_interrupt(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt0(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt1(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt2(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt3(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt4(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt5(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt6(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt7(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt8(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt9(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt10(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt11(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt12(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt13(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt14(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt15(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt16(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt17(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt18(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt19(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt20(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt21(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt22(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt23(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt24(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt25(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt26(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt27(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt28(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt29(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt30(void);
|
|
|
|
extern asmlinkage void invalidate_interrupt31(void);
|
|
|
|
|
|
|
|
extern asmlinkage void irq_move_cleanup_interrupt(void);
|
|
|
|
extern asmlinkage void reboot_interrupt(void);
|
|
|
|
extern asmlinkage void threshold_interrupt(void);
|
|
|
|
|
|
|
|
extern asmlinkage void call_function_interrupt(void);
|
|
|
|
extern asmlinkage void call_function_single_interrupt(void);
|
2008-05-02 17:00:30 +00:00
|
|
|
|
x86, trace: Add irq vector tracepoints
[Purpose of this patch]
As Vaibhav explained in the thread below, tracepoints for irq vectors
are useful.
http://www.spinics.net/lists/mm-commits/msg85707.html
<snip>
The current interrupt traces from irq_handler_entry and irq_handler_exit
provide when an interrupt is handled. They provide good data about when
the system has switched to kernel space and how it affects the currently
running processes.
There are some IRQ vectors which trigger the system into kernel space,
which are not handled in generic IRQ handlers. Tracing such events gives
us the information about IRQ interaction with other system events.
The trace also tells where the system is spending its time. We want to
know which cores are handling interrupts and how they are affecting other
processes in the system. Also, the trace provides information about when
the cores are idle and which interrupts are changing that state.
<snip>
On the other hand, my usecase is tracing just local timer event and
getting a value of instruction pointer.
I suggested to add an argument local timer event to get instruction pointer before.
But there is another way to get it with external module like systemtap.
So, I don't need to add any argument to irq vector tracepoints now.
[Patch Description]
Vaibhav's patch shared a trace point ,irq_vector_entry/irq_vector_exit, in all events.
But there is an above use case to trace specific irq_vector rather than tracing all events.
In this case, we are concerned about overhead due to unwanted events.
So, add following tracepoints instead of introducing irq_vector_entry/exit.
so that we can enable them independently.
- local_timer_vector
- reschedule_vector
- call_function_vector
- call_function_single_vector
- irq_work_entry_vector
- error_apic_vector
- thermal_apic_vector
- threshold_apic_vector
- spurious_apic_vector
- x86_platform_ipi_vector
Also, introduce a logic switching IDT at enabling/disabling time so that a time penalty
makes a zero when tracepoints are disabled. Detailed explanations are as follows.
- Create trace irq handlers with entering_irq()/exiting_irq().
- Create a new IDT, trace_idt_table, at boot time by adding a logic to
_set_gate(). It is just a copy of original idt table.
- Register the new handlers for tracpoints to the new IDT by introducing
macros to alloc_intr_gate() called at registering time of irq_vector handlers.
- Add checking, whether irq vector tracing is on/off, into load_current_idt().
This has to be done below debug checking for these reasons.
- Switching to debug IDT may be kicked while tracing is enabled.
- On the other hands, switching to trace IDT is kicked only when debugging
is disabled.
In addition, the new IDT is created only when CONFIG_TRACING is enabled to avoid being
used for other purposes.
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Link: http://lkml.kernel.org/r/51C323ED.5050708@hds.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
2013-06-20 15:46:53 +00:00
|
|
|
#ifdef CONFIG_TRACING
|
|
|
|
/* Interrupt handlers registered during init_IRQ */
|
|
|
|
extern void trace_apic_timer_interrupt(void);
|
|
|
|
extern void trace_x86_platform_ipi(void);
|
|
|
|
extern void trace_error_interrupt(void);
|
|
|
|
extern void trace_irq_work_interrupt(void);
|
|
|
|
extern void trace_spurious_interrupt(void);
|
|
|
|
extern void trace_thermal_interrupt(void);
|
|
|
|
extern void trace_reschedule_interrupt(void);
|
|
|
|
extern void trace_threshold_interrupt(void);
|
|
|
|
extern void trace_call_function_interrupt(void);
|
|
|
|
extern void trace_call_function_single_interrupt(void);
|
|
|
|
#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
|
|
|
|
#define trace_reboot_interrupt reboot_interrupt
|
|
|
|
#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
|
|
|
|
#endif /* CONFIG_TRACING */
|
|
|
|
|
2014-10-27 08:11:56 +00:00
|
|
|
#ifdef CONFIG_IRQ_REMAP
|
2012-09-26 10:44:44 +00:00
|
|
|
/* Intel specific interrupt remapping information */
|
2010-10-10 09:39:09 +00:00
|
|
|
struct irq_2_iommu {
|
|
|
|
struct intel_iommu *iommu;
|
|
|
|
u16 irte_index;
|
|
|
|
u16 sub_handle;
|
|
|
|
u8 irte_mask;
|
|
|
|
};
|
|
|
|
|
2012-09-26 10:44:44 +00:00
|
|
|
/* AMD specific interrupt remapping information */
|
|
|
|
struct irq_2_irte {
|
|
|
|
u16 devid; /* Device ID for IRTE table */
|
|
|
|
u16 index; /* Index into IRTE table*/
|
|
|
|
};
|
2014-10-27 08:11:56 +00:00
|
|
|
#endif /* CONFIG_IRQ_REMAP */
|
2012-09-26 10:44:44 +00:00
|
|
|
|
2014-10-27 08:11:56 +00:00
|
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
2014-10-27 08:12:00 +00:00
|
|
|
struct irq_data;
|
|
|
|
|
2009-10-13 20:32:36 +00:00
|
|
|
struct irq_cfg {
|
|
|
|
cpumask_var_t domain;
|
|
|
|
cpumask_var_t old_domain;
|
2015-04-13 06:11:23 +00:00
|
|
|
unsigned int dest_apicid;
|
2009-10-13 20:32:36 +00:00
|
|
|
u8 vector;
|
|
|
|
u8 move_in_progress : 1;
|
2011-08-24 00:05:25 +00:00
|
|
|
#ifdef CONFIG_IRQ_REMAP
|
2012-09-26 10:44:45 +00:00
|
|
|
u8 remapped : 1;
|
2012-09-26 10:44:44 +00:00
|
|
|
union {
|
|
|
|
struct irq_2_iommu irq_2_iommu;
|
|
|
|
struct irq_2_irte irq_2_irte;
|
|
|
|
};
|
2010-10-10 09:39:09 +00:00
|
|
|
#endif
|
2014-10-27 08:11:56 +00:00
|
|
|
union {
|
|
|
|
#ifdef CONFIG_X86_IO_APIC
|
|
|
|
struct {
|
|
|
|
struct list_head irq_2_pin;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
};
|
2009-10-13 20:32:36 +00:00
|
|
|
};
|
|
|
|
|
2014-10-27 08:11:59 +00:00
|
|
|
extern struct irq_cfg *irq_cfg(unsigned int irq);
|
|
|
|
extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
|
2014-10-27 08:12:00 +00:00
|
|
|
extern struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node);
|
|
|
|
extern void lock_vector_lock(void);
|
|
|
|
extern void unlock_vector_lock(void);
|
2009-10-13 20:32:36 +00:00
|
|
|
extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *);
|
2014-10-27 08:12:00 +00:00
|
|
|
extern void clear_irq_vector(int irq, struct irq_cfg *cfg);
|
|
|
|
extern void setup_vector_irq(int cpu);
|
2014-10-27 08:12:11 +00:00
|
|
|
#ifdef CONFIG_SMP
|
2009-10-13 20:32:36 +00:00
|
|
|
extern void send_cleanup_vector(struct irq_cfg *);
|
2014-11-05 09:12:27 +00:00
|
|
|
extern void irq_complete_move(struct irq_cfg *cfg);
|
2014-10-27 08:12:11 +00:00
|
|
|
#else
|
|
|
|
static inline void send_cleanup_vector(struct irq_cfg *c) { }
|
2014-11-05 09:12:27 +00:00
|
|
|
static inline void irq_complete_move(struct irq_cfg *c) { }
|
2014-10-27 08:12:11 +00:00
|
|
|
#endif
|
2009-10-14 13:06:42 +00:00
|
|
|
|
2014-10-27 08:12:00 +00:00
|
|
|
extern int apic_retrigger_irq(struct irq_data *data);
|
|
|
|
extern void apic_ack_edge(struct irq_data *data);
|
|
|
|
extern int apic_set_affinity(struct irq_data *data, const struct cpumask *mask,
|
|
|
|
unsigned int *dest_id);
|
|
|
|
#else /* CONFIG_X86_LOCAL_APIC */
|
2014-10-27 08:11:56 +00:00
|
|
|
static inline void lock_vector_lock(void) {}
|
|
|
|
static inline void unlock_vector_lock(void) {}
|
2014-10-27 08:12:00 +00:00
|
|
|
#endif /* CONFIG_X86_LOCAL_APIC */
|
2014-10-27 08:11:56 +00:00
|
|
|
|
2008-05-02 17:00:30 +00:00
|
|
|
/* Statistics */
|
|
|
|
extern atomic_t irq_err_count;
|
|
|
|
extern atomic_t irq_mis_count;
|
|
|
|
|
2008-05-02 22:30:50 +00:00
|
|
|
/* EISA */
|
|
|
|
extern void eisa_set_level_irq(unsigned int irq);
|
|
|
|
|
2008-07-23 11:43:14 +00:00
|
|
|
/* SMP */
|
2013-08-05 22:02:37 +00:00
|
|
|
extern __visible void smp_apic_timer_interrupt(struct pt_regs *);
|
|
|
|
extern __visible void smp_spurious_interrupt(struct pt_regs *);
|
|
|
|
extern __visible void smp_x86_platform_ipi(struct pt_regs *);
|
|
|
|
extern __visible void smp_error_interrupt(struct pt_regs *);
|
2009-04-10 18:33:10 +00:00
|
|
|
#ifdef CONFIG_X86_IO_APIC
|
|
|
|
extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
|
|
|
|
#endif
|
2009-01-27 16:07:08 +00:00
|
|
|
#ifdef CONFIG_SMP
|
2013-08-05 22:02:37 +00:00
|
|
|
extern __visible void smp_reschedule_interrupt(struct pt_regs *);
|
|
|
|
extern __visible void smp_call_function_interrupt(struct pt_regs *);
|
|
|
|
extern __visible void smp_call_function_single_interrupt(struct pt_regs *);
|
|
|
|
extern __visible void smp_invalidate_interrupt(struct pt_regs *);
|
2008-07-25 05:12:26 +00:00
|
|
|
#endif
|
2008-07-23 11:43:14 +00:00
|
|
|
|
2015-04-03 19:49:13 +00:00
|
|
|
extern char irq_entries_start[];
|
2013-10-30 20:37:00 +00:00
|
|
|
#ifdef CONFIG_TRACING
|
2015-04-03 19:49:13 +00:00
|
|
|
#define trace_irq_entries_start irq_entries_start
|
2013-10-30 20:37:00 +00:00
|
|
|
#endif
|
2008-08-20 03:50:28 +00:00
|
|
|
|
2014-04-02 12:13:47 +00:00
|
|
|
#define VECTOR_UNDEFINED (-1)
|
|
|
|
#define VECTOR_RETRIGGERED (-2)
|
2014-01-05 16:10:52 +00:00
|
|
|
|
2008-05-02 20:10:39 +00:00
|
|
|
typedef int vector_irq_t[NR_VECTORS];
|
|
|
|
DECLARE_PER_CPU(vector_irq_t, vector_irq);
|
2008-05-02 17:00:30 +00:00
|
|
|
|
2008-05-02 20:10:39 +00:00
|
|
|
#endif /* !ASSEMBLY_ */
|
|
|
|
|
2008-10-23 05:26:29 +00:00
|
|
|
#endif /* _ASM_X86_HW_IRQ_H */
|