* [PATCH] rds: rds_cong_queue_updates needs to defer the congestion update transmission
@ 2015-02-10 14:22 Sowmini Varadhan
2015-02-10 16:50 ` Chuck Lever
0 siblings, 1 reply; 3+ messages in thread
From: Sowmini Varadhan @ 2015-02-10 14:22 UTC (permalink / raw)
To: chien.yen, davem
Cc: rds-devel, netdev, linux-kernel, sowmini.varadhan, chuck.lever
This patch fixes a sock_lock deadlock in the rds_cong_queue_update path.
We cannot inline the call to rds_send_xmit from rds_cong_queue_update
because
(a) we are already holding the sock_lock in the recv path, and
will deadlock when tcp_setsockopt/tcp_sendmsg try to get the sock
lock
(b) cong_queue_update does an irqsave on the rds_cong_lock, and this
will trigger warnings (for a good reason) from functions called
out of sock_lock.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
net/rds/cong.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/net/rds/cong.c b/net/rds/cong.c
index e5b65ac..765d18f 100644
--- a/net/rds/cong.c
+++ b/net/rds/cong.c
@@ -221,7 +221,21 @@ void rds_cong_queue_updates(struct rds_cong_map *map)
list_for_each_entry(conn, &map->m_conn_list, c_map_item) {
if (!test_and_set_bit(0, &conn->c_map_queued)) {
rds_stats_inc(s_cong_update_queued);
- rds_send_xmit(conn);
+ /* We cannot inline the call to rds_send_xmit() here
+ * for two reasons:
+ * 1. When we get here from the receive path, we
+ * are already holding the sock_lock (held by
+ * tcp_v4_rcv()). So inlining calls to
+ * tcp_setsockopt and/or tcp_sendmsg will deadlock
+ * when it tries to get the sock_lock())
+ * 2. Interrupts are masked so that we can mark the
+ * the port congested from both send and recv paths.
+ * (See comment around declaration of rds_cong_lock).
+ * An attempt to get the sock_lock() here will
+ * therefore trigger warnings.
+ * Defer the xmit to rds_send_worker() instead.
+ */
+ queue_delayed_work(rds_wq, &conn->c_send_w, 0);
}
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rds: rds_cong_queue_updates needs to defer the congestion update transmission
2015-02-10 14:22 [PATCH] rds: rds_cong_queue_updates needs to defer the congestion update transmission Sowmini Varadhan
@ 2015-02-10 16:50 ` Chuck Lever
2015-02-10 16:56 ` Sowmini Varadhan
0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever @ 2015-02-10 16:50 UTC (permalink / raw)
To: Sowmini Varadhan; +Cc: Chien Yen, davem, rds-devel, netdev, linux-kernel
On Feb 10, 2015, at 9:22 AM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote:
>
> This patch fixes a sock_lock deadlock in the rds_cong_queue_update path.
Note that the deadlock appears to exist only with TCP transports.
> We cannot inline the call to rds_send_xmit from rds_cong_queue_update
> because
> (a) we are already holding the sock_lock in the recv path, and
> will deadlock when tcp_setsockopt/tcp_sendmsg try to get the sock
> lock
> (b) cong_queue_update does an irqsave on the rds_cong_lock, and this
> will trigger warnings (for a good reason) from functions called
> out of sock_lock.
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> ---
> net/rds/cong.c | 16 +++++++++++++++-
> 1 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/net/rds/cong.c b/net/rds/cong.c
> index e5b65ac..765d18f 100644
> --- a/net/rds/cong.c
> +++ b/net/rds/cong.c
> @@ -221,7 +221,21 @@ void rds_cong_queue_updates(struct rds_cong_map *map)
> list_for_each_entry(conn, &map->m_conn_list, c_map_item) {
> if (!test_and_set_bit(0, &conn->c_map_queued)) {
> rds_stats_inc(s_cong_update_queued);
> - rds_send_xmit(conn);
> + /* We cannot inline the call to rds_send_xmit() here
> + * for two reasons:
> + * 1. When we get here from the receive path, we
> + * are already holding the sock_lock (held by
> + * tcp_v4_rcv()). So inlining calls to
> + * tcp_setsockopt and/or tcp_sendmsg will deadlock
> + * when it tries to get the sock_lock())
> + * 2. Interrupts are masked so that we can mark the
> + * the port congested from both send and recv paths.
> + * (See comment around declaration of rds_cong_lock).
> + * An attempt to get the sock_lock() here will
> + * therefore trigger warnings.
> + * Defer the xmit to rds_send_worker() instead.
> + */
> + queue_delayed_work(rds_wq, &conn->c_send_w, 0);
> }
> }
>
> --
> 1.7.1
>
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rds: rds_cong_queue_updates needs to defer the congestion update transmission
2015-02-10 16:50 ` Chuck Lever
@ 2015-02-10 16:56 ` Sowmini Varadhan
0 siblings, 0 replies; 3+ messages in thread
From: Sowmini Varadhan @ 2015-02-10 16:56 UTC (permalink / raw)
To: Chuck Lever; +Cc: Chien Yen, davem, rds-devel, netdev, linux-kernel
On (02/10/15 11:50), Chuck Lever wrote:
> >
> > This patch fixes a sock_lock deadlock in the rds_cong_queue_update path.
>
> Note that the deadlock appears to exist only with TCP transports.
>
True, but the patch does no harm to IB: this actually only reverts
the change from commit 2fa57129d.
I could update the comment to note that this is only true for TCP
transports. Do you think that would help?
--Sowmini
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-10 16:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10 14:22 [PATCH] rds: rds_cong_queue_updates needs to defer the congestion update transmission Sowmini Varadhan
2015-02-10 16:50 ` Chuck Lever
2015-02-10 16:56 ` Sowmini Varadhan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).