linux_dsm_epyc7002/include/trace/events
Thomas Gleixner f2530dc71c kthread: Prevent unpark race which puts threads on the wrong cpu
The smpboot threads rely on the park/unpark mechanism which binds per
cpu threads on a particular core. Though the functionality is racy:

CPU0	       	 	CPU1  	     	    CPU2
unpark(T)				    wake_up_process(T)
  clear(SHOULD_PARK)	T runs
			leave parkme() due to !SHOULD_PARK  
  bind_to(CPU2)		BUG_ON(wrong CPU)						    

We cannot let the tasks move themself to the target CPU as one of
those tasks is actually the migration thread itself, which requires
that it starts running on the target cpu right away.

The solution to this problem is to prevent wakeups in park mode which
are not from unpark(). That way we can guarantee that the association
of the task to the target cpu is working correctly.

Add a new task state (TASK_PARKED) which prevents other wakeups and
use this state explicitly for the unpark wakeup.

Peter noticed: Also, since the task state is visible to userspace and
all the parked tasks are still in the PID space, its a good hint in ps
and friends that these tasks aren't really there for the moment.

The migration thread has another related issue.

CPU0	      	     	 CPU1
Bring up CPU2
create_thread(T)
park(T)
 wait_for_completion()
			 parkme()
			 complete()
sched_set_stop_task()
			 schedule(TASK_PARKED)

The sched_set_stop_task() call is issued while the task is on the
runqueue of CPU1 and that confuses the hell out of the stop_task class
on that cpu. So we need the same synchronizaion before
sched_set_stop_task().

Reported-by: Dave Jones <davej@redhat.com>
Reported-and-tested-by: Dave Hansen <dave@sr71.net>
Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
Acked-by: Peter Ziljstra <peterz@infradead.org>
Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: dhillf@gmail.com
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1304091635430.21884@ionos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2013-04-12 14:18:43 +02:00
..
9p.h
asoc.h
block.h block: add block_{touch|dirty}_buffer tracepoint 2013-01-14 15:00:36 +01:00
btrfs.h Btrfs: parse parent 0 into correct value in tracepoint 2012-12-16 20:46:18 -05:00
compaction.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
ext3.h
ext4.h ext4: optimize ext4_es_shrink() 2013-02-28 23:58:56 -05:00
gfpflags.h mm: add a __GFP_KMEMCG flag 2012-12-18 15:02:12 -08:00
gpio.h
irq.h
jbd2.h jbd2: add tracepoints which provide per-handle statistics 2013-02-08 13:00:22 -05:00
jbd.h
kmem.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
kvm.h KVM: trace: Fix exit decoding. 2013-01-10 15:51:11 -02:00
lock.h
mce.h
migrate.h mm: migrate: Add a tracepoint for migrate_pages 2012-12-11 14:28:35 +00:00
module.h
napi.h
net.h
oom.h mm, oom: change type of oom_score_adj to short 2012-12-11 17:22:27 -08:00
power.h PM / tracing: remove deprecated power trace API 2013-01-26 00:39:12 +01:00
printk.h
random.h
ras.h aerdrv: Trace Event for PCI Express Advanced Error Reporting 2013-01-03 14:31:44 -08:00
rcu.h Merge branches 'doctorture.2013.01.29a', 'fixes.2013.01.26a', 'tagcb.2013.01.24a' and 'tiny.2013.01.29b' into HEAD 2013-01-28 22:25:21 -08:00
regmap.h
regulator.h
rpm.h
sched.h kthread: Prevent unpark race which puts threads on the wrong cpu 2013-04-12 14:18:43 +02:00
scsi.h
signal.h
skb.h
sock.h
sunrpc.h
syscalls.h
task.h mm, oom: change type of oom_score_adj to short 2012-12-11 17:22:27 -08:00
timer.h
udp.h
vmscan.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
workqueue.h workqueue: rename cpu_workqueue to pool_workqueue 2013-02-13 19:29:12 -08:00
writeback.h writeback: add more tracepoints 2013-01-14 15:00:36 +01:00
xen.h xen/mmu: Use Xen specific TLB flush instead of the generic one. 2012-10-31 12:38:31 -04:00