All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 0/2] TIF_SYSCALL_TRACEPOINT fixes
@ 2013-03-17 18:28 Oleg Nesterov
  2013-03-17 18:28 ` [PATCH 1/2] tracing: syscall_*regfunc() can race with copy_process() Oleg Nesterov
  2013-03-17 18:28 ` [PATCH 2/2] tracing: syscall_regfunc() should not skip kernel threads Oleg Nesterov
  0 siblings, 2 replies; 17+ messages in thread
From: Oleg Nesterov @ 2013-03-17 18:28 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Frederic Weisbecker, Steven Rostedt, linux-kernel

Hello.

IIRC Steven agrees with this changes, but nobody picked them.
Resend, perhaps Andrew can help...

Oleg.


^ permalink raw reply	[flat|nested] 17+ messages in thread
* syscall_regfunc() && TIF_SYSCALL_TRACEPOINT
@ 2012-03-30 18:31 Oleg Nesterov
  2012-03-30 19:02 ` Steven Rostedt
  0 siblings, 1 reply; 17+ messages in thread
From: Oleg Nesterov @ 2012-03-30 18:31 UTC (permalink / raw)
  To: Ingo Molnar, Jason Baron, Steven Rostedt; +Cc: linux-kernel

Hello.

I've looked at syscall_regfunc/unregfunc by accident, and I am
a bit confused...

	void syscall_regfunc(void)
	{
		unsigned long flags;
		struct task_struct *g, *t;

		if (!sys_tracepoint_refcount) {
			read_lock_irqsave(&tasklist_lock, flags);

Why _irqsave? write_lock(tasklist) needs to disable irqs, but read_
doesn't. Any subtle reason I missed?

			do_each_thread(g, t) {
				/* Skip kernel threads. */
				if (t->mm)

We should check PF_KTHREAD, not ->mm.

					set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);

But the main question is, can't we race with clone() and miss the
new child? The new task is not "visible" to do_each_thread() until
copy_process()->list_add_tail_rcu(thread_group/init_task.tasks).

Don't we need something like the patch below?

Oleg.


--- x/kernel/fork.c
+++ x/kernel/fork.c
@@ -1446,7 +1446,12 @@ static struct task_struct *copy_process(
 
 	total_forks++;
 	spin_unlock(&current->sighand->siglock);
+#ifdef CONFIG_TRACEPOINTS
+	if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
+		set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
+#endif
 	write_unlock_irq(&tasklist_lock);
+
 	proc_fork_connector(p);
 	cgroup_post_fork(p);
 	if (clone_flags & CLONE_THREAD)


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

end of thread, other threads:[~2013-03-20 19:16 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-17 18:28 [PATCH RESEND 0/2] TIF_SYSCALL_TRACEPOINT fixes Oleg Nesterov
2013-03-17 18:28 ` [PATCH 1/2] tracing: syscall_*regfunc() can race with copy_process() Oleg Nesterov
2013-03-17 18:48   ` Steven Rostedt
2013-03-17 19:00     ` Oleg Nesterov
2013-03-17 19:34       ` Steven Rostedt
2013-03-18 16:33         ` Oleg Nesterov
2013-03-18 16:34   ` [PATCH v2 " Oleg Nesterov
2013-03-20 19:16     ` Steven Rostedt
2013-03-17 18:28 ` [PATCH 2/2] tracing: syscall_regfunc() should not skip kernel threads Oleg Nesterov
2013-03-17 18:54   ` Steven Rostedt
2013-03-17 19:04     ` Oleg Nesterov
2013-03-17 19:36       ` Steven Rostedt
2013-03-18 16:26         ` Oleg Nesterov
2013-03-19 15:10         ` David Howells
2013-03-19 15:36           ` Steven Rostedt
2013-03-19 21:27             ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2012-03-30 18:31 syscall_regfunc() && TIF_SYSCALL_TRACEPOINT Oleg Nesterov
2012-03-30 19:02 ` Steven Rostedt
2012-03-30 20:15   ` Oleg Nesterov
2012-03-31  0:13     ` Steven Rostedt
2012-03-31 20:45       ` Oleg Nesterov
2012-03-31 21:37         ` Steven Rostedt
2012-04-01 21:37           ` [PATCH 0/2] (Was: syscall_regfunc() && TIF_SYSCALL_TRACEPOINT) Oleg Nesterov
2012-04-01 21:38             ` [PATCH 2/2] tracing: syscall_regfunc() should not skip kernel threads Oleg Nesterov

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.