diff options
author | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2013-06-06 13:09:38 +0000 |
---|---|---|
committer | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2013-06-06 13:09:38 +0000 |
commit | 9cd8289020fd6919ba717e9b96c76a8535245ac1 (patch) | |
tree | 667b010b4abe9a3ec3a4be558d375c0836df6658 /sys/netinet/udp_var.h | |
parent | 2424e6ec93c811776df91db1be5a139e5965dba8 (diff) |
Prevent idle thread from being stolen on startup.
There is a race condition which might trigger a case where two cpus try
to run the same idle thread.
The problem arises when one cpu steals the idle proc of another cpu and
this other cpu ends up running the idle thread via spc->spc_idleproc,
resulting in two cpus trying to cpu_switchto(idleX).
On startup, idle procs are scaterred around different runqueues, the
decision for scheduling is:
1 look at my runqueue.
2 if empty, look at other dudes runqueue.
3 if empty, select idle proc via spc->spc_idleproc.
The problem is that cpu0's idle0 might be running on cpu1 due to step 1
or 2 and cpu0 hits step 3.
So cpu0 will select idle0, while cpu1 is in fact running it already.
The solution is to never place idle on a runqueue, therefore being
only selectable through spc->spc_idleproc.
This race can be more easily triggered on a HT cpu on virtualized
environments, where the guest more often than not doesn't have the cpu
for itself, so timing gets shuffled.
ok tedu@ guenther@
go ahead after t2k13 deraadt@
Diffstat (limited to 'sys/netinet/udp_var.h')
0 files changed, 0 insertions, 0 deletions