<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/net/tipc/node.h, branch linux-4.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2015-05-14T16:24:45Z</updated>
<entry>
<title>tipc: simplify include dependencies</title>
<updated>2015-05-14T16:24:45Z</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-05-14T14:46:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a6bf70f792963b32e410e5c3d2f96903265b090a'/>
<id>urn:sha1:a6bf70f792963b32e410e5c3d2f96903265b090a</id>
<content type='text'>
When we try to add new inline functions in the code, we sometimes
run into circular include dependencies.

The main problem is that the file core.h, which really should be at
the root of the dependency chain, instead is a leaf. I.e., core.h
includes a number of header files that themselves should be allowed
to include core.h. In reality this is unnecessary, because core.h does
not need to know the full signature of any of the structs it refers to,
only their type declaration.

In this commit, we remove all dependencies from core.h towards any
other tipc header file.

As a consequence of this change, we can now move the function
tipc_own_addr(net) from addr.c to addr.h, and make it inline.

There are no functional changes in this commit.

Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: involve reference counter for node structure</title>
<updated>2015-03-29T19:40:28Z</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2015-03-26T10:10:24Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8a0f6ebe8494c5c6ccfe12264385b64c280e3241'/>
<id>urn:sha1:8a0f6ebe8494c5c6ccfe12264385b64c280e3241</id>
<content type='text'>
TIPC node hash node table is protected with rcu lock on read side.
tipc_node_find() is used to look for a node object with node address
through iterating the hash node table. As the entire process of what
tipc_node_find() traverses the table is guarded with rcu read lock,
it's safe for us. However, when callers use the node object returned
by tipc_node_find(), there is no rcu read lock applied. Therefore,
this is absolutely unsafe for callers of tipc_node_find().

