All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC patch 00/20] Kernel tracing thread flag
@ 2009-05-09 16:22 Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 01/20] LTTng Kernel Trace Thread Flag Alpha Mathieu Desnoyers
                   ` (20 more replies)
  0 siblings, 21 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh

This is the generalisation of the TIF_SYSCALL_FTRACE thread flag for :

- multiple tracers (even accessible from modules)
- multiple architectures

It includes :

- Addition of the TIF_KERNEL_TRACE for all Linux architectures.
- Modification of some architecture entry*.S files to ensure that the thread
  flag is re-read upon syscall exit to ensure that syscall exit is traced.
  Basically, what I try to achieve here is to make sure that given the following
  sequence will get its syscall exit event traced :

- Thread preempted in a system call
- Activation of all TIF_KERNEL_TRACE thread flags
- ...enough time passes to expect that all tracing sites are activated...
- syscall exit -> expected to be traced

But if the thread flags used at syscall exit are the same that has been read at
syscall entry, the event will be skipped. This does not permit reaching a known
"quiescent state" where we know that all tracing sites are activated.

Note that having non-perfectly matched syscall trace entry/exit may have
implications wrt getname/putname refcounting for instance, and could cause
problems if getname/putname was used in the syscall entry/exit pairs. We will
have to deal with this somehow when we face this problem. Keeping a per-thread
flag saying that a matching syscall_entry tracing has been executed could fix
this problem. We could even re-use TIF_SYSCALL_FTRACE for this specific purpose.

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 01/20] LTTng Kernel Trace Thread Flag Alpha
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 02/20] LTTng Kernel Trace Thread Flag ARM Mathieu Desnoyers
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-alpha.patch --]
[-- Type: text/plain, Size: 1680 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/alpha/include/asm/thread_info.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/alpha/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/alpha/include/asm/thread_info.h	2009-03-15 15:57:05.000000000 -0400
+++ linux-2.6-lttng/arch/alpha/include/asm/thread_info.h	2009-03-15 15:57:12.000000000 -0400
@@ -74,6 +74,7 @@ register struct thread_info *__current_t
 #define TIF_UAC_SIGBUS		7
 #define TIF_MEMDIE		8
 #define TIF_RESTORE_SIGMASK	9	/* restore signal mask in do_signal */
+#define TIF_KERNEL_TRACE	10	/* Kernel tracing of syscalls */
 #define TIF_FREEZE		16	/* is freezing for suspend */
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
@@ -81,6 +82,7 @@ register struct thread_info *__current_t
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 
 /* Work to do on interrupt/exception return.  */
@@ -88,7 +90,7 @@ register struct thread_info *__current_t
 
 /* Work to do on any return to userspace.  */
 #define _TIF_ALLWORK_MASK	(_TIF_WORK_MASK		\
-				 | _TIF_SYSCALL_TRACE)
+				 | _TIF_SYSCALL_TRACE | _TIF_KERNEL_TRACE)
 
 #define ALPHA_UAC_SHIFT		6
 #define ALPHA_UAC_MASK		(1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 02/20] LTTng Kernel Trace Thread Flag ARM
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 01/20] LTTng Kernel Trace Thread Flag Alpha Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 03/20] LTTng Kernel Trace Thread Flag AVR32 Mathieu Desnoyers
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-arm.patch --]
[-- Type: text/plain, Size: 2263 bytes --]

Add a thread flag to activate system-wide syscall tracing.

folded omap-arm-fix-syscall-exit-trace-flag.patch.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/arm/include/asm/thread_info.h |    3 +++
 arch/arm/kernel/entry-common.S     |    2 ++
 2 files changed, 5 insertions(+)

Index: linux-2.6-lttng/arch/arm/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/arm/include/asm/thread_info.h	2009-04-23 14:56:15.000000000 -0400
+++ linux-2.6-lttng/arch/arm/include/asm/thread_info.h	2009-04-23 14:56:23.000000000 -0400
@@ -128,6 +128,7 @@ extern void vfp_sync_state(struct thread
 /*
  * thread information flags:
  *  TIF_SYSCALL_TRACE	- syscall trace active
+ *  TIF_KERNEL_TRACE	- kernel trace active
  *  TIF_SIGPENDING	- signal pending
  *  TIF_NEED_RESCHED	- rescheduling necessary
  *  TIF_USEDFPU		- FPU was used by this task this quantum (SMP)
@@ -135,6 +136,7 @@ extern void vfp_sync_state(struct thread
  */
 #define TIF_SIGPENDING		0
 #define TIF_NEED_RESCHED	1
+#define TIF_KERNEL_TRACE	7
 #define TIF_SYSCALL_TRACE	8
 #define TIF_POLLING_NRFLAG	16
 #define TIF_USING_IWMMXT	17
@@ -143,6 +145,7 @@ extern void vfp_sync_state(struct thread
 
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
 #define _TIF_USING_IWMMXT	(1 << TIF_USING_IWMMXT)
Index: linux-2.6-lttng/arch/arm/kernel/entry-common.S
===================================================================
--- linux-2.6-lttng.orig/arch/arm/kernel/entry-common.S	2009-04-23 14:56:15.000000000 -0400
+++ linux-2.6-lttng/arch/arm/kernel/entry-common.S	2009-04-23 14:56:23.000000000 -0400
@@ -47,6 +47,8 @@ ret_fast_syscall:
  * Ok, we need to do extra processing, enter the slow path.
  */
 fast_work_pending:
+	tst	r1, #_TIF_KERNEL_TRACE		@ flag can be set asynchronously
+	bne	__sys_trace_return
 	str	r0, [sp, #S_R0+S_OFF]!		@ returned r0
 work_pending:
 	tst	r1, #_TIF_NEED_RESCHED

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 03/20] LTTng Kernel Trace Thread Flag AVR32
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 01/20] LTTng Kernel Trace Thread Flag Alpha Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 02/20] LTTng Kernel Trace Thread Flag ARM Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 04/20] LTTng Kernel Trace Thread Flag Blackfin Mathieu Desnoyers
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-avr32.patch --]
[-- Type: text/plain, Size: 1843 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/avr32/include/asm/thread_info.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/avr32/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/avr32/include/asm/thread_info.h	2009-03-15 15:57:05.000000000 -0400
+++ linux-2.6-lttng/arch/avr32/include/asm/thread_info.h	2009-03-15 15:57:14.000000000 -0400
@@ -84,6 +84,7 @@ static inline struct thread_info *curren
 #define TIF_MEMDIE		6
 #define TIF_RESTORE_SIGMASK	7	/* restore signal mask in do_signal */
 #define TIF_CPU_GOING_TO_SLEEP	8	/* CPU is entering sleep 0 mode */
+#define TIF_KERNEL_TRACE	9	/* kernel trace active */
 #define TIF_FREEZE		29
 #define TIF_DEBUG		30	/* debugging enabled */
 #define TIF_USERSPACE		31      /* true if FS sets userspace */
@@ -96,6 +97,7 @@ static inline struct thread_info *curren
 #define _TIF_MEMDIE		(1 << TIF_MEMDIE)
 #define _TIF_RESTORE_SIGMASK	(1 << TIF_RESTORE_SIGMASK)
 #define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
 #define _TIF_FREEZE		(1 << TIF_FREEZE)
 
 /* Note: The masks below must never span more than 16 bits! */
@@ -109,7 +111,7 @@ static inline struct thread_info *curren
 	 | (1 << TIF_RESTORE_SIGMASK))
 
 /* work to do on any return to userspace */
-#define _TIF_ALLWORK_MASK	(_TIF_WORK_MASK | (1 << TIF_SYSCALL_TRACE))
+#define _TIF_ALLWORK_MASK	(_TIF_WORK_MASK | _TIF_SYSCALL_TRACE | _TIF_KERNEL_TRACE)
 /* work to do on return from debug mode */
 #define _TIF_DBGWORK_MASK	(_TIF_WORK_MASK & ~(1 << TIF_BREAKPOINT))
 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 04/20] LTTng Kernel Trace Thread Flag Blackfin
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (2 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 03/20] LTTng Kernel Trace Thread Flag AVR32 Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 05/20] LTTng Kernel Trace Thread Flag Cris Mathieu Desnoyers
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-blackfin.patch --]
[-- Type: text/plain, Size: 1554 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/blackfin/include/asm/thread_info.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/blackfin/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/blackfin/include/asm/thread_info.h	2009-03-16 19:50:47.000000000 -0400
+++ linux-2.6-lttng/arch/blackfin/include/asm/thread_info.h	2009-03-16 19:55:16.000000000 -0400
@@ -123,6 +123,7 @@ static inline struct thread_info *curren
 #define TIF_RESTORE_SIGMASK	5	/* restore signal mask in do_signal() */
 #define TIF_FREEZE              6       /* is freezing for suspend */
 #define TIF_IRQ_SYNC            7       /* sync pipeline stage */
+#define TIF_KERNEL_TRACE        8       /* kernel trace active */
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
@@ -132,8 +133,9 @@ static inline struct thread_info *curren
 #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
 #define _TIF_FREEZE             (1<<TIF_FREEZE)
 #define _TIF_IRQ_SYNC           (1<<TIF_IRQ_SYNC)
+#define _TIF_KERNEL_TRACE       (1<<TIF_KERNEL_TRACE)
 
-#define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK		0x0000FEFE	/* work to do on interrupt/exception return */
 
 #endif				/* __KERNEL__ */
 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 05/20] LTTng Kernel Trace Thread Flag Cris
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (3 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 04/20] LTTng Kernel Trace Thread Flag Blackfin Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 06/20] LTTng Kernel Trace Thread Flag Frv Mathieu Desnoyers
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-cris.patch --]
[-- Type: text/plain, Size: 1886 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/cris/include/asm/thread_info.h |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6-lttng/arch/cris/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/cris/include/asm/thread_info.h	2009-03-15 15:57:05.000000000 -0400
+++ linux-2.6-lttng/arch/cris/include/asm/thread_info.h	2009-03-15 15:57:14.000000000 -0400
@@ -85,6 +85,7 @@ struct thread_info {
 #define TIF_NOTIFY_RESUME	1	/* resumption notification requested */
 #define TIF_SIGPENDING		2	/* signal pending */
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
+#define TIF_KERNEL_TRACE	4	/* kernel trace active */
 #define TIF_RESTORE_SIGMASK	9	/* restore signal mask in do_signal() */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE		17
@@ -94,12 +95,16 @@ struct thread_info {
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 
-#define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */
-#define _TIF_ALLWORK_MASK	0x0000FFFF	/* work to do on any return to u-space */
+/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK		0x0000FFFF & \
+		(~_TIF_SYSCALL_TRACE | ~_TIF_KERNEL_TRACE)
+/* work to do on any return to u-space */
+#define _TIF_ALLWORK_MASK	0x0000FFFF
 
 #endif /* __KERNEL__ */
 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 06/20] LTTng Kernel Trace Thread Flag Frv
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (4 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 05/20] LTTng Kernel Trace Thread Flag Cris Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 07/20] LTTng Kernel Trace Thread Flag H8300 Mathieu Desnoyers
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-frv.patch --]
[-- Type: text/plain, Size: 1739 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/frv/include/asm/thread_info.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/frv/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/frv/include/asm/thread_info.h	2009-04-19 00:07:33.000000000 -0400
+++ linux-2.6-lttng/arch/frv/include/asm/thread_info.h	2009-04-19 00:09:00.000000000 -0400
@@ -114,6 +114,7 @@ register struct thread_info *__current_t
 #define TIF_SINGLESTEP		3	/* restore singlestep on return to user mode */
 #define TIF_IRET		4	/* return with iret */
 #define TIF_RESTORE_SIGMASK	5	/* restore signal mask in do_signal() */
+#define TIF_KERNEL_TRACE	6	/* kernel trace active */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE		17	/* OOM killer killed process */
 #define TIF_FREEZE		18	/* freezing for suspend */
@@ -124,10 +125,11 @@ register struct thread_info *__current_t
 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_IRET		(1 << TIF_IRET)
 #define _TIF_RESTORE_SIGMASK	(1 << TIF_RESTORE_SIGMASK)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
 #define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
 #define _TIF_FREEZE		(1 << TIF_FREEZE)
 
-#define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK		0x0000FFBE	/* work to do on interrupt/exception return */
 #define _TIF_ALLWORK_MASK	0x0000FFFF	/* work to do on any return to u-space */
 
 /*

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 07/20] LTTng Kernel Trace Thread Flag H8300
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (5 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 06/20] LTTng Kernel Trace Thread Flag Frv Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 08/20] LTTng Kernel Trace Thread Flag ia64 Mathieu Desnoyers
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-h8300.patch --]
[-- Type: text/plain, Size: 1474 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/h8300/include/asm/thread_info.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/h8300/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/h8300/include/asm/thread_info.h	2009-03-15 15:57:05.000000000 -0400
+++ linux-2.6-lttng/arch/h8300/include/asm/thread_info.h	2009-03-15 15:57:15.000000000 -0400
@@ -89,6 +89,7 @@ static inline struct thread_info *curren
 					   TIF_NEED_RESCHED */
 #define TIF_MEMDIE		4
 #define TIF_RESTORE_SIGMASK	5	/* restore signal mask in do_signal() */
+#define TIF_KERNEL_TRACE	6	/* kernel trace active */
 #define TIF_FREEZE		16	/* is freezing for suspend */
 
 /* as above, but as bit values */
@@ -97,9 +98,10 @@ static inline struct thread_info *curren
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 
-#define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK		0x0000FFBE	/* work to do on interrupt/exception return */
 
 #endif /* __KERNEL__ */
 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 08/20] LTTng Kernel Trace Thread Flag ia64
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (6 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 07/20] LTTng Kernel Trace Thread Flag H8300 Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 09/20] LTTng Kernel Trace Thread Flag m32r Mathieu Desnoyers
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers, Masami Hiramatsu

[-- Attachment #1: lttng-kernel-trace-thread-flag-ia64.patch --]
[-- Type: text/plain, Size: 3439 bytes --]

Add a thread flag to activate system-wide syscall tracing.

FIXME : Masami reported that enabling the KERNEL_TRACE thread flag did disable
the gate page for gettimeofday, falling back on a standard system call. More
work would be needed in this area and I don't have the architecture available.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Masami Hiramatsu <mhiramat@redhat.com>
---
 arch/ia64/include/asm/thread_info.h |   10 +++++++---
 arch/ia64/kernel/entry.S            |    6 ++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

Index: linux-2.6-lttng/arch/ia64/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/ia64/include/asm/thread_info.h	2009-04-23 14:56:15.000000000 -0400
+++ linux-2.6-lttng/arch/ia64/include/asm/thread_info.h	2009-04-23 14:56:30.000000000 -0400
@@ -100,6 +100,7 @@ struct thread_info {
 #define TIF_SYSCALL_TRACE	2	/* syscall trace active */
 #define TIF_SYSCALL_AUDIT	3	/* syscall auditing active */
 #define TIF_SINGLESTEP		4	/* restore singlestep on return to user mode */
+#define TIF_KERNEL_TRACE	5	/* kernel trace active */
 #define TIF_NOTIFY_RESUME	6	/* resumption notification requested */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE		17
@@ -111,7 +112,9 @@ struct thread_info {
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
-#define _TIF_SYSCALL_TRACEAUDIT	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
+#define _TIF_SYSCALL_TRACEAUDIT	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|\
+	_TIF_SINGLESTEP|_TIF_KERNEL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
@@ -124,8 +127,9 @@ struct thread_info {
 /* "work to do on user-return" bits */
 #define TIF_ALLWORK_MASK	(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\
 				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE)
-/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
-#define TIF_WORK_MASK		(TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
+/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE, TIF_KERNEL_TRACE or TIF_SYSCALL_AUDIT */
+#define TIF_WORK_MASK		(TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_KERNEL_TRACE|\
+					_TIF_SYSCALL_AUDIT))
 
 #define TS_POLLING		1 	/* true if in idle loop and not sleeping */
 #define TS_RESTORE_SIGMASK	2	/* restore signal mask in do_signal() */
Index: linux-2.6-lttng/arch/ia64/kernel/entry.S
===================================================================
--- linux-2.6-lttng.orig/arch/ia64/kernel/entry.S	2009-04-23 14:56:15.000000000 -0400
+++ linux-2.6-lttng/arch/ia64/kernel/entry.S	2009-04-23 14:56:30.000000000 -0400
@@ -635,9 +635,11 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
 	;;
 	ld4 r2=[r2]
 	;;
+	movl r8=_TIF_SYSCALL_TRACEAUDIT
+	;;					// added stop bits to prevent r8 dependency
+	and r2=r8,r2
 	mov r8=0
-	and r2=_TIF_SYSCALL_TRACEAUDIT,r2
-	;;
+	;;					// added stop bits to prevent r2 dependency
 	cmp.ne p6,p0=r2,r0
 (p6)	br.cond.spnt .strace_check_retval
 	;;					// added stop bits to prevent r8 dependency

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 09/20] LTTng Kernel Trace Thread Flag m32r
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (7 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 08/20] LTTng Kernel Trace Thread Flag ia64 Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 10/20] LTTng Kernel Trace Thread Flag m68k Mathieu Desnoyers
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-m32r.patch --]
[-- Type: text/plain, Size: 2014 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/m32r/include/asm/thread_info.h |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6-lttng/arch/m32r/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/m32r/include/asm/thread_info.h	2009-05-09 11:39:23.000000000 -0400
+++ linux-2.6-lttng/arch/m32r/include/asm/thread_info.h	2009-05-09 11:40:38.000000000 -0400
@@ -151,6 +151,7 @@ static inline unsigned int get_thread_fa
 #define TIF_NEED_RESCHED	2	/* rescheduling necessary */
 #define TIF_SINGLESTEP		3	/* restore singlestep on return to user mode */
 #define TIF_IRET		4	/* return with iret */
+#define TIF_KERNEL_TRACE	5	/* kernel trace active */
 #define TIF_RESTORE_SIGMASK	8	/* restore signal mask in do_signal() */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
@@ -162,13 +163,17 @@ static inline unsigned int get_thread_fa
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_SINGLESTEP		(1<<TIF_SINGLESTEP)
 #define _TIF_IRET		(1<<TIF_IRET)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 
-#define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */
-#define _TIF_ALLWORK_MASK	0x0000FFFF	/* work to do on any return to u-space */
+/* work to do on any return to u-space */
+#define _TIF_ALLWORK_MASK	0x0000FFFF
+/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK \
+	(0x0000FFFF & ~(_TIF_SYSCALL_TRACE | _TIF_KERNEL_TRACE))
 
 /*
  * Thread-synchronous status.

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 10/20] LTTng Kernel Trace Thread Flag m68k
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (8 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 09/20] LTTng Kernel Trace Thread Flag m32r Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 11/20] LTTng Kernel Trace Thread Flag MIPS Mathieu Desnoyers
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-m68k.patch --]
[-- Type: text/plain, Size: 2136 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/m68k/include/asm/thread_info_mm.h |    1 +
 arch/m68k/include/asm/thread_info_no.h |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/m68k/include/asm/thread_info_mm.h
===================================================================
--- linux-2.6-lttng.orig/arch/m68k/include/asm/thread_info_mm.h	2009-03-15 15:57:05.000000000 -0400
+++ linux-2.6-lttng/arch/m68k/include/asm/thread_info_mm.h	2009-03-15 15:57:16.000000000 -0400
@@ -49,6 +49,7 @@ struct thread_info {
  */
 #define TIF_SIGPENDING		6	/* signal pending */
 #define TIF_NEED_RESCHED	7	/* rescheduling necessary */
+#define TIF_KERNEL_TRACE	13	/* kernel trace active */
 #define TIF_DELAYED_TRACE	14	/* single step a syscall */
 #define TIF_SYSCALL_TRACE	15	/* syscall trace active */
 #define TIF_MEMDIE		16
Index: linux-2.6-lttng/arch/m68k/include/asm/thread_info_no.h
===================================================================
--- linux-2.6-lttng.orig/arch/m68k/include/asm/thread_info_no.h	2009-03-15 15:57:05.000000000 -0400
+++ linux-2.6-lttng/arch/m68k/include/asm/thread_info_no.h	2009-03-15 15:57:16.000000000 -0400
@@ -84,6 +84,7 @@ static inline struct thread_info *curren
 #define TIF_POLLING_NRFLAG	3	/* true if poll_idle() is polling
 					   TIF_NEED_RESCHED */
 #define TIF_MEMDIE		4
+#define TIF_KERNEL_TRACE	5	/* kernel trace active */
 #define TIF_FREEZE		16	/* is freezing for suspend */
 
 /* as above, but as bit values */
@@ -92,8 +93,9 @@ static inline struct thread_info *curren
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 
-#define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK		0x0000FFDE	/* work to do on interrupt/exception return */
 
 #endif /* __KERNEL__ */
 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 11/20] LTTng Kernel Trace Thread Flag MIPS
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (9 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 10/20] LTTng Kernel Trace Thread Flag m68k Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 12/20] LTTng Kernel Trace Thread Flag parisc Mathieu Desnoyers
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-mips.patch --]
[-- Type: text/plain, Size: 2443 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/mips/include/asm/thread_info.h |    4 +++-
 arch/mips/kernel/entry.S            |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6-lttng/arch/mips/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/mips/include/asm/thread_info.h	2009-03-23 22:40:31.000000000 -0400
+++ linux-2.6-lttng/arch/mips/include/asm/thread_info.h	2009-03-23 22:41:55.000000000 -0400
@@ -125,6 +125,7 @@ register struct thread_info *__current_t
 #define TIF_32BIT_ADDR		23	/* 32-bit address space (o32/n32) */
 #define TIF_FPUBOUND		24	/* thread bound to FPU-full CPU set */
 #define TIF_LOAD_WATCH		25	/* If set, load watch registers */
+#define TIF_KERNEL_TRACE	30	/* kernel trace active */
 #define TIF_SYSCALL_TRACE	31	/* syscall trace active */
 
 #ifdef CONFIG_MIPS32_O32
@@ -134,6 +135,7 @@ register struct thread_info *__current_t
 #endif /* CONFIG_MIPS32_O32 */
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
@@ -152,7 +154,7 @@ register struct thread_info *__current_t
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK		(0x0000ffef & ~_TIF_SECCOMP)
 /* work to do on any return to u-space */
-#define _TIF_ALLWORK_MASK	(0x8000ffff & ~_TIF_SECCOMP)
+#define _TIF_ALLWORK_MASK	(0xc000ffff & ~_TIF_SECCOMP)
 
 #endif /* __KERNEL__ */
 
Index: linux-2.6-lttng/arch/mips/kernel/entry.S
===================================================================
--- linux-2.6-lttng.orig/arch/mips/kernel/entry.S	2009-03-23 22:38:01.000000000 -0400
+++ linux-2.6-lttng/arch/mips/kernel/entry.S	2009-03-23 22:40:40.000000000 -0400
@@ -167,7 +167,7 @@ work_notifysig:				# deal with pending s
 FEXPORT(syscall_exit_work_partial)
 	SAVE_STATIC
 syscall_exit_work:
-	li	t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
+	li	t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
 	and	t0, a2			# a2 is preloaded with TI_FLAGS
 	beqz	t0, work_pending	# trace bit set?
 	local_irq_enable		# could let do_syscall_trace()

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 12/20] LTTng Kernel Trace Thread Flag parisc
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (10 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 11/20] LTTng Kernel Trace Thread Flag MIPS Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 13/20] LTTng Kernel Trace Thread Flag powerpc Mathieu Desnoyers
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-parisc.patch --]
[-- Type: text/plain, Size: 1324 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/parisc/include/asm/thread_info.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6-lttng/arch/parisc/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/parisc/include/asm/thread_info.h	2009-03-15 15:57:04.000000000 -0400
+++ linux-2.6-lttng/arch/parisc/include/asm/thread_info.h	2009-03-15 15:57:16.000000000 -0400
@@ -59,6 +59,7 @@ struct thread_info {
 #define TIF_MEMDIE		5
 #define TIF_RESTORE_SIGMASK	6	/* restore saved signal mask */
 #define TIF_FREEZE		7	/* is freezing for suspend */
+#define TIF_KERNEL_TRACE	8	/* kernel trace active */
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
@@ -67,6 +68,7 @@ struct thread_info {
 #define _TIF_32BIT		(1 << TIF_32BIT)
 #define _TIF_RESTORE_SIGMASK	(1 << TIF_RESTORE_SIGMASK)
 #define _TIF_FREEZE		(1 << TIF_FREEZE)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
 
 #define _TIF_USER_WORK_MASK     (_TIF_SIGPENDING | \
                                  _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 13/20] LTTng Kernel Trace Thread Flag powerpc
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (11 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 12/20] LTTng Kernel Trace Thread Flag parisc Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390 Mathieu Desnoyers
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-powerpc.patch --]
[-- Type: text/plain, Size: 2484 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/powerpc/include/asm/thread_info.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux-2.6-lttng/arch/powerpc/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/powerpc/include/asm/thread_info.h	2009-04-23 14:56:40.000000000 -0400
+++ linux-2.6-lttng/arch/powerpc/include/asm/thread_info.h	2009-04-23 14:56:42.000000000 -0400
@@ -102,7 +102,7 @@ static inline struct thread_info *curren
 #define TIF_POLLING_NRFLAG	3	/* true if poll_idle() is polling
 					   TIF_NEED_RESCHED */
 #define TIF_32BIT		4	/* 32 bit binary */
-#define TIF_PERFMON_WORK	5	/* work for pfm_handle_work() */
+#define TIF_KERNEL_TRACE	5	/* kernel trace active */
 #define TIF_PERFMON_CTXSW	6	/* perfmon needs ctxsw calls */
 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
 #define TIF_SINGLESTEP		8	/* singlestepping active */
@@ -114,6 +114,7 @@ static inline struct thread_info *curren
 #define TIF_FREEZE		14	/* Freezing for suspend */
 #define TIF_RUNLATCH		15	/* Is the runlatch enabled? */
 #define TIF_ABI_PENDING		16	/* 32/64 bit switch needed */
+#define TIF_PERFMON_WORK	17	/* work for pfm_handle_work() */
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
@@ -121,7 +122,7 @@ static inline struct thread_info *curren
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_32BIT		(1<<TIF_32BIT)
-#define _TIF_PERFMON_WORK	(1<<TIF_PERFMON_WORK)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_PERFMON_CTXSW	(1<<TIF_PERFMON_CTXSW)
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
 #define _TIF_SINGLESTEP		(1<<TIF_SINGLESTEP)
@@ -132,7 +133,8 @@ static inline struct thread_info *curren
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 #define _TIF_RUNLATCH		(1<<TIF_RUNLATCH)
 #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)
-#define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
+#define _TIF_PERFMON_WORK	(1<<TIF_PERFMON_WORK)
+#define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP|_TIF_KERNEL_TRACE)
 
 #define _TIF_USER_WORK_MASK	(_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
 				 _TIF_NOTIFY_RESUME)

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (12 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 13/20] LTTng Kernel Trace Thread Flag powerpc Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-11  8:25   ` Heiko Carstens
  2009-05-09 16:22 ` [RFC patch 15/20] LTTng Kernel Trace Thread Flag SH Mathieu Desnoyers
                   ` (6 subsequent siblings)
  20 siblings, 1 reply; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-s390.patch --]
