kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] markers: comment usage of marker_synchronize_unregister()
@ 2008-11-26 12:36 Wu Fengguang
  2008-11-26 12:46 ` Mathieu Desnoyers
  0 siblings, 1 reply; 10+ messages in thread
From: Wu Fengguang @ 2008-11-26 12:36 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Avi Kivity, kvm, Lai Jiangshan, Mathieu Desnoyers,
	Paul E. McKenney, Andrew Morton, Nick Piggin

Add more comments to marker_synchronize_unregister() in order to
reduce the chance of misusing.

Based on comments from Lai Jiangshan <laijs@cn.fujitsu.com>.

Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
---

I'm still not sure about the last sentence. Can anyone clarify on
this? Thanks!

diff --git a/include/linux/marker.h b/include/linux/marker.h
index 889196c..89ce1b8 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -164,6 +164,12 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *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
  * executing a probe when it is freed.
+ *
+ * It must be called _also_ between unregistration and destruction the data
+ * that unregistration-ed probes need to make sure there is no caller executing
+ * a probe when it's data is destroyed.
+ *
+ * It works reliably only when all probe routines do not sleep and reschedule.
  */
 #define marker_synchronize_unregister() synchronize_sched()
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment usage of marker_synchronize_unregister()
  2008-11-26 12:36 [PATCH] markers: comment usage of marker_synchronize_unregister() Wu Fengguang
@ 2008-11-26 12:46 ` Mathieu Desnoyers
  2008-11-26 13:08   ` Wu Fengguang
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Desnoyers @ 2008-11-26 12:46 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: LKML, Ingo Molnar, Avi Kivity, kvm, Lai Jiangshan,
	Paul E. McKenney, Andrew Morton, Nick Piggin

* Wu Fengguang (fengguang.wu@intel.com) wrote:
> Add more comments to marker_synchronize_unregister() in order to
> reduce the chance of misusing.
> 
> Based on comments from Lai Jiangshan <laijs@cn.fujitsu.com>.
> 
> Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> ---
> 
> I'm still not sure about the last sentence. Can anyone clarify on
> this? Thanks!
> 
> diff --git a/include/linux/marker.h b/include/linux/marker.h
> index 889196c..89ce1b8 100644
> --- a/include/linux/marker.h
> +++ b/include/linux/marker.h
> @@ -164,6 +164,12 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *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
>   * executing a probe when it is freed.
> + *
> + * It must be called _also_ between unregistration and destruction the data
> + * that unregistration-ed probes need to make sure there is no caller executing
> + * a probe when it's data is destroyed.

it's -> its

And the way it's written, this last sentence is a bit misleading. One
might think that the synchronize_unregister has to be called two, when
in fact it just has to be called once, but it must be called at a moment
in time between unregister and free of any resource used by the probes,
including the code which is removed by module unload.

> + *
> + * It works reliably only when all probe routines do not sleep and reschedule.

Per definition, preemption is disabled around marker probe execution, so
I don't see why we should add this last sentence ?

Mathieu

>   */
>  #define marker_synchronize_unregister() synchronize_sched()
>  

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment usage of marker_synchronize_unregister()
  2008-11-26 12:46 ` Mathieu Desnoyers
@ 2008-11-26 13:08   ` Wu Fengguang
  2008-11-27  1:05     ` [PATCH] markers: comment marker_synchronize_unregister() on data dependency Wu Fengguang
  0 siblings, 1 reply; 10+ messages in thread
From: Wu Fengguang @ 2008-11-26 13:08 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: LKML, Ingo Molnar, Avi Kivity, kvm@vger.kernel.org, Lai Jiangshan,
	Paul E. McKenney, Andrew Morton, Nick Piggin

