]> git.baikalelectronics.ru Git - kernel.git/commit
markers: fix unregister bug and reenter bug
authorLai Jiangshan <laijs@cn.fujitsu.com>
Mon, 29 Sep 2008 08:00:05 +0000 (16:00 +0800)
committerIngo Molnar <mingo@elte.hu>
Tue, 14 Oct 2008 08:38:19 +0000 (10:38 +0200)
commit0b77a4dd66ec5de9ca1d44c3927eaec93c82f250
treed3eab74f08808e9596641cd2dcc66f02df060705
parent180fe93cf63e719b6425ac905136f117f19f63db
markers: fix unregister bug and reenter bug

unregister bug:

codes using makers are typically calling marker_probe_unregister()
and then destroying the data that marker_probe_func needs(or
unloading this module). This is bug when the corresponding
marker_probe_func is still running(on other cpus),
it is using the destroying/ed data.

we should call synchronize_sched() after marker_update_probes().

reenter bug:

marker_probe_register(), marker_probe_unregister() and
marker_probe_unregister_private_data() are not reentrant safe
functions. these 3 functions release markers_mutex and then
require it again and do "entry->oldptr = old; ...", but entry->oldptr
maybe is using now for these 3 functions may reenter when markers_mutex
is released.

we use synchronize_sched() instead of call_rcu_sched() to fix
this bug. actually we can do:
"
if (entry->rcu_pending)
rcu_barrier_sched();
"
after require markers_mutex again. but synchronize_sched()
is better and simpler. For these 3 functions are not critical path.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/marker.c