[-- Type: text/plain, Size: 4306 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/s390/include/asm/thread_info.h |    2 ++
 arch/s390/kernel/entry.S            |   10 ++++++++--
 arch/s390/kernel/entry64.S          |   10 ++++++++--
 3 files changed, 18 insertions(+), 4 deletions(-)

Index: linux-2.6-lttng/arch/s390/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/s390/include/asm/thread_info.h	2009-03-15 15:57:04.000000000 -0400
+++ linux-2.6-lttng/arch/s390/include/asm/thread_info.h	2009-03-15 15:57:17.000000000 -0400
@@ -90,6 +90,7 @@ static inline struct thread_info *curren
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
 #define TIF_SINGLE_STEP		6	/* deliver sigtrap on return to user */
 #define TIF_MCCK_PENDING	7	/* machine check handling is pending */
+#define TIF_KERNEL_TRACE	8	/* kernel trace active */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling 
 					   TIF_NEED_RESCHED */
@@ -107,6 +108,7 @@ static inline struct thread_info *curren
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
 #define _TIF_SINGLE_STEP	(1<<TIF_SINGLE_STEP)
 #define _TIF_MCCK_PENDING	(1<<TIF_MCCK_PENDING)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_31BIT		(1<<TIF_31BIT)
Index: linux-2.6-lttng/arch/s390/kernel/entry.S
===================================================================
--- linux-2.6-lttng.orig/arch/s390/kernel/entry.S	2009-03-15 15:51:10.000000000 -0400
+++ linux-2.6-lttng/arch/s390/kernel/entry.S	2009-03-15 15:57:17.000000000 -0400
@@ -265,7 +265,9 @@ sysc_do_restart:
 	sth	%r7,SP_SVCNR(%r15)
 	sll	%r7,2		  # svc number *4
 	l	%r8,BASED(.Lsysc_table)
-	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+3(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	l	%r8,0(%r7,%r8)	  # get system call addr.
 	bnz	BASED(sysc_tracesys)
 	basr	%r14,%r8	  # call sys_xxxx
@@ -405,7 +407,9 @@ sysc_tracego:
 	basr	%r14,%r8		# call sys_xxx
 	st	%r2,SP_R2(%r15)		# store return value
 sysc_tracenogo:
-	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+3(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	bz	BASED(sysc_return)
 	l	%r1,BASED(.Ltrace_exit)
 	la	%r2,SP_PTREGS(%r15)	# load pt_regs
@@ -1049,6 +1053,8 @@ cleanup_io_leave_insn:
 .L0x030:	.short	0x030
 .L0x038:	.short	0x038
 .Lc_1:		.long	1
+.Lc_tif_syscall_trace_or_audit_or_kernel_trace:
+		.long	_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_KERNEL_TRACE
 
 /*
  * Symbol constants
Index: linux-2.6-lttng/arch/s390/kernel/entry64.S
===================================================================
--- linux-2.6-lttng.orig/arch/s390/kernel/entry64.S	2009-03-15 15:51:10.000000000 -0400
+++ linux-2.6-lttng/arch/s390/kernel/entry64.S	2009-03-15 15:57:17.000000000 -0400
@@ -260,7 +260,9 @@ sysc_do_restart:
 	larl	%r10,sys_call_table_emu  # use 31 bit emulation system calls
 sysc_noemu:
 #endif
-	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+7(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	lgf	%r8,0(%r7,%r10) # load address of system call routine
 	jnz	sysc_tracesys
 	basr	%r14,%r8	# call sys_xxxx
@@ -391,7 +393,9 @@ sysc_tracego:
 	basr	%r14,%r8		# call sys_xxx
 	stg	%r2,SP_R2(%r15)		# store return value
 sysc_tracenogo:
-	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+7(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	jz	sysc_return
 	la	%r2,SP_PTREGS(%r15)	# load pt_regs
 	larl	%r14,sysc_return	# return point is sysc_return
@@ -1033,6 +1037,8 @@ cleanup_io_leave_insn:
 		.align	4
 .Lconst:
 .Lnr_syscalls:	.long	NR_syscalls
+.Lc_tif_syscall_trace_or_audit_or_kernel_trace:
+		.long	_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_KERNEL_TRACE
 .L0x0130:	.short	0x130
 .L0x0140:	.short	0x140
 .L0x0150:	.short	0x150

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 15/20] LTTng Kernel Trace Thread Flag SH
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (13 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390 Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 17:15   ` Paul Mundt
  2009-05-09 16:22 ` [RFC patch 16/20] LTTng Kernel Trace Thread Flag sparc Mathieu Desnoyers
                   ` (5 subsequent siblings)
  20 siblings, 1 reply; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-sh.patch --]
[-- Type: text/plain, Size: 2359 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/sh/include/asm/thread_info.h |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Index: linux-2.6-lttng/arch/sh/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/sh/include/asm/thread_info.h	2009-03-15 15:57:04.000000000 -0400
+++ linux-2.6-lttng/arch/sh/include/asm/thread_info.h	2009-03-15 15:57:17.000000000 -0400
@@ -116,6 +116,7 @@ extern void free_thread_info(struct thre
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
 #define TIF_SECCOMP		6	/* secure computing */
 #define TIF_NOTIFY_RESUME	7	/* callback before returning to user */
+#define TIF_KERNEL_TRACE	8	/* kernel trace active */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE		18
@@ -129,6 +130,7 @@ extern void free_thread_info(struct thre
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
 #define _TIF_USEDFPU		(1 << TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
 #define _TIF_FREEZE		(1 << TIF_FREEZE)
@@ -141,17 +143,19 @@ extern void free_thread_info(struct thre
 
 /* work to do in syscall trace */
 #define _TIF_WORK_SYSCALL_MASK	(_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
-				 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
+				 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
+				 _TIF_KERNEL_TRACE)
 
 /* work to do on any return to u-space */
 #define _TIF_ALLWORK_MASK	(_TIF_SYSCALL_TRACE | _TIF_SIGPENDING      | \
 				 _TIF_NEED_RESCHED  | _TIF_SYSCALL_AUDIT   | \
 				 _TIF_SINGLESTEP    | _TIF_RESTORE_SIGMASK | \
-				 _TIF_NOTIFY_RESUME)
+				 _TIF_NOTIFY_RESUME | _TIF_KERNEL_TRACE)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK		(_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
-				 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
+				 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP | \
+				 _TIF_KERNEL_TRACE))
 
 #endif /* __KERNEL__ */
 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 16/20] LTTng Kernel Trace Thread Flag sparc
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (14 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 15/20] LTTng Kernel Trace Thread Flag SH Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 17/20] LTTng Kernel Trace Thread Flag UML Mathieu Desnoyers
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-sparc.patch --]
[-- Type: text/plain, Size: 3958 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Folded lttng-kernel-trace-thread-flag-sparc64.patch.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/sparc/include/asm/thread_info_32.h |    2 ++
 arch/sparc/include/asm/thread_info_64.h |    3 ++-
 arch/sparc/kernel/entry.S               |    8 ++++----
 3 files changed, 8 insertions(+), 5 deletions(-)

Index: linux-2.6-lttng/arch/sparc/include/asm/thread_info_32.h
===================================================================
--- linux-2.6-lttng.orig/arch/sparc/include/asm/thread_info_32.h	2009-03-15 15:57:04.000000000 -0400
+++ linux-2.6-lttng/arch/sparc/include/asm/thread_info_32.h	2009-03-15 15:57:18.000000000 -0400
@@ -130,6 +130,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, 
 #define TIF_SIGPENDING		2	/* signal pending */
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_RESTORE_SIGMASK	4	/* restore signal mask in do_signal() */
+#define TIF_KERNEL_TRACE	5	/* kernel trace active */
 #define TIF_USEDFPU		8	/* FPU was used by this task
 					 * this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	9	/* true if poll_idle() is polling
@@ -139,6 +140,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, 
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
Index: linux-2.6-lttng/arch/sparc/kernel/entry.S
===================================================================
--- linux-2.6-lttng.orig/arch/sparc/kernel/entry.S	2009-03-15 15:57:04.000000000 -0400
+++ linux-2.6-lttng/arch/sparc/kernel/entry.S	2009-03-15 15:57:18.000000000 -0400
@@ -1118,7 +1118,7 @@ sys_sigreturn:
 	 add	%sp, STACKFRAME_SZ, %o0
 
 	ld	[%curptr + TI_FLAGS], %l5
-	andcc	%l5, _TIF_SYSCALL_TRACE, %g0
+	andcc	%l5, (_TIF_SYSCALL_TRACE|_TIF_KERNEL_TRACE), %g0
 	be	1f
 	 nop
 
@@ -1138,7 +1138,7 @@ sys_rt_sigreturn:
 	 add	%sp, STACKFRAME_SZ, %o0
 
 	ld	[%curptr + TI_FLAGS], %l5
-	andcc	%l5, _TIF_SYSCALL_TRACE, %g0
+	andcc	%l5, (_TIF_SYSCALL_TRACE|_TIF_KERNEL_TRACE), %g0
 	be	1f
 	 nop
 
@@ -1280,7 +1280,7 @@ syscall_is_too_hard:
 
 	ld	[%curptr + TI_FLAGS], %l5
 	mov	%i3, %o3
-	andcc	%l5, _TIF_SYSCALL_TRACE, %g0
+	andcc	%l5, (_TIF_SYSCALL_TRACE|_TIF_KERNEL_TRACE), %g0
 	mov	%i4, %o4
 	bne	linux_syscall_trace
 	 mov	%i0, %l5
@@ -1297,7 +1297,7 @@ ret_sys_call:
 	ld	[%sp + STACKFRAME_SZ + PT_PSR], %g3
 	set	PSR_C, %g2
 	bgeu	1f
-	 andcc	%l6, _TIF_SYSCALL_TRACE, %g0
+	 andcc	%l6, (_TIF_SYSCALL_TRACE|_TIF_KERNEL_TRACE), %g0
 
 	/* System call success, clear Carry condition code. */
 	andn	%g3, %g2, %g3
Index: linux-2.6-lttng/arch/sparc/include/asm/thread_info_64.h
===================================================================
--- linux-2.6-lttng.orig/arch/sparc/include/asm/thread_info_64.h	2009-03-15 15:57:04.000000000 -0400
+++ linux-2.6-lttng/arch/sparc/include/asm/thread_info_64.h	2009-03-15 15:57:18.000000000 -0400
@@ -226,7 +226,7 @@ register struct thread_info *current_thr
 #define TIF_UNALIGNED		5	/* allowed to do unaligned accesses */
 /* flag bit 6 is available */
 #define TIF_32BIT		7	/* 32-bit binary */
-/* flag bit 8 is available */
+#define TIF_KERNEL_TRACE	8	/* kernel trace active */
 #define TIF_SECCOMP		9	/* secure computing */
 #define TIF_SYSCALL_AUDIT	10	/* syscall auditing active */
 /* flag bit 11 is available */
@@ -246,6 +246,7 @@ register struct thread_info *current_thr
 #define _TIF_PERFCTR		(1<<TIF_PERFCTR)
 #define _TIF_UNALIGNED		(1<<TIF_UNALIGNED)
 #define _TIF_32BIT		(1<<TIF_32BIT)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
 #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 17/20] LTTng Kernel Trace Thread Flag UML
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (15 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 16/20] LTTng Kernel Trace Thread Flag sparc Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 18/20] LTTng Linux Kernel Trace Thread Flag x86 Mathieu Desnoyers
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-um.patch --]
[-- Type: text/plain, Size: 1232 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/um/include/asm/thread_info.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6-lttng/arch/um/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/um/include/asm/thread_info.h	2009-03-15 15:51:26.000000000 -0400
+++ linux-2.6-lttng/arch/um/include/asm/thread_info.h	2009-03-15 15:57:18.000000000 -0400
@@ -69,6 +69,7 @@ static inline struct thread_info *curren
 #define TIF_MEMDIE	 	5
 #define TIF_SYSCALL_AUDIT	6
 #define TIF_RESTORE_SIGMASK	7
+#define TIF_KERNEL_TRACE	8	/* kernel trace active */
 #define TIF_FREEZE		16	/* is freezing for suspend */
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
@@ -78,6 +79,7 @@ static inline struct thread_info *curren
 #define _TIF_MEMDIE		(1 << TIF_MEMDIE)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_RESTORE_SIGMASK	(1 << TIF_RESTORE_SIGMASK)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
 #define _TIF_FREEZE		(1 << TIF_FREEZE)
 
 #endif

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 18/20] LTTng Linux Kernel Trace Thread Flag x86
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (16 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 17/20] LTTng Kernel Trace Thread Flag UML Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 19/20] LTTng Kernel Trace Thread Flag xtensa Mathieu Desnoyers
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh

