markers: fix unregister bug and reenter bug, cleanup
Use the new rcu_read_lock_sched/unlock_sched() in marker code around the call site instead of preempt_disable/enable(). It helps reviewing the code more easily. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
e98d0eabef
commit
e2d3b75dbc
@@ -100,11 +100,11 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)
|
|||||||
char ptype;
|
char ptype;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* preempt_disable does two things : disabling preemption to make sure
|
* rcu_read_lock_sched does two things : disabling preemption to make
|
||||||
* the teardown of the callbacks can be done correctly when they are in
|
* sure the teardown of the callbacks can be done correctly when they
|
||||||
* modules and they insure RCU read coherency.
|
* are in modules and they insure RCU read coherency.
|
||||||
*/
|
*/
|
||||||
preempt_disable();
|
rcu_read_lock_sched();
|
||||||
ptype = mdata->ptype;
|
ptype = mdata->ptype;
|
||||||
if (likely(!ptype)) {
|
if (likely(!ptype)) {
|
||||||
marker_probe_func *func;
|
marker_probe_func *func;
|
||||||
@@ -142,7 +142,7 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
preempt_enable();
|
rcu_read_unlock_sched();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(marker_probe_cb);
|
EXPORT_SYMBOL_GPL(marker_probe_cb);
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...)
|
|||||||
va_list args; /* not initialized */
|
va_list args; /* not initialized */
|
||||||
char ptype;
|
char ptype;
|
||||||
|
|
||||||
preempt_disable();
|
rcu_read_lock_sched();
|
||||||
ptype = mdata->ptype;
|
ptype = mdata->ptype;
|
||||||
if (likely(!ptype)) {
|
if (likely(!ptype)) {
|
||||||
marker_probe_func *func;
|
marker_probe_func *func;
|
||||||
@@ -192,7 +192,7 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...)
|
|||||||
multi[i].func(multi[i].probe_private, call_private,
|
multi[i].func(multi[i].probe_private, call_private,
|
||||||
mdata->format, &args);
|
mdata->format, &args);
|
||||||
}
|
}
|
||||||
preempt_enable();
|
rcu_read_unlock_sched();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(marker_probe_cb_noarg);
|
EXPORT_SYMBOL_GPL(marker_probe_cb_noarg);
|
||||||
|
|
||||||
@@ -539,7 +539,7 @@ static int set_marker(struct marker_entry **entry, struct marker *elem,
|
|||||||
* Disable a marker and its probe callback.
|
* Disable a marker and its probe callback.
|
||||||
* Note: only waiting an RCU period after setting elem->call to the empty
|
* Note: only waiting an RCU period after setting elem->call to the empty
|
||||||
* function insures that the original callback is not used anymore. This insured
|
* function insures that the original callback is not used anymore. This insured
|
||||||
* by preempt_disable around the call site.
|
* by rcu_read_lock_sched around the call site.
|
||||||
*/
|
*/
|
||||||
static void disable_marker(struct marker *elem)
|
static void disable_marker(struct marker *elem)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user