aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/ib_cm.c
diff options
context:
space:
mode:
authorGerd Rausch <gerd.rausch@oracle.com>2019-07-16 18:29:17 -0400
committerDavid S. Miller <davem@davemloft.net>2019-07-17 15:06:52 -0400
commit3a2886cca703fde5ee21baea9fedf8b1389c59d7 (patch)
treeebeffb5e2ef043aa46be9929db3a466466df50ce /net/rds/ib_cm.c
parent9547dff1085d5935d6070377023096821033e30c (diff)
net/rds: Keep track of and wait for FRWR segments in use upon shutdown
Since "rds_ib_free_frmr" and "rds_ib_free_frmr_list" simply put the FRMR memory segments on the "drop_list" or "free_list", and it is the job of "rds_ib_flush_mr_pool" to reap those entries by ultimately issuing a "IB_WR_LOCAL_INV" work-request, we need to trigger and then wait for all those memory segments attached to a particular connection to be fully released before we can move on to release the QP, CQ, etc. So we make "rds_ib_conn_path_shutdown" wait for one more atomic_t called "i_fastreg_inuse_count" that keeps track of how many FRWR memory segments are out there marked "FRMR_IS_INUSE" (and also wake_up rds_ib_ring_empty_wait, as they go away). Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/ib_cm.c')
-rw-r--r--net/rds/ib_cm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 8891822eba4f..1b6fd6c8b12b 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -40,6 +40,7 @@
40#include "rds_single_path.h" 40#include "rds_single_path.h"
41#include "rds.h" 41#include "rds.h"
42#include "ib.h" 42#include "ib.h"
43#include "ib_mr.h"
43 44
44/* 45/*
45 * Set the selected protocol version 46 * Set the selected protocol version
@@ -993,6 +994,11 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
993 ic->i_cm_id, err); 994 ic->i_cm_id, err);
994 } 995 }
995 996
997 /* kick off "flush_worker" for all pools in order to reap
998 * all FRMR registrations that are still marked "FRMR_IS_INUSE"
999 */
1000 rds_ib_flush_mrs();
1001
996 /* 1002 /*
997 * We want to wait for tx and rx completion to finish 1003 * We want to wait for tx and rx completion to finish
998 * before we tear down the connection, but we have to be 1004 * before we tear down the connection, but we have to be
@@ -1005,6 +1011,7 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
1005 wait_event(rds_ib_ring_empty_wait, 1011 wait_event(rds_ib_ring_empty_wait,
1006 rds_ib_ring_empty(&ic->i_recv_ring) && 1012 rds_ib_ring_empty(&ic->i_recv_ring) &&
1007 (atomic_read(&ic->i_signaled_sends) == 0) && 1013 (atomic_read(&ic->i_signaled_sends) == 0) &&
1014 (atomic_read(&ic->i_fastreg_inuse_count) == 0) &&
1008 (atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR)); 1015 (atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR));
1009 tasklet_kill(&ic->i_send_tasklet); 1016 tasklet_kill(&ic->i_send_tasklet);
1010 tasklet_kill(&ic->i_recv_tasklet); 1017 tasklet_kill(&ic->i_recv_tasklet);