lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <87egcavvpd.fsf@gmail.com>
Date:	Thu, 18 Feb 2016 17:18:06 +0100
From:	Nicolai Stange <nicstange@...il.com>
To:	x86@...nel.org
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH v2] arch, x86, irq: enable tracing of irq_move_cleanup_interrupt vector

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@...il.com>
---
 Note: the address of commit cf910e83ae23's author,
   Seiji Aguchi <seiji.aguchi@....com>,
 bounces.

 Changes to v1.1:
 Rebase against current kernel/git/tip/tip.git x86/core

 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 9d34d3c..0676f6b 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -676,7 +676,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 1815b73..792920a 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 3b670df..035659d 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;
@@ -557,12 +558,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();
-
 	/* Prevent vectors vanishing under us */
 	raw_spin_lock(&vector_lock);
 
@@ -631,7 +630,21 @@ unlock:
 	}
 
 	raw_spin_unlock(&vector_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.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