<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/marker.c, branch v2.6.28</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.28</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.28'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2008-10-14T08:38:45Z</updated>
<entry>
<title>markers: bit-field is not thread-safe nor smp-safe</title>
<updated>2008-10-14T08:38:45Z</updated>
<author>
<name>Lai Jiangshan</name>
<email>laijs@cn.fujitsu.com</email>
</author>
<published>2008-10-10T06:43:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1b7ae37c030a9fbbb5ebbf5d7bbfd7208cf805b7'/>
<id>urn:sha1:1b7ae37c030a9fbbb5ebbf5d7bbfd7208cf805b7</id>
<content type='text'>
bit-field is not thread-safe nor smp-safe.

struct marker_entry.rcu_pending is not protected by any lock
in rcu-callback free_old_closure().
so we must turn it into a safe type.

detail:

I suppose rcu_pending and ptype are store in struct marker_entry.tmp1

free_old_closure() side:           change ptype side:

                                |  load struct marker_entry.tmp1
--------------------------------|--------------------------------
                                |  change ptype bit in tmp1
load struct marker_entry.tmp1   |
change rcu_pending bit in tmp1  |
store tmp1                      |
--------------------------------|--------------------------------
                                |  store tmp1

now this result equals that free_old_closure() do not change rcu_pending
bit, bug! This bug will cause redundant rcu_barrier_sched() called.
not too harmful.

----- corresponding:

free_old_closure() side:           change ptype side:

load struct marker_entry.tmp1   |
--------------------------------|--------------------------------
                                |  load struct marker_entry.tmp1
change rcu_pending bit in tmp1  |
                                |  change ptype bit in tmp1
                                |  store tmp1
--------------------------------|--------------------------------
store tmp1                      |

now this result equals that change ptype side do not change ptype
bit, bug! this bug cause marker_probe_cb() access to invalid memory.
oops!

see also: http://en.wikipedia.org/wiki/Bit_field

Signed-off-by: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Acked-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>markers: fix unchecked format</title>
<updated>2008-10-14T08:38:42Z</updated>
<author>
<name>Lai Jiangshan</name>
<email>laijs@cn.fujitsu.com</email>
</author>
<published>2008-10-08T02:23:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=48043bcdf8f398d28e75ffed6ee85208d751f87f'/>
<id>urn:sha1:48043bcdf8f398d28e75ffed6ee85208d751f87f</id>
<content type='text'>
when the second, third... probe is registered, its format is
not checked, this patch fixes it.

Signed-off-by: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Acked-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>markers: re-enable fast batch registration</title>
<updated>2008-10-14T08:38:38Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@polymtl.ca</email>
</author>
<published>2008-10-01T16:03:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ed86a59071a4ccd0e9bcefc61e013759a21eda78'/>
<id>urn:sha1:ed86a59071a4ccd0e9bcefc61e013759a21eda78</id>
<content type='text'>
Lai Jiangshan discovered a reentrancy issue with markers and fixed it by
adding synchronize_sched() calls at each registration/unregistraiton.

It works, but it removes the ability to do batch
registration/unregistration and can cause registration of ~100 markers
to take about 30 seconds on a loaded machine (synchronize_sched() is
much slower on such workloads).

This patch implements a version of the fix which won't slow down marker batch
registration/unregistration. It also go back to the original non-synchronized
reg/unreg.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>markers: fix unregister bug and reenter bug, cleanup</title>
<updated>2008-10-14T08:38:28Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@polymtl.ca</email>
</author>
<published>2008-09-29T15:08:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e2d3b75dbc486253c910722486ac64087f96c59f'/>
<id>urn:sha1:e2d3b75dbc486253c910722486ac64087f96c59f</id>
<content type='text'>
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 &lt;mathieu.desnoyers@polymtl.ca&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>markers: fix unregister bug and reenter bug</title>
<updated>2008-10-14T08:38:19Z</updated>
<author>
<name>Lai Jiangshan</name>
<email>laijs@cn.fujitsu.com</email>
</author>
<published>2008-09-29T08:00:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d74185ed27651ad8d920b37d7851306ad01f7d6f'/>
<id>urn:sha1:d74185ed27651ad8d920b37d7851306ad01f7d6f</id>
<content type='text'>
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-&gt;oldptr = old; ...", but entry-&gt;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-&gt;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 &lt;laijs@cn.fujitsu.com&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>markers: fix markers read barrier for multiple probes</title>
<updated>2008-07-30T16:41:45Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@polymtl.ca</email>
</author>
<published>2008-07-30T05:33:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5def9a3a22e09c99717f41ab7f07ec9e1a1f3ec8'/>
<id>urn:sha1:5def9a3a22e09c99717f41ab7f07ec9e1a1f3ec8</id>
<content type='text'>
Paul pointed out two incorrect read barriers in the marker handler code in
the path where multiple probes are connected.  Those are ordering reads of
"ptype" (single or multi probe marker), "multi" array pointer, and "multi"
array data access.

It should be ordered like this :