[-- Attachment #1: lttng-kernel-trace-thread-flag-x86.patch --]
[-- Type: text/plain, Size: 4703 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Make x86 support TIF_SYSCALL_TRACE async flag set in entry_32.S/entry_64.S.

x86_64 :

When the flag is inactive upon syscall entry and concurrently activated before
exit, we seem to reach a state where the top of stack is incorrect upon return
to user space.

Fix this by fixing the top of stack and jumping to int_ret_from_sys_call if we
detect that thread flags has been modified.

We make sure that the thread flag read is coherent between our new test and the ALLWORK_MASK test by first saving it in a register used for both comparisons.

Note :
Removed :

        # perform syscall exit tracing
        ALIGN
  syscall_exit_work:
-       testb $_TIF_WORK_SYSCALL_EXIT, %cl
        jz work_pending
        TRACE_IRQS_ON
        ENABLE_INTERRUPTS(CLBR_ANY)     # could let syscall_trace_leave() call
--- 571,578 ----
        # perform syscall exit tracing
        ALIGN
  syscall_exit_work:
+       /* Note, _TIF_KERNEL_TRACE is bit number 9, and so it needs testw and not testb */
+       testw $_TIF_WORK_SYSCALL_EXIT, %cx
        jz work_pending
        TRACE_IRQS_ON
        ENABLE_INTERRUPTS(CLBR_ANY)     # could let syscall_trace_leave() call

because testl now used in mainline since 2.6.30-rc1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Andi Kleen <ak@muc.de>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/thread_info.h |    9 ++++++---
 arch/x86/kernel/entry_64.S         |   12 ++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

Index: linux-2.6-lttng/arch/x86/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/x86/include/asm/thread_info.h	2009-04-11 23:57:41.000000000 -0400
+++ linux-2.6-lttng/arch/x86/include/asm/thread_info.h	2009-04-12 00:07:48.000000000 -0400
@@ -82,6 +82,7 @@ struct thread_info {
 #define TIF_SYSCALL_EMU		6	/* syscall emulation active */
 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
 #define TIF_SECCOMP		8	/* secure computing */
+#define TIF_KERNEL_TRACE	9	/* kernel trace active */
 #define TIF_MCE_NOTIFY		10	/* notify userspace of an MCE */
 #define TIF_NOTSC		16	/* TSC is not accessible in userland */
 #define TIF_IA32		17	/* 32bit process */
@@ -105,6 +106,7 @@ struct thread_info {
 #define _TIF_SYSCALL_EMU	(1 << TIF_SYSCALL_EMU)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
+#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
 #define _TIF_MCE_NOTIFY		(1 << TIF_MCE_NOTIFY)
 #define _TIF_NOTSC		(1 << TIF_NOTSC)
 #define _TIF_IA32		(1 << TIF_IA32)
@@ -121,18 +123,19 @@ struct thread_info {
 /* work to do in syscall_trace_enter() */
 #define _TIF_WORK_SYSCALL_ENTRY	\
 	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_FTRACE |	\
-	 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
+	 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP | \
+	 _TIF_KERNEL_TRACE)
 
 /* work to do in syscall_trace_leave() */
 #define _TIF_WORK_SYSCALL_EXIT	\
 	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP |	\
-	 _TIF_SYSCALL_FTRACE)
+	 _TIF_SYSCALL_FTRACE | _TIF_KERNEL_TRACE)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK							\
 	(0x0000FFFF &							\
 	 ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|			\
-	   _TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU))
+	   _TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU|_TIF_KERNEL_TRACE))
 
 /* work to do on any return to user space */
 #define _TIF_ALLWORK_MASK ((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_FTRACE)
