<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/net/tipc/ref.c, branch v2.6.36</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>tipc: fix lockdep warning on address assignment</title>
<updated>2010-03-16T21:15:45+00:00</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2010-03-16T08:14:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a2f46ee1ba5ee249ce2ca1ee7a7a0ac46529fb4f'/>
<id>a2f46ee1ba5ee249ce2ca1ee7a7a0ac46529fb4f</id>
<content type='text'>
So in the forward porting of various tipc packages, I was constantly
getting this lockdep warning everytime I used tipc-config to set a network
address for the protocol:

[ INFO: possible circular locking dependency detected ]
2.6.33 #1
tipc-config/1326 is trying to acquire lock:
(ref_table_lock){+.-...}, at: [&lt;ffffffffa0315148&gt;] tipc_ref_discard+0x53/0xd4 [tipc]

but task is already holding lock:
(&amp;(&amp;entry-&gt;lock)-&gt;rlock#2){+.-...}, at: [&lt;ffffffffa03150d5&gt;] tipc_ref_lock+0x43/0x63 [tipc]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 (&amp;(&amp;entry-&gt;lock)-&gt;rlock#2){+.-...}:
[&lt;ffffffff8107b508&gt;] __lock_acquire+0xb67/0xd0f
[&lt;ffffffff8107b78c&gt;] lock_acquire+0xdc/0x102
[&lt;ffffffff8145471e&gt;] _raw_spin_lock_bh+0x3b/0x6e
[&lt;ffffffffa03152b1&gt;] tipc_ref_acquire+0xe8/0x11b [tipc]
[&lt;ffffffffa031433f&gt;] tipc_createport_raw+0x78/0x1b9 [tipc]
[&lt;ffffffffa031450b&gt;] tipc_createport+0x8b/0x125 [tipc]
[&lt;ffffffffa030f221&gt;] tipc_subscr_start+0xce/0x126 [tipc]
[&lt;ffffffffa0308fb2&gt;] process_signal_queue+0x47/0x7d [tipc]
[&lt;ffffffff81053e0c&gt;] tasklet_action+0x8c/0xf4
[&lt;ffffffff81054bd8&gt;] __do_softirq+0xf8/0x1cd
[&lt;ffffffff8100aadc&gt;] call_softirq+0x1c/0x30
[&lt;ffffffff810549f4&gt;] _local_bh_enable_ip+0xb8/0xd7
[&lt;ffffffff81054a21&gt;] local_bh_enable_ip+0xe/0x10
[&lt;ffffffff81454d31&gt;] _raw_spin_unlock_bh+0x34/0x39
[&lt;ffffffffa0308eb8&gt;] spin_unlock_bh.clone.0+0x15/0x17 [tipc]
[&lt;ffffffffa0308f47&gt;] tipc_k_signal+0x8d/0xb1 [tipc]
[&lt;ffffffffa0308dd9&gt;] tipc_core_start+0x8a/0xad [tipc]
[&lt;ffffffffa01b1087&gt;] 0xffffffffa01b1087
[&lt;ffffffff8100207d&gt;] do_one_initcall+0x72/0x18a
[&lt;ffffffff810872fb&gt;] sys_init_module+0xd8/0x23a
[&lt;ffffffff81009b42&gt;] system_call_fastpath+0x16/0x1b

-&gt; #0 (ref_table_lock){+.-...}:
[&lt;ffffffff8107b3b2&gt;] __lock_acquire+0xa11/0xd0f
[&lt;ffffffff8107b78c&gt;] lock_acquire+0xdc/0x102
[&lt;ffffffff81454836&gt;] _raw_write_lock_bh+0x3b/0x6e
[&lt;ffffffffa0315148&gt;] tipc_ref_discard+0x53/0xd4 [tipc]
[&lt;ffffffffa03141ee&gt;] tipc_deleteport+0x40/0x119 [tipc]
[&lt;ffffffffa0316e35&gt;] release+0xeb/0x137 [tipc]
[&lt;ffffffff8139dbf4&gt;] sock_release+0x1f/0x6f
[&lt;ffffffff8139dc6b&gt;] sock_close+0x27/0x2b
[&lt;ffffffff811116f6&gt;] __fput+0x12a/0x1df
[&lt;ffffffff811117c5&gt;] fput+0x1a/0x1c
[&lt;ffffffff8110e49b&gt;] filp_close+0x68/0x72
[&lt;ffffffff8110e552&gt;] sys_close+0xad/0xe7
[&lt;ffffffff81009b42&gt;] system_call_fastpath+0x16/0x1b

Finally decided I should fix this.  Its a straightforward inversion,
tipc_ref_acquire takes two locks in this order:
ref_table_lock
entry-&gt;lock

while tipc_deleteport takes them in this order:
entry-&gt;lock (via tipc_port_lock())
ref_table_lock (via tipc_ref_discard())

when the same entry is referenced, we get the above warning.  The fix is equally
straightforward.  Theres no real relation between the entry-&gt;lock and the
ref_table_lock (they just are needed at the same time), so move the entry-&gt;lock
aquisition in tipc_ref_acquire down, after we unlock ref_table_lock (this is
safe since the ref_table_lock guards changes to the reference table, and we've
already claimed a slot there.  I've tested the below fix and confirmed that it
clears up the lockdep issue

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
CC: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
So in the forward porting of various tipc packages, I was constantly
getting this lockdep warning everytime I used tipc-config to set a network
address for the protocol:

[ INFO: possible circular locking dependency detected ]
2.6.33 #1
tipc-config/1326 is trying to acquire lock:
(ref_table_lock){+.-...}, at: [&lt;ffffffffa0315148&gt;] tipc_ref_discard+0x53/0xd4 [tipc]

but task is already holding lock:
(&amp;(&amp;entry-&gt;lock)-&gt;rlock#2){+.-...}, at: [&lt;ffffffffa03150d5&gt;] tipc_ref_lock+0x43/0x63 [tipc]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 (&amp;(&amp;entry-&gt;lock)-&gt;rlock#2){+.-...}:
[&lt;ffffffff8107b508&gt;] __lock_acquire+0xb67/0xd0f
[&lt;ffffffff8107b78c&gt;] lock_acquire+0xdc/0x102
[&lt;ffffffff8145471e&gt;] _raw_spin_lock_bh+0x3b/0x6e
[&lt;ffffffffa03152b1&gt;] tipc_ref_acquire+0xe8/0x11b [tipc]
[&lt;ffffffffa031433f&gt;] tipc_createport_raw+0x78/0x1b9 [tipc]
[&lt;ffffffffa031450b&gt;] tipc_createport+0x8b/0x125 [tipc]
[&lt;ffffffffa030f221&gt;] tipc_subscr_start+0xce/0x126 [tipc]
[&lt;ffffffffa0308fb2&gt;] process_signal_queue+0x47/0x7d [tipc]
[&lt;ffffffff81053e0c&gt;] tasklet_action+0x8c/0xf4
[&lt;ffffffff81054bd8&gt;] __do_softirq+0xf8/0x1cd
[&lt;ffffffff8100aadc&gt;] call_softirq+0x1c/0x30
[&lt;ffffffff810549f4&gt;] _local_bh_enable_ip+0xb8/0xd7
[&lt;ffffffff81054a21&gt;] local_bh_enable_ip+0xe/0x10
[&lt;ffffffff81454d31&gt;] _raw_spin_unlock_bh+0x34/0x39
[&lt;ffffffffa0308eb8&gt;] spin_unlock_bh.clone.0+0x15/0x17 [tipc]
[&lt;ffffffffa0308f47&gt;] tipc_k_signal+0x8d/0xb1 [tipc]
[&lt;ffffffffa0308dd9&gt;] tipc_core_start+0x8a/0xad [tipc]
[&lt;ffffffffa01b1087&gt;] 0xffffffffa01b1087
[&lt;ffffffff8100207d&gt;] do_one_initcall+0x72/0x18a
[&lt;ffffffff810872fb&gt;] sys_init_module+0xd8/0x23a
[&lt;ffffffff81009b42&gt;] system_call_fastpath+0x16/0x1b

-&gt; #0 (ref_table_lock){+.-...}:
[&lt;ffffffff8107b3b2&gt;] __lock_acquire+0xa11/0xd0f
[&lt;ffffffff8107b78c&gt;] lock_acquire+0xdc/0x102
[&lt;ffffffff81454836&gt;] _raw_write_lock_bh+0x3b/0x6e
[&lt;ffffffffa0315148&gt;] tipc_ref_discard+0x53/0xd4 [tipc]
[&lt;ffffffffa03141ee&gt;] tipc_deleteport+0x40/0x119 [tipc]
[&lt;ffffffffa0316e35&gt;] release+0xeb/0x137 [tipc]
[&lt;ffffffff8139dbf4&gt;] sock_release+0x1f/0x6f
[&lt;ffffffff8139dc6b&gt;] sock_close+0x27/0x2b
[&lt;ffffffff811116f6&gt;] __fput+0x12a/0x1df
[&lt;ffffffff811117c5&gt;] fput+0x1a/0x1c
[&lt;ffffffff8110e49b&gt;] filp_close+0x68/0x72
[&lt;ffffffff8110e552&gt;] sys_close+0xad/0xe7
[&lt;ffffffff81009b42&gt;] system_call_fastpath+0x16/0x1b

Finally decided I should fix this.  Its a straightforward inversion,
tipc_ref_acquire takes two locks in this order:
ref_table_lock
entry-&gt;lock

while tipc_deleteport takes them in this order:
entry-&gt;lock (via tipc_port_lock())
ref_table_lock (via tipc_ref_discard())

when the same entry is referenced, we get the above warning.  The fix is equally
straightforward.  Theres no real relation between the entry-&gt;lock and the
ref_table_lock (they just are needed at the same time), so move the entry-&gt;lock
aquisition in tipc_ref_acquire down, after we unlock ref_table_lock (this is
safe since the ref_table_lock guards changes to the reference table, and we've
already claimed a slot there.  I've tested the below fix and confirmed that it
clears up the lockdep issue

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
CC: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: Eliminate improper use of TIPC_OK error code</title>
<updated>2008-07-15T05:44:01+00:00</updated>
<author>
<name>Allan Stephens</name>
<email>allan.stephens@windriver.com</email>
</author>
<published>2008-07-15T05:44:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0e35fd5e5264bb46d1febbe9cd9aa08421c21a96'/>
<id>0e35fd5e5264bb46d1febbe9cd9aa08421c21a96</id>
<content type='text'>
This patch corrects many places where TIPC routines indicated
successful completion by returning TIPC_OK instead of 0.
(The TIPC_OK symbol has the value 0, but it should only be used
in contexts that deal with the error code field of a TIPC
message header.)

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch corrects many places where TIPC routines indicated
successful completion by returning TIPC_OK instead of 0.
(The TIPC_OK symbol has the value 0, but it should only be used
in contexts that deal with the error code field of a TIPC
message header.)

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: Fix race condition when creating socket or native port</title>
<updated>2008-05-12T22:42:28+00:00</updated>
<author>
<name>Allan Stephens</name>
<email>allan.stephens@windriver.com</email>
</author>
<published>2008-05-12T22:42:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7ef43ebaa538e0cc9063cbf84593a05091bcace2'/>
<id>7ef43ebaa538e0cc9063cbf84593a05091bcace2</id>
<content type='text'>
This patch eliminates the (very remote) chance of a crash resulting
from a partially initialized socket or native port unexpectedly
receiving a message.  Now, during the creation of a socket or native
port, the underlying generic port's lock is not released until all
initialization required to handle incoming messages has been done.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch eliminates the (very remote) chance of a crash resulting
from a partially initialized socket or native port unexpectedly
receiving a message.  Now, during the creation of a socket or native
port, the underlying generic port's lock is not released until all
initialization required to handle incoming messages has been done.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[TIPC]: Cleanup of TIPC reference table code</title>
<updated>2008-04-17T01:22:20+00:00</updated>
<author>
<name>Allan Stephens</name>
<email>allan.stephens@windriver.com</email>
</author>
<published>2008-04-17T01:22:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bcff122d478b774f4fd5262f35eedebe2f2fb274'/>
<id>bcff122d478b774f4fd5262f35eedebe2f2fb274</id>
<content type='text'>
This patch is a largely cosmetic cleanup of the TIPC reference
table code.
- The object reference field in each table entry is now single
  32-bit integer instead of a union of two 32-bit integers.
- Variable naming has been made more consistent.
- Error message output has been made more consistent.
- Useless #includes have been eliminated.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch is a largely cosmetic cleanup of the TIPC reference
table code.
- The object reference field in each table entry is now single
  32-bit integer instead of a union of two 32-bit integers.
- Variable naming has been made more consistent.
- Error message output has been made more consistent.
- Useless #includes have been eliminated.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[TIPC]: Optimized initialization of TIPC reference table</title>
<updated>2008-04-17T01:21:47+00:00</updated>
<author>
<name>Allan Stephens</name>
<email>allan.stephens@windriver.com</email>
</author>
<published>2008-04-17T01:21:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0089509826b4997c37f08dfbdfb96ee952096cc9'/>
<id>0089509826b4997c37f08dfbdfb96ee952096cc9</id>
<content type='text'>
This patch modifies TIPC's reference table code to delay initializing
table entries until they are actually needed by applications.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch modifies TIPC's reference table code to delay initializing
table entries until they are actually needed by applications.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[TIPC]: Remove inlining of reference table locking routines</title>
<updated>2008-04-17T01:21:16+00:00</updated>
<author>
<name>Allan Stephens</name>
<email>allan.stephens@windriver.com</email>
</author>
<published>2008-04-17T01:21:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=4784b7c348779e957c82ba638ba2ada5ad8502d8'/>
<id>4784b7c348779e957c82ba638ba2ada5ad8502d8</id>
<content type='text'>
This patch converts the TIPC reference table locking routines
into non-inlined routines, since they are mainly called from
non-performance critical areas of TIPC and the added code
footprint incurred through inlining can no longer be justified.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch converts the TIPC reference table locking routines
into non-inlined routines, since they are mainly called from
non-performance critical areas of TIPC and the added code
footprint incurred through inlining can no longer be justified.

Signed-off-by: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: fix integer as NULL pointer sparse warnings in tipc</title>
<updated>2008-02-25T02:38:31+00:00</updated>
<author>
<name>Harvey Harrison</name>
<email>harvey.harrison@gmail.com</email>
</author>
<published>2008-02-25T02:38:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5f2f40a92e007ec5b503db20f3f70cb331c64f65'/>
<id>5f2f40a92e007ec5b503db20f3f70cb331c64f65</id>
<content type='text'>
net/tipc/cluster.c:145:2: warning: Using plain integer as NULL pointer
net/tipc/link.c:3254:36: warning: Using plain integer as NULL pointer
net/tipc/ref.c:151:15: warning: Using plain integer as NULL pointer
net/tipc/zone.c:85:2: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
net/tipc/cluster.c:145:2: warning: Using plain integer as NULL pointer
net/tipc/link.c:3254:36: warning: Using plain integer as NULL pointer
net/tipc/ref.c:151:15: warning: Using plain integer as NULL pointer
net/tipc/zone.c:85:2: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[NET] TIPC: Fix whitespace errors.</title>
<updated>2007-02-11T07:20:15+00:00</updated>
<author>
<name>YOSHIFUJI Hideaki</name>
<email>yoshfuji@linux-ipv6.org</email>
</author>
<published>2007-02-09T14:25:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c43072852649d8382b81237ce51195bcec36f24a'/>
<id>c43072852649d8382b81237ce51195bcec36f24a</id>
<content type='text'>
Signed-off-by: YOSHIFUJI Hideaki &lt;yoshfuji@linux-ipv6.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: YOSHIFUJI Hideaki &lt;yoshfuji@linux-ipv6.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[TIPC]: Removing useless casts</title>
<updated>2006-07-21T22:52:20+00:00</updated>
<author>
<name>Panagiotis Issaris</name>
<email>takis@issaris.org</email>
</author>
<published>2006-07-21T22:52:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9df3f3d28bca0157e2bab2f3171d2ad4f0930634'/>
<id>9df3f3d28bca0157e2bab2f3171d2ad4f0930634</id>
<content type='text'>
Removing useless casts

Signed-off-by: Panagiotis Issaris &lt;takis@issaris.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Removing useless casts

Signed-off-by: Panagiotis Issaris &lt;takis@issaris.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] spin/rwlock init cleanups</title>
<updated>2006-06-28T00:32:39+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2006-06-27T09:53:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=34af946a22724c4e2b204957f2b24b22a0fb121c'/>
<id>34af946a22724c4e2b204957f2b24b22a0fb121c</id>
<content type='text'>
locking init cleanups:

 - convert " = SPIN_LOCK_UNLOCKED" to spin_lock_init() or DEFINE_SPINLOCK()
 - convert rwlocks in a similar manner

this patch was generated automatically.

Motivation:

 - cleanliness
 - lockdep needs control of lock initialization, which the open-coded
   variants do not give
 - it's also useful for -rt and for lock debugging in general

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
locking init cleanups:

 - convert " = SPIN_LOCK_UNLOCKED" to spin_lock_init() or DEFINE_SPINLOCK()
 - convert rwlocks in a similar manner

this patch was generated automatically.

Motivation:

 - cleanliness
 - lockdep needs control of lock initialization, which the open-coded
   variants do not give
 - it's also useful for -rt and for lock debugging in general

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
