<feed xmlns='http://www.w3.org/2005/Atom'>
<title>BMC/Intel-BMC/linux.git/net/tipc/bcast.c, branch dev-4.3</title>
<subtitle>Intel OpenBMC Linux kernel source tree (mirror)</subtitle>
<id>https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-4.3</id>
<link rel='self' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-4.3'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/'/>
<updated>2015-10-22T02:02:17+00:00</updated>
<entry>
<title>tipc: extend broadcast link window size</title>
<updated>2015-10-22T02:02:17+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-10-19T13:21:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=53387c4e22ac33d27a552b3d56bad932bd32531b'/>
<id>urn:sha1:53387c4e22ac33d27a552b3d56bad932bd32531b</id>
<content type='text'>
The default fix broadcast window size is currently set to 20 packets.
This is a very low value, set at a time when we were still testing on
10 Mb/s hubs, and a change to it is long overdue.

Commit 7845989cb4b3da1db ("net: tipc: fix stall during bclink wakeup procedure")
revealed a problem with this low value. For messages of importance LOW,
the backlog queue limit will be  calculated to 30 packets, while a
single, maximum sized message of 66000 bytes, carried across a 1500 MTU
network consists of 46 packets.

This leads to the following scenario (among others leading to the same
situation):

1: Msg 1 of 46 packets is sent. 20 packets go to the transmit queue, 26
   packets to the backlog queue.
2: Msg 2 of 46 packets is attempted sent, but rejected because there is
   no more space in the backlog queue at this level. The sender is added
   to the wakeup queue with a "pending packets chain size" number of 46.
3: Some packets in the transmit queue are acked and released. We try to
   wake up the sender, but the pending size of 46 is bigger than the LOW
   wakeup limit of 30, so this doesn't happen.
5: Subsequent acks releases all the remaining buffers. Each time we test
   for the wakeup criteria and find that 46 still is larger than 30,
   even after both the transmit and the backlog queues are empty.
6: The sender is never woken up and given a chance to send its message.
   He is stuck.

We could now loosen the wakeup criteria (used by link_prepare_wakeup())
to become equal to the send criteria (used by tipc_link_xmit()), i.e.,
by ignoring the "pending packets chain size" value altogether, or we can
just increase the queue limits so that the criteria can be satisfied
anyway. There are good reasons (potentially multiple waiting senders) to
not opt for the former solution, so we choose the latter one.

This commit fixes the problem by giving the broadcast link window a
default value of 50 packets. We also introduce a new minimum link
window size BCLINK_MIN_WIN of 32, which is enough to always avoid the
described situation. Finally, in order to not break any existing users
which may set the window explicitly, we enforce that the window is set
to the new minimum value in case the user is trying to set it to
anything lower.

Fixes: 7845989cb4b3da1db ("net: tipc: fix stall during bclink wakeup procedure")
Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: tipc: fix stall during bclink wakeup procedure</title>
<updated>2015-09-09T05:50:26+00:00</updated>
<author>
<name>Kolmakov Dmitriy</name>
<email>kolmakov.dmitriy@huawei.com</email>
</author>
<published>2015-09-07T09:05:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=7845989cb4b3da1db903918c844fccb9817d34a0'/>
<id>urn:sha1:7845989cb4b3da1db903918c844fccb9817d34a0</id>
<content type='text'>
If an attempt to wake up users of broadcast link is made when there is
no enough place in send queue than it may hang up inside the
tipc_sk_rcv() function since the loop breaks only after the wake up
queue becomes empty. This can lead to complete CPU stall with the
following message generated by RCU:

INFO: rcu_sched self-detected stall on CPU { 0}  (t=2101 jiffies
					g=54225 c=54224 q=11465)
Task dump for CPU 0:
tpch            R  running task        0 39949  39948 0x0000000a
 ffffffff818536c0 ffff88181fa037a0 ffffffff8106a4be 0000000000000000
 ffffffff818536c0 ffff88181fa037c0 ffffffff8106d8a8 ffff88181fa03800
 0000000000000001 ffff88181fa037f0 ffffffff81094a50 ffff88181fa15680