Index: linux-2.6-lttng/arch/x86/kernel/entry_64.S
===================================================================
--- linux-2.6-lttng.orig/arch/x86/kernel/entry_64.S	2009-04-11 23:57:41.000000000 -0400
+++ linux-2.6-lttng/arch/x86/kernel/entry_64.S	2009-04-12 00:05:45.000000000 -0400
@@ -528,6 +528,8 @@ sysret_check:
 	/* Handle reschedules */
 	/* edx:	work, edi: workmask */
 sysret_careful:
+	testl $_TIF_KERNEL_TRACE,%edx	/* Re-read : concurrently changed */
+	jnz ret_from_sys_call_trace
 	bt $TIF_NEED_RESCHED,%edx
 	jnc sysret_signal
 	TRACE_IRQS_ON
@@ -539,6 +541,16 @@ sysret_careful:
 	CFI_ADJUST_CFA_OFFSET -8
 	jmp sysret_check
 
+ret_from_sys_call_trace:
+	TRACE_IRQS_ON
+	sti
+	SAVE_REST
+	FIXUP_TOP_OF_STACK %rdi
+	movq %rsp,%rdi
+	LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed it */
+	RESTORE_REST
+	jmp int_ret_from_sys_call
+
 	/* Handle a signal */
 sysret_signal:
 	TRACE_IRQS_ON

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 19/20] LTTng Kernel Trace Thread Flag xtensa
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (17 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 18/20] LTTng Linux Kernel Trace Thread Flag x86 Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-09 16:22 ` [RFC patch 20/20] LTTng Kernel Trace Thread Flag API Mathieu Desnoyers
  2009-05-10 23:04 ` [RFC patch 00/20] Kernel tracing thread flag Roland McGrath
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-xtensa.patch --]
[-- Type: text/plain, Size: 1685 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/xtensa/include/asm/thread_info.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/xtensa/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/xtensa/include/asm/thread_info.h	2009-03-15 15:51:26.000000000 -0400
+++ linux-2.6-lttng/arch/xtensa/include/asm/thread_info.h	2009-03-15 15:57:21.000000000 -0400
@@ -133,6 +133,7 @@ static inline struct thread_info *curren
 #define TIF_IRET		4	/* return with iret */
 #define TIF_MEMDIE		5
 #define TIF_RESTORE_SIGMASK	6	/* restore signal mask in do_signal() */
+#define TIF_KERNEL_TRACE	7	/* kernel trace active */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_FREEZE		17	/* is freezing for suspend */
 
@@ -141,11 +142,12 @@ static inline struct thread_info *curren
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_SINGLESTEP		(1<<TIF_SINGLESTEP)
 #define _TIF_IRET		(1<<TIF_IRET)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 
-#define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK		0x0000FF7E	/* work to do on interrupt/exception return */
 #define _TIF_ALLWORK_MASK	0x0000FFFF	/* work to do on any return to u-space */
 
 /*

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 20/20] LTTng Kernel Trace Thread Flag API
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (18 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 19/20] LTTng Kernel Trace Thread Flag xtensa Mathieu Desnoyers
@ 2009-05-09 16:22 ` Mathieu Desnoyers
  2009-05-10 23:04 ` [RFC patch 00/20] Kernel tracing thread flag Roland McGrath
  20 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-05-09 16:22 UTC (permalink / raw)
  To: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-api.patch --]
[-- Type: text/plain, Size: 4163 bytes --]

Add an API to set/clear the kernel wide tracing thread flags. Implemented in
kernel/sched.c. Updates thread flags *asynchronously* while holding the tasklist
read lock.

Upon fork, the flag must be re-copied while the tasklist write lock is held.

We are holding the read lock only to make sure we don't delay thread creation
for too long while iterating on all threads.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 include/linux/sched.h |    3 ++
 kernel/fork.c         |    9 ++++++++
 kernel/sched.c        |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

Index: linux-2.6-lttng/include/linux/sched.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/sched.h	2009-04-23 14:56:14.000000000 -0400
+++ linux-2.6-lttng/include/linux/sched.h	2009-04-23 14:56:47.000000000 -0400
@@ -2403,6 +2403,9 @@ static inline void mm_init_owner(struct 
 
 #define TASK_STATE_TO_CHAR_STR "RSDTtZX"
 
+extern void clear_kernel_trace_flag_all_tasks(void);
+extern void set_kernel_trace_flag_all_tasks(void);
+
 #endif /* __KERNEL__ */
 
 #endif
Index: linux-2.6-lttng/kernel/fork.c
===================================================================
--- linux-2.6-lttng.orig/kernel/fork.c	2009-04-23 14:56:14.000000000 -0400
+++ linux-2.6-lttng/kernel/fork.c	2009-04-23 14:56:47.000000000 -0400
@@ -1209,6 +1209,15 @@ static struct task_struct *copy_process(
 			!cpu_online(task_cpu(p))))
 		set_task_cpu(p, smp_processor_id());
 