Now we introduce a reference counter for node structure. Before
tipc_node_find() returns node object to its caller, it first increases
the reference counter. Accordingly, after its caller used it up,
it decreases the counter again. This can prevent a node being used by
one thread from being freed by another thread.

Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericson.com&gt;
Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: fix potential deadlock when all links are reset</title>
<updated>2015-03-29T19:40:27Z</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2015-03-26T10:10:23Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b952b2befb6f6b009e91f087285b9a0a6beb1cc8'/>
<id>urn:sha1:b952b2befb6f6b009e91f087285b9a0a6beb1cc8</id>
<content type='text'>
[   60.988363] ======================================================
[   60.988754] [ INFO: possible circular locking dependency detected ]
[   60.989152] 3.19.0+ #194 Not tainted
[   60.989377] -------------------------------------------------------
[   60.989781] swapper/3/0 is trying to acquire lock:
[   60.990079]  (&amp;(&amp;n_ptr-&gt;lock)-&gt;rlock){+.-...}, at: [&lt;ffffffffa0006dca&gt;] tipc_link_retransmit+0x1aa/0x240 [tipc]
[   60.990743]
[   60.990743] but task is already holding lock:
[   60.991106]  (&amp;(&amp;bclink-&gt;lock)-&gt;rlock){+.-...}, at: [&lt;ffffffffa00004be&gt;] tipc_bclink_lock+0x8e/0xa0 [tipc]
[   60.991738]
[   60.991738] which lock already depends on the new lock.
[   60.991738]
[   60.992174]
[   60.992174] the existing dependency chain (in reverse order) is:
[   60.992174]
-&gt; #1 (&amp;(&amp;bclink-&gt;lock)-&gt;rlock){+.-...}:
[   60.992174]        [&lt;ffffffff810a9c0c&gt;] lock_acquire+0x9c/0x140
[   60.992174]        [&lt;ffffffff8179c41f&gt;] _raw_spin_lock_bh+0x3f/0x50
[   60.992174]        [&lt;ffffffffa00004be&gt;] tipc_bclink_lock+0x8e/0xa0 [tipc]
[   60.992174]        [&lt;ffffffffa0000f57&gt;] tipc_bclink_add_node+0x97/0xf0 [tipc]
[   60.992174]        [&lt;ffffffffa0011815&gt;] tipc_node_link_up+0xf5/0x110 [tipc]
[   60.992174]        [&lt;ffffffffa0007783&gt;] link_state_event+0x2b3/0x4f0 [tipc]
[   60.992174]        [&lt;ffffffffa00193c0&gt;] tipc_link_proto_rcv+0x24c/0x418 [tipc]
[   60.992174]        [&lt;ffffffffa0008857&gt;] tipc_rcv+0x827/0xac0 [tipc]
[   60.992174]        [&lt;ffffffffa0002ca3&gt;] tipc_l2_rcv_msg+0x73/0xd0 [tipc]
[   60.992174]        [&lt;ffffffff81646e66&gt;] __netif_receive_skb_core+0x746/0x980
[   60.992174]        [&lt;ffffffff816470c1&gt;] __netif_receive_skb+0x21/0x70
[   60.992174]        [&lt;ffffffff81647295&gt;] netif_receive_skb_internal+0x35/0x130
[   60.992174]        [&lt;ffffffff81648218&gt;] napi_gro_receive+0x158/0x1d0
[   60.992174]        [&lt;ffffffff81559e05&gt;] e1000_clean_rx_irq+0x155/0x490
[   60.992174]        [&lt;ffffffff8155c1b7&gt;] e1000_clean+0x267/0x990
[   60.992174]        [&lt;ffffffff81647b60&gt;] net_rx_action+0x150/0x360
[   60.992174]        [&lt;ffffffff8105ec43&gt;] __do_softirq+0x123/0x360
[   60.992174]        [&lt;ffffffff8105f12e&gt;] irq_exit+0x8e/0xb0
[   60.992174]        [&lt;ffffffff8179f9f5&gt;] do_IRQ+0x65/0x110
[   60.992174]        [&lt;ffffffff8179da6f&gt;] ret_from_intr+0x0/0x13
[   60.992174]        [&lt;ffffffff8100de9f&gt;] arch_cpu_idle+0xf/0x20
[   60.992174]        [&lt;ffffffff8109dfa6&gt;] cpu_startup_entry+0x2f6/0x3f0
[   60.992174]        [&lt;ffffffff81033cda&gt;] start_secondary+0x13a/0x150
[   60.992174]
-&gt; #0 (&amp;(&amp;n_ptr-&gt;lock)-&gt;rlock){+.-...}:
[   60.992174]        [&lt;ffffffff810a8f7d&gt;] __lock_acquire+0x163d/0x1ca0
[   60.992174]        [&lt;ffffffff810a9c0c&gt;] lock_acquire+0x9c/0x140
[   60.992174]        [&lt;ffffffff8179c41f&gt;] _raw_spin_lock_bh+0x3f/0x50
[   60.992174]        [&lt;ffffffffa0006dca&gt;] tipc_link_retransmit+0x1aa/0x240 [tipc]
[   60.992174]        [&lt;ffffffffa0001e11&gt;] tipc_bclink_rcv+0x611/0x640 [tipc]
[   60.992174]        [&lt;ffffffffa0008646&gt;] tipc_rcv+0x616/0xac0 [tipc]
[   60.992174]        [&lt;ffffffffa0002ca3&gt;] tipc_l2_rcv_msg+0x73/0xd0 [tipc]
[   60.992174]        [&lt;ffffffff81646e66&gt;] __netif_receive_skb_core+0x746/0x980
[   60.992174]        [&lt;ffffffff816470c1&gt;] __netif_receive_skb+0x21/0x70
[   60.992174]        [&lt;ffffffff81647295&gt;] netif_receive_skb_internal+0x35/0x130
[   60.992174]        [&lt;ffffffff81648218&gt;] napi_gro_receive+0x158/0x1d0
[   60.992174]        [&lt;ffffffff81559e05&gt;] e1000_clean_rx_irq+0x155/0x490
[   60.992174]        [&lt;ffffffff8155c1b7&gt;] e1000_clean+0x267/0x990
[   60.992174]        [&lt;ffffffff81647b60&gt;] net_rx_action+0x150/0x360
[   60.992174]        [&lt;ffffffff8105ec43&gt;] __do_softirq+0x123/0x360
[   60.992174]        [&lt;ffffffff8105f12e&gt;] irq_exit+0x8e/0xb0
[   60.992174]        [&lt;ffffffff8179f9f5&gt;] do_IRQ+0x65/0x110
[   60.992174]        [&lt;ffffffff8179da6f&gt;] ret_from_intr+0x0/0x13
[   60.992174]        [&lt;ffffffff8100de9f&gt;] arch_cpu_idle+0xf/0x20
[   60.992174]        [&lt;ffffffff8109dfa6&gt;] cpu_startup_entry+0x2f6/0x3f0
[   60.992174]        [&lt;ffffffff81033cda&gt;] start_secondary+0x13a/0x150
[   60.992174]
[   60.992174] other info that might help us debug this:
[   60.992174]
[   60.992174]  Possible unsafe locking scenario:
[   60.992174]
[   60.992174]        CPU0                    CPU1
[   60.992174]        ----                    ----
[   60.992174]   lock(&amp;(&amp;bclink-&gt;lock)-&gt;rlock);
[   60.992174]                                lock(&amp;(&amp;n_ptr-&gt;lock)-&gt;rlock);
[   60.992174]                                lock(&amp;(&amp;bclink-&gt;lock)-&gt;rlock);
[   60.992174]   lock(&amp;(&amp;n_ptr-&gt;lock)-&gt;rlock);
[   60.992174]
[   60.992174]  *** DEADLOCK ***
[   60.992174]
[   60.992174] 3 locks held by swapper/3/0:
[   60.992174]  #0:  (rcu_read_lock){......}, at: [&lt;ffffffff81646791&gt;] __netif_receive_skb_core+0x71/0x980
[   60.992174]  #1:  (rcu_read_lock){......}, at: [&lt;ffffffffa0002c35&gt;] tipc_l2_rcv_msg+0x5/0xd0 [tipc]
[   60.992174]  #2:  (&amp;(&amp;bclink-&gt;lock)-&gt;rlock){+.-...}, at: [&lt;ffffffffa00004be&gt;] tipc_bclink_lock+0x8e/0xa0 [tipc]
[   60.992174]