Call Trace:
 &lt;IRQ&gt;  [&lt;ffffffff8106a4be&gt;] sched_show_task+0xae/0x120
 [&lt;ffffffff8106d8a8&gt;] dump_cpu_task+0x38/0x40
 [&lt;ffffffff81094a50&gt;] rcu_dump_cpu_stacks+0x90/0xd0
 [&lt;ffffffff81097c3b&gt;] rcu_check_callbacks+0x3eb/0x6e0
 [&lt;ffffffff8106e53f&gt;] ? account_system_time+0x7f/0x170
 [&lt;ffffffff81099e64&gt;] update_process_times+0x34/0x60
 [&lt;ffffffff810a84d1&gt;] tick_sched_handle.isra.18+0x31/0x40
 [&lt;ffffffff810a851c&gt;] tick_sched_timer+0x3c/0x70
 [&lt;ffffffff8109a43d&gt;] __run_hrtimer.isra.34+0x3d/0xc0
 [&lt;ffffffff8109aa95&gt;] hrtimer_interrupt+0xc5/0x1e0
 [&lt;ffffffff81030d52&gt;] ? native_smp_send_reschedule+0x42/0x60
 [&lt;ffffffff81032f04&gt;] local_apic_timer_interrupt+0x34/0x60
 [&lt;ffffffff810335bc&gt;] smp_apic_timer_interrupt+0x3c/0x60
 [&lt;ffffffff8165a3fb&gt;] apic_timer_interrupt+0x6b/0x70
 [&lt;ffffffff81659129&gt;] ? _raw_spin_unlock_irqrestore+0x9/0x10
 [&lt;ffffffff8107eb9f&gt;] __wake_up_sync_key+0x4f/0x60
 [&lt;ffffffffa313ddd1&gt;] tipc_write_space+0x31/0x40 [tipc]
 [&lt;ffffffffa313dadf&gt;] filter_rcv+0x31f/0x520 [tipc]
 [&lt;ffffffffa313d699&gt;] ? tipc_sk_lookup+0xc9/0x110 [tipc]
 [&lt;ffffffff81659259&gt;] ? _raw_spin_lock_bh+0x19/0x30
 [&lt;ffffffffa314122c&gt;] tipc_sk_rcv+0x2dc/0x3e0 [tipc]
 [&lt;ffffffffa312e7ff&gt;] tipc_bclink_wakeup_users+0x2f/0x40 [tipc]
 [&lt;ffffffffa313ce26&gt;] tipc_node_unlock+0x186/0x190 [tipc]
 [&lt;ffffffff81597c1c&gt;] ? kfree_skb+0x2c/0x40
 [&lt;ffffffffa313475c&gt;] tipc_rcv+0x2ac/0x8c0 [tipc]
 [&lt;ffffffffa312ff58&gt;] tipc_l2_rcv_msg+0x38/0x50 [tipc]
 [&lt;ffffffff815a76d3&gt;] __netif_receive_skb_core+0x5a3/0x950
 [&lt;ffffffff815a98d3&gt;] __netif_receive_skb+0x13/0x60
 [&lt;ffffffff815a993e&gt;] netif_receive_skb_internal+0x1e/0x90
 [&lt;ffffffff815aa138&gt;] napi_gro_receive+0x78/0xa0
 [&lt;ffffffffa07f93f4&gt;] tg3_poll_work+0xc54/0xf40 [tg3]
 [&lt;ffffffff81597c8c&gt;] ? consume_skb+0x2c/0x40
 [&lt;ffffffffa07f9721&gt;] tg3_poll_msix+0x41/0x160 [tg3]
 [&lt;ffffffff815ab0f2&gt;] net_rx_action+0xe2/0x290
 [&lt;ffffffff8104b92a&gt;] __do_softirq+0xda/0x1f0
 [&lt;ffffffff8104bc26&gt;] irq_exit+0x76/0xa0
 [&lt;ffffffff81004355&gt;] do_IRQ+0x55/0xf0
 [&lt;ffffffff8165a12b&gt;] common_interrupt+0x6b/0x6b
 &lt;EOI&gt;

The issue occurs only when tipc_sk_rcv() is used to wake up postponed
senders:

	tipc_bclink_wakeup_users()
		// wakeupq - is a queue which consists of special
		// 		 messages with SOCK_WAKEUP type.
		tipc_sk_rcv(wakeupq)
			...
			while (skb_queue_len(inputq)) {
				filter_rcv(skb)
					// Here the type of message is checked
					// and if it is SOCK_WAKEUP then
					// it tries to wake up a sender.
					tipc_write_space(sk)
						wake_up_interruptible_sync_poll()
			}