+	/*
+	 * The state of the parent's TIF_KTRACE flag may have changed
+	 * since it was copied in dup_task_struct() so we re-copy it here.
+	 */
+	if (test_thread_flag(TIF_KERNEL_TRACE))
+		set_tsk_thread_flag(p, TIF_KERNEL_TRACE);
+	else
+		clear_tsk_thread_flag(p, TIF_KERNEL_TRACE);
+
 	/* CLONE_PARENT re-uses the old parent */
 	if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
 		p->real_parent = current->real_parent;
Index: linux-2.6-lttng/kernel/sched.c
===================================================================
--- linux-2.6-lttng.orig/kernel/sched.c	2009-04-23 14:56:14.000000000 -0400
+++ linux-2.6-lttng/kernel/sched.c	2009-04-23 14:56:47.000000000 -0400
@@ -10235,3 +10235,58 @@ struct cgroup_subsys cpuacct_subsys = {
 	.subsys_id = cpuacct_subsys_id,
 };
 #endif	/* CONFIG_CGROUP_CPUACCT */
+
+static DEFINE_MUTEX(kernel_trace_mutex);
+static int kernel_trace_refcount;
+
+/**
+ * clear_kernel_trace_flag_all_tasks - clears all TIF_KERNEL_TRACE thread flags.
+ *
+ * This function iterates on all threads in the system to clear their
+ * TIF_KERNEL_TRACE flag. Setting the TIF_KERNEL_TRACE flag with the
+ * tasklist_lock held in copy_process() makes sure that once we finish clearing
+ * the thread flags, all threads have their flags cleared.
+ */
+void clear_kernel_trace_flag_all_tasks(void)
+{
+	struct task_struct *p;
+	struct task_struct *t;
+
+	mutex_lock(&kernel_trace_mutex);
+	if (--kernel_trace_refcount)
+		goto end;
+	read_lock(&tasklist_lock);
+	do_each_thread(p, t) {
+		clear_tsk_thread_flag(t, TIF_KERNEL_TRACE);
+	} while_each_thread(p, t);
+	read_unlock(&tasklist_lock);
+end:
+	mutex_unlock(&kernel_trace_mutex);
+}
+EXPORT_SYMBOL_GPL(clear_kernel_trace_flag_all_tasks);
+
+/**
+ * set_kernel_trace_flag_all_tasks - sets all TIF_KERNEL_TRACE thread flags.
+ *
+ * This function iterates on all threads in the system to set their
+ * TIF_KERNEL_TRACE flag. Setting the TIF_KERNEL_TRACE flag with the
+ * tasklist_lock held in copy_process() makes sure that once we finish setting
+ * the thread flags, all threads have their flags set.
+ */
+void set_kernel_trace_flag_all_tasks(void)
+{
+	struct task_struct *p;
+	struct task_struct *t;
+
+	mutex_lock(&kernel_trace_mutex);
+	if (kernel_trace_refcount++)
+		goto end;
+	read_lock(&tasklist_lock);
+	do_each_thread(p, t) {
+		set_tsk_thread_flag(t, TIF_KERNEL_TRACE);
+	} while_each_thread(p, t);
+	read_unlock(&tasklist_lock);
+end:
+	mutex_unlock(&kernel_trace_mutex);
+}
+EXPORT_SYMBOL_GPL(set_kernel_trace_flag_all_tasks);

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC patch 15/20] LTTng Kernel Trace Thread Flag SH
  2009-05-09 16:22 ` [RFC patch 15/20] LTTng Kernel Trace Thread Flag SH Mathieu Desnoyers
@ 2009-05-09 17:15   ` Paul Mundt
  0 siblings, 0 replies; 25+ messages in thread
