Tracing of IRQ on/off paths on x86_64 currently suffers from heavy
over-instrumentation. This patch aligns x86_64 in this regard with i386
(and hopefully the other tracer-supporting archs too). It also gets rid
of related *_thunk indirections (I wonder if we cannot kill more of
them...).

Jan
---
 arch/x86_64/kernel/entry.S    |   26 ++++++++++++++++++--------
 arch/x86_64/kernel/ipipe.c    |   16 ----------------
 arch/x86_64/lib/thunk.S       |    5 -----
 include/asm-x86_64/irqflags.h |   15 ++++-----------
 4 files changed, 22 insertions(+), 40 deletions(-)

Index: linux-2.6.23.1-xeno_64/arch/x86_64/kernel/entry.S
===================================================================
--- linux-2.6.23.1-xeno_64.orig/arch/x86_64/kernel/entry.S
+++ linux-2.6.23.1-xeno_64/arch/x86_64/kernel/entry.S
@@ -542,16 +542,28 @@ END(stub_rt_sigreturn)
 	 */
 	TRACE_IRQS_OFF
 #ifdef CONFIG_IPIPE_TRACE_IRQSOFF
-        leaq RIP-8(%rdi), %rbp
-        pushq %rdi
-        movq ORIG_RAX(%rdi), %rdi
+	leaq RIP-8(%rdi), %rbp	# make interrupted address show up in trace
+	pushq %rdi
+	movq ORIG_RAX(%rdi), %rdi	# IRQ number
+	notq %rdi			# ...is inverted, fix up
+	call ipipe_trace_begin
+	popq %rdi
+	popq %rbp
+	pushq %rbp
+
+	call \func
+
+	popq %rbp
+	pushq %rbp
+	movq 8-ARGOFFSET+ORIG_RAX(%rbp), %rdi
+	leaq 8-ARGOFFSET+RIP-8(%rbp), %rbp
 	notq %rdi
-        call ipipe_trace_begin_thunk
-        popq %rdi
+	call ipipe_trace_end
 	popq %rbp
 	pushq %rbp
-#endif
+#else
 	call \func
+#endif
 	.endm
 
 #ifdef CONFIG_IPIPE
@@ -602,7 +614,6 @@ ENTRY(common_interrupt)
 	jnz ret_from_intr
 	decl %gs:pda_irqcount
 	leaveq
-	IPIPE_TRACE_IRQS_ON
 	CFI_DEF_CFA_REGISTER	rsp
 	CFI_ADJUST_CFA_OFFSET	-8
 	testl $3,CS-ARGOFFSET(%rsp)
@@ -734,7 +745,6 @@ END(common_interrupt)
 	jnz ret_from_intr
 	decl %gs:pda_irqcount
 	leaveq
-	IPIPE_TRACE_IRQS_ON
 	CFI_DEF_CFA_REGISTER	rsp
 	CFI_ADJUST_CFA_OFFSET	-8
 	testl $3,CS-ARGOFFSET(%rsp)
Index: linux-2.6.23.1-xeno_64/arch/x86_64/kernel/ipipe.c
===================================================================
--- linux-2.6.23.1-xeno_64.orig/arch/x86_64/kernel/ipipe.c
+++ linux-2.6.23.1-xeno_64/arch/x86_64/kernel/ipipe.c
@@ -760,10 +760,6 @@ finalize:
 
 finalize_nosync:
 
-#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
-	ipipe_trace_end(irq);
-#endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
-
 	if (!ipipe_root_domain_p ||
 	    test_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status)))
 		return 0;
@@ -771,18 +767,6 @@ finalize_nosync:
 	return 1;
 }
 
-#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
-void notrace __ipipe_trace_irqs_off(void)
-{
-	ipipe_trace_begin(0x80000000);
-}
-
-void notrace __ipipe_trace_irqs_on(void)
-{
-	ipipe_trace_end(0x80000000);
-}
-#endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
-
 EXPORT_SYMBOL(__ipipe_tick_irq);
 EXPORT_SYMBOL(ipipe_critical_enter);
 EXPORT_SYMBOL(ipipe_critical_exit);
Index: linux-2.6.23.1-xeno_64/arch/x86_64/lib/thunk.S
===================================================================
--- linux-2.6.23.1-xeno_64.orig/arch/x86_64/lib/thunk.S
+++ linux-2.6.23.1-xeno_64/arch/x86_64/lib/thunk.S
@@ -56,11 +56,6 @@
 	thunk_retrax __ipipe_preempt_schedule_irq_thunk,__ipipe_preempt_schedule_irq
 #endif	
 	thunk_retrax __ipipe_syscall_root_thunk,__ipipe_syscall_root
-#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
-	thunk __ipipe_trace_irqs_on_thunk,__ipipe_trace_irqs_on
-	thunk __ipipe_trace_irqs_off_thunk,__ipipe_trace_irqs_off
-	thunk ipipe_trace_begin_thunk,ipipe_trace_begin
-#endif	
 #endif
 	
 	/* SAVE_ARGS below is used only for the .cfi directives it contains. */
Index: linux-2.6.23.1-xeno_64/include/asm-x86_64/irqflags.h
===================================================================
--- linux-2.6.23.1-xeno_64.orig/include/asm-x86_64/irqflags.h
+++ linux-2.6.23.1-xeno_64/include/asm-x86_64/irqflags.h
@@ -241,19 +241,12 @@ static inline void local_irq_enable_hw_n
 #endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
 
 #else /* __ASSEMBLY__: */
-#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
-#define IPIPE_TRACE_IRQS_ON	call __ipipe_trace_irqs_on_thunk
-#define IPIPE_TRACE_IRQS_OFF	call __ipipe_trace_irqs_off_thunk
-#else /* !CONFIG_IPIPE_TRACE_IRQSOFF */
-#define IPIPE_TRACE_IRQS_ON
-#define IPIPE_TRACE_IRQS_OFF
-#endif /* !CONFIG_IPIPE_TRACE_IRQSOFF */
 # ifdef CONFIG_TRACE_IRQFLAGS
-#  define TRACE_IRQS_ON	IPIPE_TRACE_IRQS_ON; call trace_hardirqs_on_thunk
-#  define TRACE_IRQS_OFF	IPIPE_TRACE_IRQS_OFF; call trace_hardirqs_off_thunk
+#  define TRACE_IRQS_ON		call trace_hardirqs_on_thunk
+#  define TRACE_IRQS_OFF	call trace_hardirqs_off_thunk
 # else
-#  define TRACE_IRQS_ON	IPIPE_TRACE_IRQS_ON
-#  define TRACE_IRQS_OFF	IPIPE_TRACE_IRQS_OFF
+#  define TRACE_IRQS_ON
+#  define TRACE_IRQS_OFF
 # endif
 #endif
 

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Reply via email to