<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/netpoll.h, branch v3.10.49</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.49</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.49'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2013-05-01T19:00:24Z</updated>
<entry>
<title>netpoll: convert mutex into a semaphore</title>
<updated>2013-05-01T19:00:24Z</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2013-04-30T05:35:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bd7c4b604a6cd707803c7c6ba142bfa131f9a9f3'/>
<id>urn:sha1:bd7c4b604a6cd707803c7c6ba142bfa131f9a9f3</id>
<content type='text'>
Bart Van Assche recently reported a warning to me:

&lt;IRQ&gt;  [&lt;ffffffff8103d79f&gt;] warn_slowpath_common+0x7f/0xc0
[&lt;ffffffff8103d7fa&gt;] warn_slowpath_null+0x1a/0x20
[&lt;ffffffff814761dd&gt;] mutex_trylock+0x16d/0x180
[&lt;ffffffff813968c9&gt;] netpoll_poll_dev+0x49/0xc30
[&lt;ffffffff8136a2d2&gt;] ? __alloc_skb+0x82/0x2a0
[&lt;ffffffff81397715&gt;] netpoll_send_skb_on_dev+0x265/0x410
[&lt;ffffffff81397c5a&gt;] netpoll_send_udp+0x28a/0x3a0
[&lt;ffffffffa0541843&gt;] ? write_msg+0x53/0x110 [netconsole]
[&lt;ffffffffa05418bf&gt;] write_msg+0xcf/0x110 [netconsole]
[&lt;ffffffff8103eba1&gt;] call_console_drivers.constprop.17+0xa1/0x1c0
[&lt;ffffffff8103fb76&gt;] console_unlock+0x2d6/0x450
[&lt;ffffffff8104011e&gt;] vprintk_emit+0x1ee/0x510
[&lt;ffffffff8146f9f6&gt;] printk+0x4d/0x4f
[&lt;ffffffffa0004f1d&gt;] scsi_print_command+0x7d/0xe0 [scsi_mod]

This resulted from my commit ca99ca14c which introduced a mutex_trylock
operation in a path that could execute in interrupt context.  When mutex
debugging is enabled, the above warns the user when we are in fact
exectuting in interrupt context
interrupt context.

After some discussion, It seems that a semaphore is the proper mechanism to use
here.  While mutexes are defined to be unusable in interrupt context, no such
condition exists for semaphores (save for the fact that the non blocking api
calls, like up and down_trylock must be used when in irq context).

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Reported-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
CC: Bart Van Assche &lt;bvanassche@acm.org&gt;
CC: David Miller &lt;davem@davemloft.net&gt;
CC: netdev@vger.kernel.org
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: Fix __netpoll_rcu_free so that it can hold the rtnl lock</title>
<updated>2013-02-12T00:19:33Z</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2013-02-11T10:25:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2cde6acd49daca58b96f1fbc697492825511ad31'/>
<id>urn:sha1:2cde6acd49daca58b96f1fbc697492825511ad31</id>
<content type='text'>
__netpoll_rcu_free is used to free netpoll structures when the rtnl_lock is
already held.  The mechanism is used to asynchronously call __netpoll_cleanup
outside of the holding of the rtnl_lock, so as to avoid deadlock.
Unfortunately, __netpoll_cleanup modifies pointers (dev-&gt;np), which means the
rtnl_lock must be held while calling it.  Further, it cannot be held, because
rcu callbacks may be issued in softirq contexts, which cannot sleep.

Fix this by converting the rcu callback to a work queue that is guaranteed to
get scheduled in process context, so that we can hold the rtnl properly while
calling __netpoll_cleanup

Tested successfully by myself.

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
CC: "David S. Miller" &lt;davem@davemloft.net&gt;
CC: Cong Wang &lt;amwang@redhat.com&gt;
CC: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: protect napi_poll and poll_controller during dev_[open|close]</title>
<updated>2013-02-06T20:45:03Z</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2013-02-05T08:05:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ca99ca14c95ae49fb4c9cd3abf5f84d11a7e8a61'/>
<id>urn:sha1:ca99ca14c95ae49fb4c9cd3abf5f84d11a7e8a61</id>
<content type='text'>
Ivan Vercera was recently backporting commit
9c13cb8bb477a83b9a3c9e5a5478a4e21294a760 to a RHEL kernel, and I noticed that,
while this patch protects the tg3 driver from having its ndo_poll_controller
routine called during device initalization, it does nothing for the driver
during shutdown. I.e. it would be entirely possible to have the
ndo_poll_controller method (or subsequently the ndo_poll) routine called for a
driver in the netpoll path on CPU A while in parallel on CPU B, the ndo_close or
ndo_open routine could be called.  Given that the two latter routines tend to
initizlize and free many data structures that the former two rely on, the result
can easily be data corruption or various other crashes.  Furthermore, it seems
that this is potentially a problem with all net drivers that support netpoll,
and so this should ideally be fixed in a common path.