The correct the sequence of grabbing n_ptr-&gt;lock and bclink-&gt;lock
should be that the former is first held and the latter is then taken,
which exactly happened on CPU1. But especially when the retransmission
of broadcast link is failed, bclink-&gt;lock is first held in
tipc_bclink_rcv(), and n_ptr-&gt;lock is taken in link_retransmit_failure()
called by tipc_link_retransmit() subsequently, which is demonstrated on
CPU0. As a result, deadlock occurs.

If the order of holding the two locks happening on CPU0 is reversed, the
deadlock risk will be relieved. Therefore, the node lock taken in
link_retransmit_failure() originally is moved to tipc_bclink_rcv()
so that it's obtained before bclink lock. But the precondition of
the adjustment of node lock is that responding to bclink reset event
must be moved from tipc_bclink_unlock() to tipc_node_unlock().

Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: split link outqueue</title>
<updated>2015-03-14T18:38:32Z</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-03-13T20:08:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=05dcc5aa4dcced4f59f925625cea669e82b75519'/>
<id>urn:sha1:05dcc5aa4dcced4f59f925625cea669e82b75519</id>
<content type='text'>
struct tipc_link contains one single queue for outgoing packets,
where both transmitted and waiting packets are queued.

This infrastructure is hard to maintain, because we need
to keep a number of fields to keep track of which packets are
sent or unsent, and the number of packets in each category.

A lot of code becomes simpler if we split this queue into a transmission
queue, where sent/unacknowledged packets are kept, and a backlog queue,
where we keep the not yet sent packets.

In this commit we do this separation.

Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: add framework for node capabilities exchange</title>
<updated>2015-03-14T18:38:32Z</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-03-13T20:08:05Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7764d6e83d2c3b50d9282f12144ebb10418c056e'/>
<id>urn:sha1:7764d6e83d2c3b50d9282f12144ebb10418c056e</id>
<content type='text'>
The TIPC protocol spec has defined a 13 bit capability bitmap in
the neighbor discovery header, as a means to maintain compatibility
between different code and protocol generations. Until now this field
has been unused.

We now introduce the basic framework for exchanging capabilities
between nodes at first contact. After exchange, a peer node's
capabilities are stored as a 16 bit bitmap in struct tipc_node.

Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: convert legacy nl node dump to nl compat</title>
<updated>2015-02-09T21:20:49Z</updated>
<author>
<name>Richard Alpe</name>
<email>richard.alpe@ericsson.com</email>
</author>
<published>2015-02-09T08:50:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4b28cb581dd0df8d8ff19151f39683f641e576ba'/>
<id>urn:sha1:4b28cb581dd0df8d8ff19151f39683f641e576ba</id>
<content type='text'>
Convert TIPC_CMD_GET_NODES to compat dumpit and remove global node
counter solely used by the legacy API.

