Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a838c2ec authored by Wu Fengguang's avatar Wu Fengguang Committed by Ingo Molnar
Browse files

markers: comment marker_synchronize_unregister() on data dependency



Add document and comments on marker_synchronize_unregister(): it
should be called before freeing resources that the probes depend on.

Based on comments from Lai Jiangshan and Mathieu Desnoyers.

Signed-off-by: default avatarWu Fengguang <wfg@linux.intel.com>
Reviewed-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Reviewed-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent c7cc7730
Loading
Loading
Loading
Loading
+10 −5
Original line number Original line Diff line number Diff line
@@ -51,11 +51,16 @@ to call) for the specific marker through marker_probe_register() and can be
activated by calling marker_arm(). Marker deactivation can be done by calling
activated by calling marker_arm(). Marker deactivation can be done by calling
marker_disarm() as many times as marker_arm() has been called. Removing a probe
marker_disarm() as many times as marker_arm() has been called. Removing a probe
is done through marker_probe_unregister(); it will disarm the probe.
is done through marker_probe_unregister(); it will disarm the probe.
marker_synchronize_unregister() must be called before the end of the module exit

function to make sure there is no caller left using the probe. This, and the
marker_synchronize_unregister() must be called between probe unregistration and
fact that preemption is disabled around the probe call, make sure that probe
the first occurrence of
removal and module unload are safe. See the "Probe example" section below for a
- the end of module exit function,
sample probe module.
  to make sure there is no caller left using the probe;
- the free of any resource used by the probes,
  to make sure the probes wont be accessing invalid data.
This, and the fact that preemption is disabled around the probe call, make sure
that probe removal and module unload are safe. See the "Probe example" section
below for a sample probe module.


The marker mechanism supports inserting multiple instances of the same marker.
The marker mechanism supports inserting multiple instances of the same marker.
Markers can be put in inline functions, inlined static functions, and
Markers can be put in inline functions, inlined static functions, and
+4 −2
Original line number Original line Diff line number Diff line
@@ -211,8 +211,10 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *probe,


/*
/*
 * marker_synchronize_unregister must be called between the last marker probe
 * marker_synchronize_unregister must be called between the last marker probe
 * unregistration and the end of module exit to make sure there is no caller
 * unregistration and the first one of
 * executing a probe when it is freed.
 * - the end of module exit function
 * - the free of any resource used by the probes
 * to ensure the code and data are valid for any possibly running probes.
 */
 */
#define marker_synchronize_unregister() synchronize_sched()
#define marker_synchronize_unregister() synchronize_sched()