After the sender thread is woke up it can gather control and perform
an attempt to send a message. But if there is no enough place in send
queue it will call link_schedule_user() function which puts a message
of type SOCK_WAKEUP to the wakeup queue and put the sender to sleep.
Thus the size of the queue actually is not changed and the while()
loop never exits.

The approach I proposed is to wake up only senders for which there is
enough place in send queue so the described issue can't occur.
Moreover the same approach is already used to wake up senders on
unicast links.

I have got into the issue on our product code but to reproduce the
issue I changed a benchmark test application (from
tipcutils/demos/benchmark) to perform the following scenario:
	1. Run 64 instances of test application (nodes). It can be done
	   on the one physical machine.
	2. Each application connects to all other using TIPC sockets in
	   RDM mode.
	3. When setup is done all nodes start simultaneously send
	   broadcast messages.
	4. Everything hangs up.

The issue is reproducible only when a congestion on broadcast link
occurs. For example, when there are only 8 nodes it works fine since
congestion doesn't occur. Send queue limit is 40 in my case (I use a
critical importance level) and when 64 nodes send a message at the
same moment a congestion occurs every time.

Signed-off-by: Dmitry S Kolmakov &lt;kolmakov.dmitriy@huawei.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Acked-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: reduce locking scope during packet reception</title>
<updated>2015-07-21T03:41:16+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-07-16T20:54:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=d999297c3dbbe7fdd832f7fa4ec84301e170b3e6'/>
<id>urn:sha1:d999297c3dbbe7fdd832f7fa4ec84301e170b3e6</id>
<content type='text'>
We convert packet/message reception according to the same principle
we have been using for message sending and timeout handling:

We move the function tipc_rcv() to node.c, hence handling the initial
packet reception at the link aggregation level. The function grabs
the node lock, selects the receiving link, and accesses it via a new
call tipc_link_rcv(). This function appends buffers to the input
queue for delivery upwards, but it may also append outgoing packets
to the xmit queue, just as we do during regular message sending. The
latter will happen when buffers are forwarded from the link backlog,
or when retransmission is requested.

Upon return of this function, and after having released the node lock,
tipc_rcv() delivers/tranmsits the contents of those queues, but it may
also perform actions such as link activation or reset, as indicated by
the return flags from the link.

This reduces the number of cpu cycles spent inside the node spinlock,
and reduces contention on that lock.

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: clean up definitions and usage of link flags</title>
<updated>2015-07-21T03:41:15+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-07-16T20:54:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=d3504c3449fead545e5254bfb11da916f72c4734'/>
<id>urn:sha1:d3504c3449fead545e5254bfb11da916f72c4734</id>
<content type='text'>
The status flag LINK_STOPPED is not needed any more, since the
mechanism for delayed deletion of links has been removed.
Likewise, LINK_STARTED and LINK_START_EVT are unnecessary,
because we can just as well start the link timer directly from
inside tipc_link_create().

We eliminate these flags in this commit.

Instead of the above flags, we now introduce three new link modes,
TIPC_LINK_OPEN, TIPC_LINK_BLOCKED and TIPC_LINK_TUNNEL. The values
indicate whether, and in the case of TIPC_LINK_TUNNEL, which, messages
the link is allowed to receive in this state. TIPC_LINK_BLOCKED also
blocks timer-driven protocol messages to be sent out, and any change
to the link FSM. Since the modes are mutually exclusive, we convert
them to state values, and rename the 'flags' field in struct tipc_link
to 'exec_mode'.

Finally, we move the #defines for link FSM states and events from link.h
into enums inside the file link.c, which is the real usage scope of
these definitions.

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: change sk_buffer handling in tipc_link_xmit()</title>
<updated>2015-07-21T03:41:15+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-07-16T20:54:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=22d85c79428b8ca9a01623aa3e3a1fe29a30a119'/>
<id>urn:sha1:22d85c79428b8ca9a01623aa3e3a1fe29a30a119</id>
<content type='text'>
When the function tipc_link_xmit() is given a buffer list for
transmission, it currently consumes the list both when transmission
is successful and when it fails, except for the special case when
it encounters link congestion.