On Wed, Nov 26, 2008 at 02:46:08PM +0200, Mathieu Desnoyers wrote:
> * Wu Fengguang (fengguang.wu@intel.com) wrote:
> > Add more comments to marker_synchronize_unregister() in order to
> > reduce the chance of misusing.
> > 
> > Based on comments from Lai Jiangshan <laijs@cn.fujitsu.com>.
> > 
> > Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> > Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> > Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> > ---
> > 
> > I'm still not sure about the last sentence. Can anyone clarify on
> > this? Thanks!
> > 
> > diff --git a/include/linux/marker.h b/include/linux/marker.h
> > index 889196c..89ce1b8 100644
> > --- a/include/linux/marker.h
> > +++ b/include/linux/marker.h
> > @@ -164,6 +164,12 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *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
> >   * executing a probe when it is freed.
> > + *
> > + * It must be called _also_ between unregistration and destruction the data
> > + * that unregistration-ed probes need to make sure there is no caller executing
> > + * a probe when it's data is destroyed.
> 
> it's -> its
> 
> And the way it's written, this last sentence is a bit misleading. One
> might think that the synchronize_unregister has to be called two, when
> in fact it just has to be called once, but it must be called at a moment
> in time between unregister and free of any resource used by the probes,
> including the code which is removed by module unload.
> 
> > + *
> > + * It works reliably only when all probe routines do not sleep and reschedule.
> 
> Per definition, preemption is disabled around marker probe execution, so
> I don't see why we should add this last sentence ?

Thanks, your reminder dismissed my confusion on this last sentence :-)

Updated patch according to your helpful comments.

Thank you,
Fengguang
---
markers: comment usage of marker_synchronize_unregister()

Add more comments to marker_synchronize_unregister() in order to
reduce the chance of misusing.

Based on comments from Lai Jiangshan and Mathieu Desnoyers.

Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
---
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 889196c..32ce4f2 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -162,8 +162,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
- * unregistration and the end of module exit to make sure there is no caller
- * executing a probe when it is freed.
+ * unregistration and the first one of
+ * - the end of module exit
+ * - the free of any resource used by the probes
+ * to ensure the code and data are all valid for any possibly running probes.
  */
 #define marker_synchronize_unregister() synchronize_sched()
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] markers: comment marker_synchronize_unregister() on data dependency
  2008-11-26 13:08   ` Wu Fengguang
@ 2008-11-27  1:05     ` Wu Fengguang
  2008-11-27  1:23       ` Lai Jiangshan
  0 siblings, 1 reply; 10+ messages in thread
From: Wu Fengguang @ 2008-11-27  1:05 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: LKML, Ingo Molnar, Avi Kivity, kvm@vger.kernel.org, Lai Jiangshan,
	Paul E. McKenney, Andrew Morton, Nick Piggin

[updated patch to include Documentation/markers.txt changes]

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.

Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
---
diff --git a/Documentation/markers.txt b/Documentation/markers.txt
index 089f613..8bf6afe 100644
--- a/Documentation/markers.txt
+++ b/Documentation/markers.txt
@@ -51,11 +51,15 @@ 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
 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.
-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
-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.
+
+marker_synchronize_unregister() must be called before the first occurrence of
+- the end of the module exit function,
+  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 destructed 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.
 Markers can be put in inline functions, inlined static functions, and
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 889196c..32ce4f2 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -162,8 +162,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
- * unregistration and the end of module exit to make sure there is no caller
- * executing a probe when it is freed.
+ * unregistration and the first one of
+ * - 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()
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment marker_synchronize_unregister() on data dependency
  2008-11-27  1:05     ` [PATCH] markers: comment marker_synchronize_unregister() on data dependency Wu Fengguang
@ 2008-11-27  1:23       ` Lai Jiangshan
  2008-11-27  1:36         ` Wu Fengguang
  0 siblings, 1 reply; 10+ messages in thread
From: Lai Jiangshan @ 2008-11-27  1:23 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: Mathieu Desnoyers, LKML, Ingo Molnar, Avi Kivity,
	kvm@vger.kernel.org, Paul E. McKenney, Andrew Morton, Nick Piggin

