netpoll: make ndo_poll_controller() optional
authorEric Dumazet <edumazet@google.com>
Fri, 21 Sep 2018 22:27:38 +0000 (15:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Sep 2018 04:55:24 +0000 (21:55 -0700)
commitac3d9dd034e565df2c034ab2ca71f0a9f69153c1
tree8cc679798aebb820bdbb0df3c817a6e114ddce8f
parent16fdf8ba98391650ce4bc4f3f71629d8a413bc21
netpoll: make ndo_poll_controller() optional

As diagnosed by Song Liu, ndo_poll_controller() can
be very dangerous on loaded hosts, since the cpu
calling ndo_poll_controller() might steal all NAPI
contexts (for all RX/TX queues of the NIC). This capture
can last for unlimited amount of time, since one
cpu is generally not able to drain all the queues under load.

It seems that all networking drivers that do use NAPI
for their TX completions, should not provide a ndo_poll_controller().

NAPI drivers have netpoll support already handled
in core networking stack, since netpoll_poll_dev()
uses poll_napi(dev) to iterate through registered
NAPI contexts for a device.

This patch allows netpoll_poll_dev() to process NAPI
contexts even for drivers not providing ndo_poll_controller(),
allowing for following patches in NAPI drivers.

Also we export netpoll_poll_dev() so that it can be called
by bonding/team drivers in following patches.

Reported-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Song Liu <songliubraving@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netpoll.h
net/core/netpoll.c