Re: [PATCH net v7 2/3] net/smc: bound the peer rkey counts in SMC-Rv2 LLC messages
From: Yehyeong Lee
Date: Thu Nov 19 2026 - 05:53:31 EST
Three of the points above are about code this series did not add. Where
they stand on current mainline:
- The memcpy() into lgr->wr_rx_buf_v2 is gone. 3/3 made
smc_llc_rmt_delete_rkey() read the queue entry instead, and nothing on
the CPU writes to that buffer any more.
- The v2 spillover buffer is still shared by every receive WR of the
link group. 3/3 narrowed the window to the copy in
smc_llc_rx_handler(), but if two LLC messages with extensions arrive
before the receive tasklet runs, the first one's tail can already be
overwritten by the second when it is copied. The result is the wrong
rkeys being processed for the same peer; the copy stays inside the
8 KiB buffer. Closing it needs a spillover buffer per WR or per link,
which gives back the memory 27ef6a9981fe saved, so I am leaving that
decision to you.
- smc_rtoken_delete() runs without rmbs_lock, and so do smc_rtoken_add()
and smc_rtoken_set2() in smc_llc_rmt_conf_rkey() and smc_rtoken_add()
on the CLC path; only the three smc_rtoken_set() callers take it. As
far as I can tell from smc_llc_flow_start(), a remote DELETE_RKEY flow
is not held back by a local ADD_LINK flow, so it can clear an rtoken
slot while smc_llc_save_add_link_rkeys() is filling that table. The
rtokens are a fixed array, so this ends in a lost or mismatched rkey
rather than a memory error. Taking the lock in the LLC event path is
not a one-line change either: smc_llc_cli_rkey_exchange() and
smc_llc_srv_rkey_exchange() hold it for writing across smc_llc_wait().
Best regards,
Yehyeong Lee