As Ben H Pointed out to me, we can't preform dev_open/dev_close in atomic
context, so I've come up with this solution.  We can use a mutex to sleep in
open/close paths and just do a mutex_trylock in the napi poll path and abandon
the poll attempt if we're locked, as we'll just retry the poll on the next send
anyway.

I've tested this here by flooding netconsole with messages on a system whos nic
driver I modfied to periodically return NETDEV_TX_BUSY, so that the netpoll tx
workqueue would be forced to send frames and poll the device.  While this was
going on I rapidly ifdown/up'ed the interface and watched for any problems.
I've not found any.

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
CC: Ivan Vecera &lt;ivecera@redhat.com&gt;
CC: "David S. Miller" &lt;davem@davemloft.net&gt;
CC: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
CC: Francois Romieu &lt;romieu@fr.zoreil.com&gt;
CC: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: prepare for ipv6</title>
<updated>2013-01-09T01:56:09Z</updated>
<author>
<name>Cong Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2013-01-07T20:52:39Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b7394d2429c198b1da3d46ac39192e891029ec0f'/>
<id>urn:sha1:b7394d2429c198b1da3d46ac39192e891029ec0f</id>
<content type='text'>
This patch adjusts some struct and functions, to prepare
for supporting IPv6.

Cc: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: convert several functions to bool</title>
<updated>2012-08-14T21:33:32Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2012-08-10T01:24:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=77ab8a54d9a8dcc4a46484a04133314f33f2aba6'/>
<id>urn:sha1:77ab8a54d9a8dcc4a46484a04133314f33f2aba6</id>
<content type='text'>
These functions are just boolean, let them return
bool instead of int.

Cc: David Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: take rcu_read_lock_bh() in netpoll_send_skb_on_dev()</title>
<updated>2012-08-14T21:33:31Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2012-08-10T01:24:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2899656b494dcd118123af1126826b115c8ea6f9'/>
<id>urn:sha1:2899656b494dcd118123af1126826b115c8ea6f9</id>
<content type='text'>
This patch fixes several problems in the call path of
netpoll_send_skb_on_dev():

1. Disable IRQ's before calling netpoll_send_skb_on_dev().

2. All the callees of netpoll_send_skb_on_dev() should use
   rcu_dereference_bh() to dereference -&gt;npinfo.

3. Rename arp_reply() to netpoll_arp_reply(), the former is too generic.

Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: use netpoll_rx_on() in netpoll_rx()</title>
<updated>2012-08-14T21:33:31Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2012-08-10T01:24:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=91fe4a4b9e490a24f6702dd8afe72d8afab6fcdb'/>
<id>urn:sha1:91fe4a4b9e490a24f6702dd8afe72d8afab6fcdb</id>
<content type='text'>
The logic of the code is same, just call netpoll_rx_on().

Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: take rcu_read_lock_bh() in netpoll_rx()</title>
<updated>2012-08-14T21:33:31Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2012-08-10T01:24:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=57c5d46191e75312934c00eba65b13a31ca95120'/>
<id>urn:sha1:57c5d46191e75312934c00eba65b13a31ca95120</id>
<content type='text'>
In __netpoll_rx(), it dereferences -&gt;npinfo without rcu_dereference_bh(),
this patch fixes it by using the 'npinfo' passed from netpoll_rx()
where it is already dereferenced with rcu_dereference_bh().

Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: make __netpoll_cleanup non-block</title>
<updated>2012-08-14T21:33:30Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2012-08-10T01:24:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=38e6bc185d9544dfad1774b3f8902a0b061aea25'/>
<id>urn:sha1:38e6bc185d9544dfad1774b3f8902a0b061aea25</id>
<content type='text'>
Like the previous patch, slave_disable_netpoll() and __netpoll_cleanup()
may be called with read_lock() held too, so we should make them
non-block, by moving the cleanup and kfree() to call_rcu_bh() callbacks.

Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup()</title>
<updated>2012-08-14T21:33:30Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2012-08-10T01:24:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=47be03a28cc6c80e3aa2b3e8ed6d960ff0c5c0af'/>
<id>urn:sha1:47be03a28cc6c80e3aa2b3e8ed6d960ff0c5c0af</id>
<content type='text'>
slave_enable_netpoll() and __netpoll_setup() may be called
with read_lock() held, so should use GFP_ATOMIC to allocate
memory. Eric suggested to pass gfp flags to __netpoll_setup().

Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
