diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2008-11-27 03:14:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-28 10:47:41 -0500 |
commit | a838c2ec6ea1f18431da74dfe4978c57355b95f3 (patch) | |
tree | c51852ff62ec383c27e21f318f5e3180f141b885 | |
parent | c7cc77307669336a08928ab8668bdb3f3bcc021b (diff) |
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: Wu Fengguang <wfg@linux.intel.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | Documentation/markers.txt | 15 | ||||
-rw-r--r-- | include/linux/marker.h | 6 |
2 files changed, 14 insertions, 7 deletions
diff --git a/Documentation/markers.txt b/Documentation/markers.txt index 6d275e4ef385..d2b3d0e91b26 100644 --- a/Documentation/markers.txt +++ b/Documentation/markers.txt | |||
@@ -51,11 +51,16 @@ to call) for the specific marker through marker_probe_register() and can be | |||
51 | activated by calling marker_arm(). Marker deactivation can be done by calling | 51 | activated by calling marker_arm(). Marker deactivation can be done by calling |
52 | marker_disarm() as many times as marker_arm() has been called. Removing a probe | 52 | marker_disarm() as many times as marker_arm() has been called. Removing a probe |
53 | is done through marker_probe_unregister(); it will disarm the probe. | 53 | is done through marker_probe_unregister(); it will disarm the probe. |
54 | marker_synchronize_unregister() must be called before the end of the module exit | 54 | |
55 | function to make sure there is no caller left using the probe. This, and the | 55 | marker_synchronize_unregister() must be called between probe unregistration and |
56 | fact that preemption is disabled around the probe call, make sure that probe | 56 | the first occurrence of |
57 | removal and module unload are safe. See the "Probe example" section below for a | 57 | - the end of module exit function, |
58 | sample probe module. | 58 | to make sure there is no caller left using the probe; |
59 | - the free of any resource used by the probes, | ||
60 | to make sure the probes wont be accessing invalid data. | ||
61 | This, and the fact that preemption is disabled around the probe call, make sure | ||
62 | that probe removal and module unload are safe. See the "Probe example" section | ||
63 | below for a sample probe module. | ||
59 | 64 | ||
60 | The marker mechanism supports inserting multiple instances of the same marker. | 65 | The marker mechanism supports inserting multiple instances of the same marker. |
61 | Markers can be put in inline functions, inlined static functions, and | 66 | Markers can be put in inline functions, inlined static functions, and |
diff --git a/include/linux/marker.h b/include/linux/marker.h index 34c14bc957f5..b85e74ca782f 100644 --- a/include/linux/marker.h +++ b/include/linux/marker.h | |||
@@ -211,8 +211,10 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *probe, | |||
211 | 211 | ||
212 | /* | 212 | /* |
213 | * marker_synchronize_unregister must be called between the last marker probe | 213 | * marker_synchronize_unregister must be called between the last marker probe |
214 | * unregistration and the end of module exit to make sure there is no caller | 214 | * unregistration and the first one of |
215 | * executing a probe when it is freed. | 215 | * - the end of module exit function |
216 | * - the free of any resource used by the probes | ||
217 | * to ensure the code and data are valid for any possibly running probes. | ||
216 | */ | 218 | */ |
217 | #define marker_synchronize_unregister() synchronize_sched() | 219 | #define marker_synchronize_unregister() synchronize_sched() |
218 | 220 | ||