Wu Fengguang wrote:
> [updated patch to include Documentation/markers.txt changes]
> 
> 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.
> 
> Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> ---
> diff --git a/Documentation/markers.txt b/Documentation/markers.txt
> index 089f613..8bf6afe 100644
> --- a/Documentation/markers.txt
> +++ b/Documentation/markers.txt
> @@ -51,11 +51,15 @@ 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
>  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.
> -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
> -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.
> +
> +marker_synchronize_unregister() must be called before the first occurrence of
> +- the end of the module exit function,
> +  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 destructed 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.
>  Markers can be put in inline functions, inlined static functions, and
> diff --git a/include/linux/marker.h b/include/linux/marker.h
> index 889196c..32ce4f2 100644
> --- a/include/linux/marker.h
> +++ b/include/linux/marker.h
> @@ -162,8 +162,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
> - * unregistration and the end of module exit to make sure there is no caller
> - * executing a probe when it is freed.
> + * unregistration and the first one of
> + * - the end of module exit function
> + * - the free of any resource used by the probes

Does "destruction" contain the meaning of "free" and other destruction behavior?

It's every good job, thank you.

Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>

> + * to ensure the code and data are valid for any possibly running probes.
>   */
>  #define marker_synchronize_unregister() synchronize_sched()
>  
> 


> 
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment marker_synchronize_unregister() on data dependency
  2008-11-27  1:23       ` Lai Jiangshan
@ 2008-11-27  1:36         ` Wu Fengguang
  2008-11-27  8:00           ` Mathieu Desnoyers
  0 siblings, 1 reply; 10+ messages in thread
From: Wu Fengguang @ 2008-11-27  1:36 UTC (permalink / raw)
  To: Lai Jiangshan
  Cc: Mathieu Desnoyers, LKML, Ingo Molnar, Avi Kivity,
	kvm@vger.kernel.org, Paul E. McKenney, Andrew Morton, Nick Piggin

On Thu, Nov 27, 2008 at 03:23:06AM +0200, Lai Jiangshan wrote:
> Wu Fengguang wrote:
> > [updated patch to include Documentation/markers.txt changes]
> > 
> > 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.
> > 
> > Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> > Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> > Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> > ---
> > diff --git a/Documentation/markers.txt b/Documentation/markers.txt
> > index 089f613..8bf6afe 100644
> > --- a/Documentation/markers.txt
> > +++ b/Documentation/markers.txt
> > @@ -51,11 +51,15 @@ 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
> >  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.
> > -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
> > -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.
> > +
> > +marker_synchronize_unregister() must be called before the first occurrence of
> > +- the end of the module exit function,
> > +  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 destructed 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.
> >  Markers can be put in inline functions, inlined static functions, and
> > diff --git a/include/linux/marker.h b/include/linux/marker.h
> > index 889196c..32ce4f2 100644
> > --- a/include/linux/marker.h
> > +++ b/include/linux/marker.h
> > @@ -162,8 +162,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
> > - * unregistration and the end of module exit to make sure there is no caller
> > - * executing a probe when it is freed.
> > + * unregistration and the first one of
> > + * - the end of module exit function
> > + * - the free of any resource used by the probes
> 
> Does "destruction" contain the meaning of "free" and other destruction behavior?

Ahh, better to use "invalid data" instead of "destructed data"?

> It's every good job, thank you.
> 
> Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>

Thank you,
Fengguang
---
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.

Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
---
diff --git a/Documentation/markers.txt b/Documentation/markers.txt
index 089f613..8bf6afe 100644
--- a/Documentation/markers.txt
+++ b/Documentation/markers.txt
@@ -51,11 +51,15 @@ 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
 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.
-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
-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.
+
+marker_synchronize_unregister() must be called before the first occurrence of
+- the end of the module exit function,
+  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.
 Markers can be put in inline functions, inlined static functions, and
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 889196c..32ce4f2 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -162,8 +162,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
- * unregistration and the end of module exit to make sure there is no caller
- * executing a probe when it is freed.
+ * unregistration and the first one of
+ * - 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()
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment marker_synchronize_unregister() on data dependency
  2008-11-27  1:36         ` Wu Fengguang
@ 2008-11-27  8:00           ` Mathieu Desnoyers
  2008-11-27  8:14             ` Wu Fengguang
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Desnoyers @ 2008-11-27  8:00 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: Lai Jiangshan, LKML, Ingo Molnar, Avi Kivity, kvm@vger.kernel.org,
	Paul E. McKenney, Andrew Morton, Nick Piggin