From: Paul Mundt @ 2009-05-09 17:15 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh

On Sat, May 09, 2009 at 12:22:24PM -0400, Mathieu Desnoyers wrote:
> Index: linux-2.6-lttng/arch/sh/include/asm/thread_info.h
> ===================================================================
> --- linux-2.6-lttng.orig/arch/sh/include/asm/thread_info.h	2009-03-15 15:57:04.000000000 -0400
> +++ linux-2.6-lttng/arch/sh/include/asm/thread_info.h	2009-03-15 15:57:17.000000000 -0400
> @@ -116,6 +116,7 @@ extern void free_thread_info(struct thre
>  #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
>  #define TIF_SECCOMP		6	/* secure computing */
>  #define TIF_NOTIFY_RESUME	7	/* callback before returning to user */
> +#define TIF_KERNEL_TRACE	8	/* kernel trace active */
>  #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
>  #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
>  #define TIF_MEMDIE		18
> @@ -129,6 +130,7 @@ extern void free_thread_info(struct thre
>  #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
>  #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
>  #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
> +#define _TIF_KERNEL_TRACE	(1 << TIF_KERNEL_TRACE)
>  #define _TIF_USEDFPU		(1 << TIF_USEDFPU)
>  #define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
>  #define _TIF_FREEZE		(1 << TIF_FREEZE)
> @@ -141,17 +143,19 @@ extern void free_thread_info(struct thre
>  
>  /* work to do in syscall trace */
>  #define _TIF_WORK_SYSCALL_MASK	(_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
> -				 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
> +				 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
> +				 _TIF_KERNEL_TRACE)
>  
>  /* work to do on any return to u-space */
>  #define _TIF_ALLWORK_MASK	(_TIF_SYSCALL_TRACE | _TIF_SIGPENDING      | \
>  				 _TIF_NEED_RESCHED  | _TIF_SYSCALL_AUDIT   | \
>  				 _TIF_SINGLESTEP    | _TIF_RESTORE_SIGMASK | \
> -				 _TIF_NOTIFY_RESUME)
> +				 _TIF_NOTIFY_RESUME | _TIF_KERNEL_TRACE)
>  
>  /* work to do on interrupt/exception return */
>  #define _TIF_WORK_MASK		(_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
> -				 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
> +				 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP | \
> +				 _TIF_KERNEL_TRACE))
>  
>  #endif /* __KERNEL__ */
>  
I think you missed the comment above this hunk in the code..