This behavior is inconsistent, and needs to be corrected if we want
to avoid problems in later commits in this series.

In this commit, we change this to let the function consume the list
only when transmission is successful, and leave the list with the
sender in all other cases. We also modifiy the socket code so that
it adapts to this change, i.e., purges the list when a non-congestion
error code is returned.

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: introduce link entry structure to struct tipc_node</title>
<updated>2015-07-21T03:41:14+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-07-16T20:54:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=9d13ec65ede775f896c3da1cfa35283afe2f796c'/>
<id>urn:sha1:9d13ec65ede775f896c3da1cfa35283afe2f796c</id>
<content type='text'>
struct 'tipc_node' currently contains two arrays for link attributes,
one for the link pointers, and one for the usable link MTUs.

We now group those into a new struct 'tipc_link_entry', and intoduce
one single array consisting of such enties. Apart from being a cosmetic
improvement, this is a starting point for the strict master-slave
relation between node and link that we will introduce in the following
commits.

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: purge backlog queue counters when broadcast link is reset</title>
<updated>2015-06-28T23:43:02+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-06-28T13:44:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=7d967b673c2ff992205be051ffebc39e1a323400'/>
<id>urn:sha1:7d967b673c2ff992205be051ffebc39e1a323400</id>
<content type='text'>
In commit 1f66d161ab3d8b518903fa6c3f9c1f48d6919e74
("tipc: introduce starvation free send algorithm")
we introduced a counter per priority level for buffers
in the link backlog queue. We also introduced a new
function tipc_link_purge_backlog(), to reset these
counters to zero when the link is reset.

Unfortunately, we missed to call this function when
the broadcast link is reset, with the result that the
values of these counters might be permanently skewed
when new nodes are attached. This may in the worst case
lead to permananent, but spurious, broadcast link
congestion, where no broadcast packets can be sent at
all.

We fix this bug with this commit.

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 packet sequence number at instant of transmission</title>
<updated>2015-05-14T16:24:46+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-05-14T14:46:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=dd3f9e70f59f43a5712eba9cf3ee4f1e6999540c'/>
<id>urn:sha1:dd3f9e70f59f43a5712eba9cf3ee4f1e6999540c</id>
<content type='text'>
Currently, the packet sequence number is updated and added to each
packet at the moment a packet is added to the link backlog queue.
This is wasteful, since it forces the code to traverse the send
packet list packet by packet when adding them to the backlog queue.
It would be better to just splice the whole packet list into the
backlog queue when that is the right action to do.

In this commit, we do this change. Also, since the sequence numbers
cannot now be assigned to the packets at the moment they are added
the backlog queue, we do instead calculate and add them at the moment
of transmission, when the backlog queue has to be traversed anyway.
We do this in the function tipc_link_push_packet().

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: rename fields in struct tipc_link</title>
<updated>2015-05-14T16:24:46+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-05-14T14:46:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=a97b9d3fa9bce0d78dc83a14a9e1ebb3bf5cc414'/>
<id>urn:sha1:a97b9d3fa9bce0d78dc83a14a9e1ebb3bf5cc414</id>
<content type='text'>
We rename some fields in struct tipc_link, in order to give them more
descriptive names:

next_in_no -&gt; rcv_nxt
next_out_no-&gt; snd_nxt
fsm_msg_cnt-&gt; silent_intv_cnt
cont_intv  -&gt; keepalive_intv
last_retransmitted -&gt; last_retransm

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: add broadcast link window set/get to nl api</title>
<updated>2015-05-09T20:40:02+00:00</updated>
<author>
<name>Richard Alpe</name>
<email>richard.alpe@ericsson.com</email>
</author>
<published>2015-05-06T11:58:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=670f4f8818ee54d0c1831e3165dadd5b8a3f713e'/>
<id>urn:sha1:670f4f8818ee54d0c1831e3165dadd5b8a3f713e</id>
<content type='text'>
Add the ability to get or set the broadcast link window through the
new netlink API. The functionality was unintentionally missing from
the new netlink API. Adding this means that we also fix the breakage
in the old API when coming through the compat layer.

Fixes: 37e2d4843f9e (tipc: convert legacy nl link prop set to nl compat)
Reported-by: Tomi Ollila &lt;tomi.ollila@iki.fi&gt;
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;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