* Wu Fengguang (fengguang.wu@intel.com) wrote:
> On Thu, Nov 27, 2008 at 03:23:06AM +0200, Lai Jiangshan wrote:
> > Wu Fengguang wrote:
> > > [updated patch to include Documentation/markers.txt changes]
> > > 
> > > 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.
> > > 
> > > Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> > > Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> > > ---
> > > diff --git a/Documentation/markers.txt b/Documentation/markers.txt
> > > index 089f613..8bf6afe 100644
> > > --- a/Documentation/markers.txt
> > > +++ b/Documentation/markers.txt
> > > @@ -51,11 +51,15 @@ 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
> > >  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.
> > > -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
> > > -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.
> > > +
> > > +marker_synchronize_unregister() must be called before the first occurrence of
> > > +- the end of the module exit function,
> > > +  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 destructed 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.
> > >  Markers can be put in inline functions, inlined static functions, and
> > > diff --git a/include/linux/marker.h b/include/linux/marker.h
> > > index 889196c..32ce4f2 100644
> > > --- a/include/linux/marker.h
> > > +++ b/include/linux/marker.h
> > > @@ -162,8 +162,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
> > > - * unregistration and the end of module exit to make sure there is no caller
> > > - * executing a probe when it is freed.
> > > + * unregistration and the first one of
> > > + * - the end of module exit function
> > > + * - the free of any resource used by the probes
> > 
> > Does "destruction" contain the meaning of "free" and other destruction behavior?
> 
> Ahh, better to use "invalid data" instead of "destructed data"?
> 
> > It's every good job, thank you.
> > 
> > Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> 
> Thank you,
> Fengguang
> ---
> 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.
> 
> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> ---
> diff --git a/Documentation/markers.txt b/Documentation/markers.txt
> index 089f613..8bf6afe 100644
> --- a/Documentation/markers.txt
> +++ b/Documentation/markers.txt
> @@ -51,11 +51,15 @@ 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
>  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.
> -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
> -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.
> +
> +marker_synchronize_unregister() must be called before the first occurrence of


You should probably say 

".. must be called between probe unregistration and the first occurence
of..."

Mathieu

> +- the end of the module exit function,
> +  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.
>  Markers can be put in inline functions, inlined static functions, and
> diff --git a/include/linux/marker.h b/include/linux/marker.h
> index 889196c..32ce4f2 100644
> --- a/include/linux/marker.h
> +++ b/include/linux/marker.h
> @@ -162,8 +162,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
> - * unregistration and the end of module exit to make sure there is no caller
> - * executing a probe when it is freed.
> + * unregistration and the first one of
> + * - 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()
>  

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment marker_synchronize_unregister() on data dependency
  2008-11-27  8:00           ` Mathieu Desnoyers
@ 2008-11-27  8:14             ` Wu Fengguang
  2008-11-27 18:44               ` Mathieu Desnoyers
  0 siblings, 1 reply; 10+ messages in thread
From: Wu Fengguang @ 2008-11-27  8:14 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Lai Jiangshan, LKML, Ingo Molnar, Avi Kivity, kvm@vger.kernel.org,
	Paul E. McKenney, Andrew Morton, Nick Piggin

On Thu, Nov 27, 2008 at 10:00:03AM +0200, Mathieu Desnoyers wrote:
> * Wu Fengguang (fengguang.wu@intel.com) wrote:
> > +
> > +marker_synchronize_unregister() must be called before the first occurrence of
> 
> 
> You should probably say 
> 
> ".. must be called between probe unregistration and the first occurence
> of..."
> 
> Mathieu

That's much better!

With your comments I'd assume you reviewed this patch ;-)

Thanks,
Fengguang
---
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.

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
---
diff --git a/Documentation/markers.txt b/Documentation/markers.txt
index 089f613..d9569a3 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
 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
 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
-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.
+
+marker_synchronize_unregister() must be called between probe unregistration and
+the first occurrence of
+- the end of module exit function,
+  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.
 Markers can be put in inline functions, inlined static functions, and
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 889196c..5f12d1b 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -162,8 +162,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
- * unregistration and the end of module exit to make sure there is no caller
- * executing a probe when it is freed.
+ * unregistration and the first one of
+ * - 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()
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment marker_synchronize_unregister() on data dependency
  2008-11-27  8:14             ` Wu Fengguang