This will blow up immediately, _TIF_ALLWORK_MASK must presently fit
within a byte, as it just happens to right now. If this can take the
place of _TIF_SYSCALL_TRACE in the future, then that bit position can be
used instead, otherwise the assembly code will have to be rewritten to
load a larger value, which means we lose the ability to load the mask as
an immediate without resorting to shifting and masking :-(

Other platforms have similar constraints, have you verified that this is
not a problem on any of the other platforms?

I'll of course rewrite the assembly if we can't avoid it.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC patch 00/20] Kernel tracing thread flag
  2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
                   ` (19 preceding siblings ...)
  2009-05-09 16:22 ` [RFC patch 20/20] LTTng Kernel Trace Thread Flag API Mathieu Desnoyers
@ 2009-05-10 23:04 ` Roland McGrath
  20 siblings, 0 replies; 25+ messages in thread
From: Roland McGrath @ 2009-05-10 23:04 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, mbligh,
	Oleg Nesterov

I suspect you will hit troubles with some arch's not having a bit to spare.
(Even on x86, it probably hurts several bytes of cache wastage to have to
use longer immediates in some 'test' instructions.)

Another direction to go for this is overloading TIF_SYSCALL_TRACE, so we do
not need any arch changes.  Before the end of the ptrace cleanup work that
Oleg is in the middle of, it should become simple to divorce ptrace's own
bookkeeping from TIF_SYSCALL_TRACE.  At that point, we just need a little
bit of cooperation (in generic non-arch code) to overload that bit for
multiple simultaneous purposes.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390
  2009-05-09 16:22 ` [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390 Mathieu Desnoyers
@ 2009-05-11  8:25   ` Heiko Carstens
  0 siblings, 0 replies; 25+ messages in thread
From: Heiko Carstens @ 2009-05-11  8:25 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: akpm, Ingo Molnar, linux-kernel, Frank Ch. Eigler, Jason Baron,
	Tom Zanussi, fweisbec, laijs, rostedt, peterz, jiayingz, roland,
	mbligh, Mathieu Desnoyers, Martin Schwidefsky

On Sat, 09 May 2009 12:22:23 -0400
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> Add a thread flag to activate system-wide syscall tracing.
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> ---
>  arch/s390/include/asm/thread_info.h |    2 ++
>  arch/s390/kernel/entry.S            |   10 ++++++++--
>  arch/s390/kernel/entry64.S          |   10 ++++++++--
>  3 files changed, 18 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6-lttng/arch/s390/include/asm/thread_info.h
> ===================================================================
> --- linux-2.6-lttng.orig/arch/s390/include/asm/thread_info.h	2009-03-15 15:57:04.000000000 -0400
> +++ linux-2.6-lttng/arch/s390/include/asm/thread_info.h	2009-03-15 15:57:17.000000000 -0400
> @@ -90,6 +90,7 @@ static inline struct thread_info *curren
>  #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
>  #define TIF_SINGLE_STEP		6	/* deliver sigtrap on return to user */
>  #define TIF_MCCK_PENDING	7	/* machine check handling is pending */
> +#define TIF_KERNEL_TRACE	8	/* kernel trace active */
>  #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
>  #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling 
>  					   TIF_NEED_RESCHED */
> @@ -107,6 +108,7 @@ static inline struct thread_info *curren
>  #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
>  #define _TIF_SINGLE_STEP	(1<<TIF_SINGLE_STEP)
>  #define _TIF_MCCK_PENDING	(1<<TIF_MCCK_PENDING)
> +#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
>  #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
>  #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
>  #define _TIF_31BIT		(1<<TIF_31BIT)
> Index: linux-2.6-lttng/arch/s390/kernel/entry.S
> ===================================================================
> --- linux-2.6-lttng.orig/arch/s390/kernel/entry.S	2009-03-15 15:51:10.000000000 -0400
> +++ linux-2.6-lttng/arch/s390/kernel/entry.S	2009-03-15 15:57:17.000000000 -0400
> @@ -265,7 +265,9 @@ sysc_do_restart:
>  	sth	%r7,SP_SVCNR(%r15)
>  	sll	%r7,2		  # svc number *4
>  	l	%r8,BASED(.Lsysc_table)
> -	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
> +	l	%r8,__TI_flags+3(%r9)
> +	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
> +	ltr	%r8,%r8
>  	l	%r8,0(%r7,%r8)	  # get system call addr.
>  	bnz	BASED(sysc_tracesys)

That would be two more instructions (ltr is not needed) and an
additional memory access instead of just one for the fast path just
for debugging purposes.
All this can be avoided if the TIF flags would be rearranged. And
that's exactly what I already did because I needed it for something
else.
Please have a look at linux-next.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390
  2009-03-15 20:01 [RFC patch 00/20] LTTng Kernel Trace Thread Flag v2 Mathieu Desnoyers
@ 2009-03-15 20:01 ` Mathieu Desnoyers
  0 siblings, 0 replies; 25+ messages in thread
From: Mathieu Desnoyers @ 2009-03-15 20:01 UTC (permalink / raw)
  To: Ingo Molnar, akpm, Frederic Weisbecker, Steven Rostedt, LKML
  Cc: Mathieu Desnoyers

[-- Attachment #1: lttng-kernel-trace-thread-flag-s390.patch --]
[-- Type: text/plain, Size: 4306 bytes --]

Add a thread flag to activate system-wide syscall tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 arch/s390/include/asm/thread_info.h |    2 ++
 arch/s390/kernel/entry.S            |   10 ++++++++--
 arch/s390/kernel/entry64.S          |   10 ++++++++--
 3 files changed, 18 insertions(+), 4 deletions(-)

Index: linux-2.6-lttng/arch/s390/include/asm/thread_info.h
===================================================================
--- linux-2.6-lttng.orig/arch/s390/include/asm/thread_info.h	2009-03-15 15:57:04.000000000 -0400
+++ linux-2.6-lttng/arch/s390/include/asm/thread_info.h	2009-03-15 15:57:17.000000000 -0400
@@ -90,6 +90,7 @@ static inline struct thread_info *curren
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
 #define TIF_SINGLE_STEP		6	/* deliver sigtrap on return to user */
 #define TIF_MCCK_PENDING	7	/* machine check handling is pending */
+#define TIF_KERNEL_TRACE	8	/* kernel trace active */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling 
 					   TIF_NEED_RESCHED */
@@ -107,6 +108,7 @@ static inline struct thread_info *curren
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
 #define _TIF_SINGLE_STEP	(1<<TIF_SINGLE_STEP)
 #define _TIF_MCCK_PENDING	(1<<TIF_MCCK_PENDING)
+#define _TIF_KERNEL_TRACE	(1<<TIF_KERNEL_TRACE)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_31BIT		(1<<TIF_31BIT)
Index: linux-2.6-lttng/arch/s390/kernel/entry.S
===================================================================
--- linux-2.6-lttng.orig/arch/s390/kernel/entry.S	2009-03-15 15:51:10.000000000 -0400
+++ linux-2.6-lttng/arch/s390/kernel/entry.S	2009-03-15 15:57:17.000000000 -0400
@@ -265,7 +265,9 @@ sysc_do_restart:
 	sth	%r7,SP_SVCNR(%r15)
 	sll	%r7,2		  # svc number *4
 	l	%r8,BASED(.Lsysc_table)
-	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+3(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	l	%r8,0(%r7,%r8)	  # get system call addr.
 	bnz	BASED(sysc_tracesys)
 	basr	%r14,%r8	  # call sys_xxxx
@@ -405,7 +407,9 @@ sysc_tracego:
 	basr	%r14,%r8		# call sys_xxx
 	st	%r2,SP_R2(%r15)		# store return value
 sysc_tracenogo:
-	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+3(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	bz	BASED(sysc_return)
 	l	%r1,BASED(.Ltrace_exit)
 	la	%r2,SP_PTREGS(%r15)	# load pt_regs
@@ -1049,6 +1053,8 @@ cleanup_io_leave_insn:
 .L0x030:	.short	0x030
 .L0x038:	.short	0x038
 .Lc_1:		.long	1
+.Lc_tif_syscall_trace_or_audit_or_kernel_trace:
+		.long	_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_KERNEL_TRACE
 
 /*
  * Symbol constants
Index: linux-2.6-lttng/arch/s390/kernel/entry64.S
===================================================================
--- linux-2.6-lttng.orig/arch/s390/kernel/entry64.S	2009-03-15 15:51:10.000000000 -0400
+++ linux-2.6-lttng/arch/s390/kernel/entry64.S	2009-03-15 15:57:17.000000000 -0400
@@ -260,7 +260,9 @@ sysc_do_restart:
 	larl	%r10,sys_call_table_emu  # use 31 bit emulation system calls
 sysc_noemu:
 #endif
-	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+7(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	lgf	%r8,0(%r7,%r10) # load address of system call routine
 	jnz	sysc_tracesys
 	basr	%r14,%r8	# call sys_xxxx
@@ -391,7 +393,9 @@ sysc_tracego:
 	basr	%r14,%r8		# call sys_xxx
 	stg	%r2,SP_R2(%r15)		# store return value
 sysc_tracenogo:
-	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
+	l	%r8,__TI_flags+7(%r9)
+	n	%r8,BASED(.Lc_tif_syscall_trace_or_audit_or_kernel_trace)
+	ltr	%r8,%r8
 	jz	sysc_return
 	la	%r2,SP_PTREGS(%r15)	# load pt_regs
 	larl	%r14,sysc_return	# return point is sysc_return
@@ -1033,6 +1037,8 @@ cleanup_io_leave_insn:
 		.align	4
 .Lconst:
 .Lnr_syscalls:	.long	NR_syscalls
+.Lc_tif_syscall_trace_or_audit_or_kernel_trace:
+		.long	_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_KERNEL_TRACE
 .L0x0130:	.short	0x130
 .L0x0140:	.short	0x140
 .L0x0150:	.short	0x150

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-05-11  8:25 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-09 16:22 [RFC patch 00/20] Kernel tracing thread flag Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 01/20] LTTng Kernel Trace Thread Flag Alpha Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 02/20] LTTng Kernel Trace Thread Flag ARM Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 03/20] LTTng Kernel Trace Thread Flag AVR32 Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 04/20] LTTng Kernel Trace Thread Flag Blackfin Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 05/20] LTTng Kernel Trace Thread Flag Cris Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 06/20] LTTng Kernel Trace Thread Flag Frv Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 07/20] LTTng Kernel Trace Thread Flag H8300 Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 08/20] LTTng Kernel Trace Thread Flag ia64 Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 09/20] LTTng Kernel Trace Thread Flag m32r Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 10/20] LTTng Kernel Trace Thread Flag m68k Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 11/20] LTTng Kernel Trace Thread Flag MIPS Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 12/20] LTTng Kernel Trace Thread Flag parisc Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 13/20] LTTng Kernel Trace Thread Flag powerpc Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390 Mathieu Desnoyers
2009-05-11  8:25   ` Heiko Carstens
2009-05-09 16:22 ` [RFC patch 15/20] LTTng Kernel Trace Thread Flag SH Mathieu Desnoyers
2009-05-09 17:15   ` Paul Mundt
2009-05-09 16:22 ` [RFC patch 16/20] LTTng Kernel Trace Thread Flag sparc Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 17/20] LTTng Kernel Trace Thread Flag UML Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 18/20] LTTng Linux Kernel Trace Thread Flag x86 Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 19/20] LTTng Kernel Trace Thread Flag xtensa Mathieu Desnoyers
2009-05-09 16:22 ` [RFC patch 20/20] LTTng Kernel Trace Thread Flag API Mathieu Desnoyers
2009-05-10 23:04 ` [RFC patch 00/20] Kernel tracing thread flag Roland McGrath
  -- strict thread matches above, loose matches on Subject: below --
2009-03-15 20:01 [RFC patch 00/20] LTTng Kernel Trace Thread Flag v2 Mathieu Desnoyers
2009-03-15 20:01 ` [RFC patch 14/20] LTTng Kernel Trace Thread Flag s390 Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.