Signed-off-by: Richard Alpe &lt;richard.alpe@ericsson.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: convert legacy nl link dump to nl compat</title>
<updated>2015-02-09T21:20:48Z</updated>
<author>
<name>Richard Alpe</name>
<email>richard.alpe@ericsson.com</email>
</author>
<published>2015-02-09T08:50:07Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=357ebdbfca0baa9a8d8d85307393e9ec3406affc'/>
<id>urn:sha1:357ebdbfca0baa9a8d8d85307393e9ec3406affc</id>
<content type='text'>
Convert TIPC_CMD_GET_LINKS to compat dumpit and remove global link
counter solely used by the legacy API.

Signed-off-by: Richard Alpe &lt;richard.alpe@ericsson.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: eliminate race condition at multicast reception</title>
<updated>2015-02-06T00:00:03Z</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-02-05T13:36:44Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=cb1b728096f54e7408d60fb571944bed00c5b771'/>
<id>urn:sha1:cb1b728096f54e7408d60fb571944bed00c5b771</id>
<content type='text'>
In a previous commit in this series we resolved a race problem during
unicast message reception.

Here, we resolve the same problem at multicast reception. We apply the
same technique: an input queue serializing the delivery of arriving
buffers. The main difference is that here we do it in two steps.
First, the broadcast link feeds arriving buffers into the tail of an
arrival queue, which head is consumed at the socket level, and where
destination lookup is performed. Second, if the lookup is successful,
the resulting buffer clones are fed into a second queue, the input
queue. This queue is consumed at reception in the socket just like
in the unicast case. Both queues are protected by the same lock, -the
one of the input queue.

Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: resolve race problem at unicast message reception</title>
<updated>2015-02-06T00:00:02Z</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-02-05T13:36:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c637c1035534867b85b78b453c38c495b58e2c5a'/>
<id>urn:sha1:c637c1035534867b85b78b453c38c495b58e2c5a</id>
<content type='text'>
TIPC handles message cardinality and sequencing at the link layer,
before passing messages upwards to the destination sockets. During the
upcall from link to socket no locks are held. It is therefore possible,
and we see it happen occasionally, that messages arriving in different
threads and delivered in sequence still bypass each other before they
reach the destination socket. This must not happen, since it violates
the sequentiality guarantee.

We solve this by adding a new input buffer queue to the link structure.
Arriving messages are added safely to the tail of that queue by the
link, while the head of the queue is consumed, also safely, by the
receiving socket. Sequentiality is secured per socket by only allowing
buffers to be dequeued inside the socket lock. Since there may be multiple
simultaneous readers of the queue, we use a 'filter' parameter to reduce
the risk that they peek the same buffer from the queue, hence also
reducing the risk of contention on the receiving socket locks.

This solves the sequentiality problem, and seems to cause no measurable
performance degradation.

A nice side effect of this change is that lock handling in the functions
tipc_rcv() and tipc_bcast_rcv() now becomes uniform, something that
will enable future simplifications of those functions.

Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: make tipc node table aware of net namespace</title>
<updated>2015-01-12T21:24:32Z</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2015-01-09T07:27:05Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f2f9800d4955a96d92896841d8ba9b04201deaa1'/>
<id>urn:sha1:f2f9800d4955a96d92896841d8ba9b04201deaa1</id>
<content type='text'>
Global variables associated with node table are below:
- node table list (node_htable)
- node hash table list (tipc_node_list)
- node table lock (node_list_lock)
- node number counter (tipc_num_nodes)
- node link number counter (tipc_num_links)

To make node table support namespace, above global variables must be
moved to tipc_net structure in order to keep secret for different
namespaces. As a consequence, these variables are allocated and
initialized when namespace is created, and deallocated when namespace
is destroyed. After the change, functions associated with these
variables have to utilize a namespace pointer to access them. So
adding namespace pointer as a parameter of these functions is the
major change made in the commit.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Tested-by: Tero Aho &lt;Tero.Aho@coriant.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
