net/rds: Keep track of and wait for FRWR segments in use upon shutdown
Subsystems (3)
PATCH 6/7 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).
--- net/rds/ib.h | 1 + net/rds/ib_cm.c | 7 +++++++ net/rds/ib_frmr.c | 45 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 46 insertions(+), 7 deletions(-)
net/rds/ib.h +1 -0
@@ -156,6 +156,7 @@ struct rds_ib_connection {/* To control the number of wrs from fastreg */ atomic_t i_fastreg_wrs; +atomic_t i_fastreg_inuse_count;/* interrupt handling */ struct tasklet_struct i_send_tasklet;
net/rds/ib_cm.c +7 -0
@@ -40,6 +40,7 @@#include "rds_single_path.h" #include "rds.h" #include "ib.h" +#include "ib_mr.h" /* * Set the selected protocol version
@@ -993,6 +994,11 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp) ic->i_cm_id, err); } +/* kick off "flush_worker" for all pools in order to reap +* all FRMR registrations that are still marked "FRMR_IS_INUSE" +*/ +rds_ib_flush_mrs (); +/* * We want to wait for tx and rx completion to finish * 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)wait_event (rds_ib_ring_empty_wait,rds_ib_ring_empty (&ic->i_recv_ring) && (atomic_read (&ic->i_signaled_sends) ==0 ) && + (atomic_read (&ic->i_fastreg_inuse_count) ==0 ) && (atomic_read (&ic->i_fastreg_wrs) ==RDS_IB_DEFAULT_FR_WR ));tasklet_kill (&ic->i_send_tasklet);tasklet_kill (&ic->i_recv_tasklet);
net/rds/ib_frmr.c +38 -7
100 lines not on this page · raw message
Signature · 1 line
2.18.0
Quoted 8 lines · Gerd Rausch
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.
Quoted 7 lines
So we make "
rds_ib_conn_path_shutdown" wait for one moreatomic_tcalled "i_fastreg_inuse_count" that keeps track of how many FRWR memory segments are out there marked "FRMR_IS_INUSE" (and alsowake_uprds_ib_ring_empty_wait, as they go away).Signed-off-by Gerd Rausch <[email protected]>---
Looks good to me. Will add this to other fixes.