read ptype
smp_rmb()
read multi array pointer
smp_read_barrier_depends()
access data referenced by multi array pointer

The code with a single probe connected (optimized case, does not have to
allocate an array) has correct memory ordering.

It applies to kernel 2.6.26.x, 2.6.25.x and linux-next.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Cc: "Paul E. McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: &lt;stable@kernel.org&gt;		[2.6.25.x, 2.6.26.x]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>markers: use rcu_barrier_sched() and call_rcu_sched()</title>
<updated>2008-07-25T17:53:45Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@polymtl.ca</email>
</author>
<published>2008-07-25T08:48:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=28325df0d9339b7f3aba9c45174d4586223ef46b'/>
<id>urn:sha1:28325df0d9339b7f3aba9c45174d4586223ef46b</id>
<content type='text'>
rcu_barrier_sched() and call_rcu_sched() were introduced in 2.6.26 for the
Markers.  Change the marker code to use them.

It can be seen as a fix since the marker code was using an ugly,
temporary, #ifdef hack to work around CONFIG_PREEMPT_RCU.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Acked-by: Paul McKenney &lt;paulmck@us.ibm.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Markers - remove extra format argument</title>
<updated>2008-05-23T20:25:27Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@polymtl.ca</email>
</author>
<published>2008-05-12T19:21:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dc102a8fae2d0d6bf5223fc549247f2e23959ae6'/>
<id>urn:sha1:dc102a8fae2d0d6bf5223fc549247f2e23959ae6</id>
<content type='text'>
Denys Vlasenko &lt;vda.linux@googlemail.com&gt; :

&gt; Not in this patch, but I noticed:
&gt;
&gt; #define __trace_mark(name, call_private, format, args...)               \
&gt;         do {                                                            \
&gt;                 static const char __mstrtab_##name[]                    \
&gt;                 __attribute__((section("__markers_strings")))           \
&gt;                 = #name "\0" format;                                    \
&gt;                 static struct marker __mark_##name                      \
&gt;                 __attribute__((section("__markers"), aligned(8))) =     \
&gt;                 { __mstrtab_##name, &amp;__mstrtab_##name[sizeof(#name)],   \
&gt;                 0, 0, marker_probe_cb,                                  \
&gt;                 { __mark_empty_function, NULL}, NULL };                 \
&gt;                 __mark_check_format(format, ## args);                   \
&gt;                 if (unlikely(__mark_##name.state)) {                    \
&gt;                         (*__mark_##name.call)                           \
&gt;                                 (&amp;__mark_##name, call_private,          \
&gt;                                 format, ## args);                       \
&gt;                 }                                                       \
&gt;         } while (0)
&gt;
&gt; In this call:
&gt;
&gt;                         (*__mark_##name.call)                           \
&gt;                                 (&amp;__mark_##name, call_private,          \
&gt;                                 format, ## args);                       \
&gt;
&gt; you make gcc allocate duplicate format string. You can use
&gt; &amp;__mstrtab_##name[sizeof(#name)] instead since it holds the same string,
&gt; or drop ", format," above and "const char *fmt" from here:
&gt;
&gt;         void (*call)(const struct marker *mdata,        /* Probe wrapper */
&gt;                 void *call_private, const char *fmt, ...);
&gt;
&gt; since mdata-&gt;format is the same and all callees which need it can take it there.

Very good point. I actually thought about dropping it, since it would
remove an unnecessary argument from the stack. And actually, since I now
have the marker_probe_cb sitting between the marker site and the
callbacks, there is no API change required. Thanks :)

Mathieu

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
CC: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>make marker_debug static</title>
<updated>2008-04-30T15:29:49Z</updated>
<author>
<name>Adrian Bunk</name>
<email>bunk@kernel.org</email>
</author>
<published>2008-04-30T07:54:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ab883af53ec1b87add43b32a28d8347f17d5155b'/>
<id>urn:sha1:ab883af53ec1b87add43b32a28d8347f17d5155b</id>
<content type='text'>
With the needlessly global marker_debug being static gcc can optimize the
unused code away.

Signed-off-by: Adrian Bunk &lt;bunk@kernel.org&gt;
Acked-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kernel: explicitly include required header files under kernel/</title>
<updated>2008-04-29T15:06:04Z</updated>
<author>
<name>Robert P. J. Day</name>
<email>rpjday@crashcourse.ca</email>
</author>
<published>2008-04-29T07:59:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1aeb272cf09f9e2cbc62163b9f37a9b4d1c7e81d'/>
<id>urn:sha1:1aeb272cf09f9e2cbc62163b9f37a9b4d1c7e81d</id>
<content type='text'>
Following an experimental deletion of the unnecessary directive

 #include &lt;linux/slab.h&gt;

from the header file &lt;linux/percpu.h&gt;, these files under kernel/ were exposed
as needing to include one of &lt;linux/slab.h&gt; or &lt;linux/gfp.h&gt;, so explicit
includes were added where necessary.

Signed-off-by: Robert P. J. Day &lt;rpjday@crashcourse.ca&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
