[PATCH] arch, x86, irq: enable tracing of irq_move_cleanup_interrupt vector
From: Nicolai Stange
Date: Mon Feb 08 2016 - 20:23:45 EST
In commit cf910e83ae23 ("x86, trace: Add irq vector tracepoints"), support
for the tracing of IRQ vectors had been introduced.
For no apparent reason, irq_move_cleanup_interrupt had been left out from
the list of traceable interrupt vectors, rendering it incomplete.
Introduce support for tracing irq_move_cleanup_interrupt in the same way
as done for the other vectors.
Namely,
- define a tracepoint event by means of DEFINE_IRQ_VECTOR_EVENT(),
- add a tracing capable handler smp_trace_irq_move_cleanup_interrupt(),
- introduce tracing versions of the IDT-referenced stubs which call into
the tracing version of the handler on both, x86 and x86_64,
- finally, factor out the "real" interrupt handling code into the new
__smp_irq_move_cleanup_interrupt().
Signed-off-by: Nicolai Stange <nicstange@xxxxxxxxx>
---
Patch is against tip x86/core.
Fully tested on x86_64, compiled on i386.
I do have analogue patches for the
kvm_posted_intr_ipi
kvm_posted_intr_wakeup_ipi
vectors as well. Due to lack of hardware, I'm unable to test them though.
If anybody with (/sys/module/kvm_intel/parameters/enable_apicv='Y') is
willing to help out, I'll gladly post them, too.
arch/x86/entry/entry_64.S | 2 +-
arch/x86/include/asm/entry_arch.h | 3 +--
arch/x86/include/asm/hw_irq.h | 2 +-
arch/x86/include/asm/trace/irq_vectors.h | 6 ++++++
arch/x86/kernel/apic/vector.c | 19 ++++++++++++++++---
5 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 8cb3e43..f7db1e0 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -771,7 +771,7 @@ trace_apicinterrupt \num \sym
.endm
#ifdef CONFIG_SMP
-apicinterrupt3 IRQ_MOVE_CLEANUP_VECTOR irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt
+apicinterrupt IRQ_MOVE_CLEANUP_VECTOR irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt
apicinterrupt3 REBOOT_VECTOR reboot_interrupt smp_reboot_interrupt
#endif
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
index df00299..a712d82 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -13,8 +13,7 @@
BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
-BUILD_INTERRUPT3(irq_move_cleanup_interrupt, IRQ_MOVE_CLEANUP_VECTOR,
- smp_irq_move_cleanup_interrupt)
+BUILD_INTERRUPT(irq_move_cleanup_interrupt, IRQ_MOVE_CLEANUP_VECTOR)
BUILD_INTERRUPT3(reboot_interrupt, REBOOT_VECTOR, smp_reboot_interrupt)
#endif
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 6615032..8fef2ac 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -58,7 +58,7 @@ extern void trace_threshold_interrupt(void);
extern void trace_deferred_error_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
+extern void trace_irq_move_cleanup_interrupt(void);
#define trace_reboot_interrupt reboot_interrupt
#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
#define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
diff --git a/arch/x86/include/asm/trace/irq_vectors.h b/arch/x86/include/asm/trace/irq_vectors.h
index 38a09a1..2dacb55 100644
--- a/arch/x86/include/asm/trace/irq_vectors.h
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -112,6 +112,12 @@ DEFINE_IRQ_VECTOR_EVENT(deferred_error_apic);
*/
DEFINE_IRQ_VECTOR_EVENT(thermal_apic);
+/*
+ * irq_move_cleanup - called when entering/exiting an IRQ move cleanup
+ * vector handler.
+ */
+DEFINE_IRQ_VECTOR_EVENT(irq_move_cleanup);
+
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE irq_vectors
diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c
index f813261..d0c1057 100644
--- a/arch/x86/kernel/apic/vector.c
+++ b/arch/x86/kernel/apic/vector.c
@@ -20,6 +20,7 @@
#include <asm/i8259.h>
#include <asm/desc.h>
#include <asm/irq_remapping.h>
+#include <asm/trace/irq_vectors.h>
struct apic_chip_data {
struct irq_cfg cfg;
@@ -532,12 +533,10 @@ void send_cleanup_vector(struct irq_cfg *cfg)
__send_cleanup_vector(data);
}
-asmlinkage __visible void smp_irq_move_cleanup_interrupt(void)
+static void __smp_irq_move_cleanup_interrupt(void)
{
unsigned vector, me;
- entering_ack_irq();
-
me = smp_processor_id();
for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
int irq;
@@ -587,7 +586,21 @@ asmlinkage __visible void smp_irq_move_cleanup_interrupt(void)
unlock:
raw_spin_unlock(&desc->lock);
}
+}
+
+asmlinkage __visible void smp_irq_move_cleanup_interrupt(void)
+{
+ entering_ack_irq();
+ __smp_irq_move_cleanup_interrupt();
+ exiting_irq();
+}
+asmlinkage __visible void smp_trace_irq_move_cleanup_interrupt(void)
+{
+ entering_ack_irq();
+ trace_irq_move_cleanup_entry(IRQ_MOVE_CLEANUP_VECTOR);
+ __smp_irq_move_cleanup_interrupt();
+ trace_irq_move_cleanup_exit(IRQ_MOVE_CLEANUP_VECTOR);
exiting_irq();
}
--
2.7.0