]> git.baikalelectronics.ru Git - kernel.git/commit
xen-netback: Fix Rx stall due to race condition
authorZoltan Kiss <zoltan.kiss@citrix.com>
Tue, 4 Feb 2014 19:54:37 +0000 (19:54 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Feb 2014 00:24:08 +0000 (16:24 -0800)
commit51f7a39cbdd55f7ac29dc9d0320a7b57816b5f6d
treedb1279d7fcd1847180cc22dc15a809de048509f8
parentd6c0ffbaf35351cc3adcf690461388649c68d821
xen-netback: Fix Rx stall due to race condition

The recent patch to fix receive side flow control
(599c1018e86226ed3bd9014f8217c772e2d3b3ff: xen-netback: stop vif thread
spinning if frontend is unresponsive) solved the spinning thread problem,
however caused an another one. The receive side can stall, if:
- [THREAD] xenvif_rx_action sets rx_queue_stopped to true
- [INTERRUPT] interrupt happens, and sets rx_event to true
- [THREAD] then xenvif_kthread sets rx_event to false
- [THREAD] rx_work_todo doesn't return true anymore

Also, if interrupt sent but there is still no room in the ring, it take quite a
long time until xenvif_rx_action realize it. This patch ditch that two variable,
and rework rx_work_todo. If the thread finds it can't fit more skb's into the
ring, it saves the last slot estimation into rx_last_skb_slots, otherwise it's
kept as 0. Then rx_work_todo will check if:
- there is something to send to the ring (like before)
- there is space for the topmost packet in the queue

I think that's more natural and optimal thing to test than two bool which are
set somewhere else.

Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/xen-netback/common.h
drivers/net/xen-netback/interface.c
drivers/net/xen-netback/netback.c