@ 2008-11-27 18:44               ` Mathieu Desnoyers
  2008-11-28 15:47                 ` Ingo Molnar
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Desnoyers @ 2008-11-27 18:44 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: Lai Jiangshan, LKML, Ingo Molnar, Avi Kivity, kvm@vger.kernel.org,
	Paul E. McKenney, Andrew Morton, Nick Piggin

* Wu Fengguang (fengguang.wu@intel.com) wrote:
> On Thu, Nov 27, 2008 at 10:00:03AM +0200, Mathieu Desnoyers wrote:
> > * Wu Fengguang (fengguang.wu@intel.com) wrote:
> > > +
> > > +marker_synchronize_unregister() must be called before the first occurrence of
> > 
> > 
> > You should probably say 
> > 
> > ".. must be called between probe unregistration and the first occurence
> > of..."
> > 
> > Mathieu
> 
> That's much better!
> 
> With your comments I'd assume you reviewed this patch ;-)
> 
> Thanks,
> Fengguang
> ---
> 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.
> 
> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> Signed-off-by: Wu Fengguang <wfg@linux.intel.com>

It looks good to me, thanks!

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>


> ---
> diff --git a/Documentation/markers.txt b/Documentation/markers.txt
> index 089f613..d9569a3 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
>  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
>  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
> -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.
> +
> +marker_synchronize_unregister() must be called between probe unregistration and
> +the first occurrence of
> +- the end of module exit function,
> +  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.
>  Markers can be put in inline functions, inlined static functions, and
> diff --git a/include/linux/marker.h b/include/linux/marker.h
> index 889196c..5f12d1b 100644
> --- a/include/linux/marker.h
> +++ b/include/linux/marker.h
> @@ -162,8 +162,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
> - * unregistration and the end of module exit to make sure there is no caller
> - * executing a probe when it is freed.
> + * unregistration and the first one of
> + * - 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()
>  

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] markers: comment marker_synchronize_unregister() on data dependency
  2008-11-27 18:44               ` Mathieu Desnoyers
@ 2008-11-28 15:47                 ` Ingo Molnar
  0 siblings, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2008-11-28 15:47 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Wu Fengguang, Lai Jiangshan, LKML, Avi Kivity,
	kvm@vger.kernel.org, Paul E. McKenney, Andrew Morton, Nick Piggin


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> * Wu Fengguang (fengguang.wu@intel.com) wrote:
> > On Thu, Nov 27, 2008 at 10:00:03AM +0200, Mathieu Desnoyers wrote:
> > > * Wu Fengguang (fengguang.wu@intel.com) wrote:
> > > > +
> > > > +marker_synchronize_unregister() must be called before the first occurrence of
> > > 
> > > 
> > > You should probably say 
> > > 
> > > ".. must be called between probe unregistration and the first occurence
> > > of..."
> > > 
> > > Mathieu
> > 
> > That's much better!
> > 
> > With your comments I'd assume you reviewed this patch ;-)
> > 
> > Thanks,
> > Fengguang
> > ---
> > 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.
> > 
> > Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> > Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> 
> It looks good to me, thanks!
> 
> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

applied to tip/tracing/markers, thanks guys!

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-11-28 15:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-26 12:36 [PATCH] markers: comment usage of marker_synchronize_unregister() Wu Fengguang
2008-11-26 12:46 ` Mathieu Desnoyers
2008-11-26 13:08   ` Wu Fengguang
2008-11-27  1:05     ` [PATCH] markers: comment marker_synchronize_unregister() on data dependency Wu Fengguang
2008-11-27  1:23       ` Lai Jiangshan
2008-11-27  1:36         ` Wu Fengguang
2008-11-27  8:00           ` Mathieu Desnoyers
2008-11-27  8:14             ` Wu Fengguang
2008-11-27 18:44               ` Mathieu Desnoyers
2008-11-28 15:47                 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).