Skip to contentSkip to conversation

net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error

PATCH Superseded D. Wythe 2 participants 5 messages Mar 1, 2022 – Mar 2, 2022

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

D. Wythe

author maintainer
#0 lore raw

PATCH 1/1 net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error

From: "D. Wythe" <[email protected]>

Remove connections from link group is not synchronous with handling SMC_LLC_DELETE_RKEY, which means that even the number of connections is less that SMC_RMBS_PER_LGR_MAX, it does not mean that the connection can register rtoken successfully later, in other words, the rtoken entry may have not been released. This will cause an unexpected SMC_CLC_DECL_ERR_REGRMB to be reported, and then ths smc connection have to fallback to TCP.

We found that the main reason for the problem dues to following execution sequence:

Server Conn A: Server Conn B: Client Conn B:

smc_lgr_unregister_conn

                        smc_lgr_register_conn
                        smc_clc_send_accept     ->
                                                        smc_rtoken_add
smcr_buf_unuse
		->		Client Conn A:
				smc_rtoken_delete

smc_lgr_unregister_conn() makes current link available to assigned to new incoming connection, while smcr_buf_unuse() has not executed yet, which means that smc_rtoken_add may fail because of insufficient rtoken_entry, reversing their execution order will avoid this problem.

Fixes 3e034725c0d8 ("net/smc: common functions for RMBs and send buffers")
---
 net/smc/smc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_core.c +1 -1
index 2f321d2..c9c3a68 100644
@@ -1161,8 +1161,8 @@ void smc_conn_free(struct smc_connection *conn)
 			cancel_work_sync(&conn->abort_work);
 	}
 	if (!list_empty(&lgr->list)) {
-		smc_lgr_unregister_conn(conn);
 		smc_buf_unuse(conn, lgr); /* allow buffer reuse */
+		smc_lgr_unregister_conn(conn);
 	}
 
 	if (!lgr->conns_num)
Signature · 1 line
1.8.3.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · D. Wythe

From: "D. Wythe" <[email protected]>

Remove connections from link group is not synchronous with handling SMC_LLC_DELETE_RKEY, which means that even the number of connections is less that SMC_RMBS_PER_LGR_MAX, it does not mean that the connection can register rtoken successfully later, in other words, the rtoken entry may have not been released. This will cause an unexpected SMC_CLC_DECL_ERR_REGRMB to be reported, and then ths smc connection have to fallback to TCP.

IMHO, if there are SMC_RMBS_PER_LGR_MAX connections in the link group now, one of them is being removed and here comes a new connection at this moment, then:

(1) without this patch, the new connection will be added into the old link group but fallback if the removing connection has not finished unregistering its rmb.

(2) with this patch, a new link group will be created and the new connection will be added into the new link group.

I am wondering if (1) should be considered as a issue, or just a bydesign? If it is a issue, I think this patch works, Thanks!

Best Regards,
Wen Gu

author maintainer
#2 lore raw
Quoted 19 lines · Wen Gu
Quoted 10 lines · D. Wythe

From: "D. Wythe" <[email protected]>

Remove connections from link group is not synchronous with handling SMC_LLC_DELETE_RKEY, which means that even the number of connections is less that SMC_RMBS_PER_LGR_MAX, it does not mean that the connection can register rtoken successfully later, in other words, the rtoken entry may have not been released. This will cause an unexpected SMC_CLC_DECL_ERR_REGRMB to be reported, and then ths smc connection have to fallback to TCP.

IMHO, if there are SMC_RMBS_PER_LGR_MAX connections in the link group now, one of them is being removed and here comes a new connection at this moment, then:

Quoted 8 lines

(1) without this patch, the new connection will be added into the old link group but fallback if the removing connection has not finished unregistering its rmb.

(2) with this patch, a new link group will be created and the new connection will be added into the new link group.

I am wondering if (1) should be considered as a issue, or just a bydesign? If it is a issue, I think this patch works, Thanks!

We should always be willing to improve the success rate of the SMC connection, creating a new group is not a side effect of this patch, it actually dues to the state bewteen connections that can not achieve clock synchronization. In fact, it can happen in any times.

Thanks.

reviewer
#3 lore raw
Quoted 6 lines · D. Wythe

We should always be willing to improve the success rate of the SMC connection, creating a new group is not a side effect of this patch, it actually dues to the state bewteen connections that can not achieve clock synchronization. In fact, it can happen in any times.

Thanks.

OK, I understand. Thanks.

author maintainer
#4 lore raw
In reply to D. Wythe
Quoted 39 lines · D. Wythe

From: "D. Wythe" <[email protected]>

Remove connections from link group is not synchronous with handling SMC_LLC_DELETE_RKEY, which means that even the number of connections is less that SMC_RMBS_PER_LGR_MAX, it does not mean that the connection can register rtoken successfully later, in other words, the rtoken entry may have not been released. This will cause an unexpected SMC_CLC_DECL_ERR_REGRMB to be reported, and then ths smc connection have to fallback to TCP.

We found that the main reason for the problem dues to following execution sequence:

Server Conn A: Server Conn B: Client Conn B:

smc_lgr_unregister_conn

                         smc_lgr_register_conn
                         smc_clc_send_accept     ->
                                                         smc_rtoken_add
smcr_buf_unuse
		->		Client Conn A:
				smc_rtoken_delete

smc_lgr_unregister_conn() makes current link available to assigned to new incoming connection, while smcr_buf_unuse() has not executed yet, which means that smc_rtoken_add may fail because of insufficient rtoken_entry, reversing their execution order will avoid this problem.

Fixes 3e034725c0d8 ("net/smc: common functions for RMBs and send buffers")
---
  net/smc/smc_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_core.c +0 -0
index 2f321d2..c9c3a68 100644

net/smc/smc_core.c void smc_conn_free(struct smc_connection *conn) · line 1168

Quoted 9 lines
net/smc/smc_core.c +1 -1
@@ -1161,8 +1161,8 @@ void smc_conn_free(struct smc_connection *conn)
  			cancel_work_sync(&conn->abort_work);
  	}
  	if (!list_empty(&lgr->list)) {
-		smc_lgr_unregister_conn(conn);
  		smc_buf_unuse(conn, lgr); /* allow buffer reuse */
+		smc_lgr_unregister_conn(conn);
  	}
 
  	if (!lgr->conns_num)

I have two patch for this issue, and i missed one, I'll post it in v2 series.