[Bugfix][TE] Respect remote_accessible in RDMA verbs MR registration - #3151
Conversation
dd2ae23 to
fa0797e
Compare
staryxchen
left a comment
There was a problem hiding this comment.
- Protocol coverage — Metadata filtering only skips empty rkey when protocol == "rdma", while barex / efa / cxi share the same encode path but are not filtered. EFA/CXI also still ignore remote_accessible. Is this PR intentionally RDMA-only?
- PR title — The title looks concatenated (...registrationFix/rdma...); worth cleaning up before merge.
Thanks for the review! Protocol coverage——Yes, this PR is intentionally scoped to RDMA verbs MR registration, as it addresses an immediate requirement in Broadcom RDMA NIC environment. I will follow up with EFA / CXI / barex support in a separate PR. |
fa0797e to
74ef3a1
Compare
74ef3a1 to
af950e9
Compare
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
staryxchen
left a comment
There was a problem hiding this comment.
LGTM
@alogfans pls double chck
alogfans
left a comment
There was a problem hiding this comment.
Overall LGTM. However, when the peer side rejects this memory region, it should print to log clearly about this to avoid slient bugs.
af950e9 to
c719721
Compare
Added an explicit error log |
alogfans
left a comment
There was a problem hiding this comment.
Instead of omitting local-only RDMA buffers from the segment metadata, could we keep their address ranges registered and explicitly mark them, while leaving the rkey unavailable? This allows the peer to reject such regions deterministically and distinguish them from missing or stale metadata, reducing the risk of accidental fallback or misuse.
c719721 to
73dd7d7
Compare
Agreed! Updated to preserve local-only buffers in metadata with an empty rkey list ([]). Peers can now match the address range and fail with error |
73dd7d7 to
c076a14
Compare
c076a14 to
a94a212
Compare
Signed-off-by: Ruiqing Feng <ruiqing.feng@broadcom.com>
RdmaTransport::registerLocalMemoryInternal() previously discarded the `remote_accessible` argument and unconditionally requested remote read and write permissions (IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_WRITE). This violated the API contract and exposed local-only memory to remote peers. Fix this issue with the following changes: 1. Only grant IBV_ACCESS_REMOTE_* rights when remote_accessible is true. When false, register with IBV_ACCESS_LOCAL_WRITE only and leave the rkey vector empty. 2. Filter out RDMA buffers with empty rkey vectors during metadata encoding so local-only memory is not advertised across the network. 3. Add bounds checks for buffer_id and device_id against the rkey array size in selectPeerDevice() to safely handle local-only memory selection. Signed-off-by: Ruiqing Feng <ruiqing.feng@broadcom.com>
Signed-off-by: Ruiqing Feng <ruiqing.feng@broadcom.com>
- Print kernel-style error log in selectPeerDevice() when rkey is missing - Remove unused buffer_desc variable in registerLocalMemoryInternal() Signed-off-by: Ruiqing Feng <ruiqing.feng@broadcom.com>
Keep local-only RDMA buffers in segment metadata so peers match address ranges deterministically and fail without metadata reloads. Signed-off-by: Ruiqing Feng <ruiqing.feng@broadcom.com>
Description
RdmaTransport::registerLocalMemoryInternal()previously discarded theremote_accessibleargument ((void)remote_accessible;) and unconditionally granted remote read/write permissions (IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_WRITE). This violated the API contract and exposed local-only memory to remote peers.This PR fixes the issue by:
IBV_ACCESS_REMOTE_*permissions only whenremote_accessibleis true. Whenfalse, registers withIBV_ACCESS_LOCAL_WRITEonly and leaves therkeyvector empty.rkeyvectors during metadata encoding so local-only memory is not advertised across the network.selectPeerDevice()forbuffer_idanddevice_idagainst therkeyarray size to prevent out-of-bounds indexing on local-only memory.Module
mooncake-transfer-engine)mooncake-store)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Added unit tests in
rdma_context_reprobe_test.cppandtransfer_metadata_test.cpp:RdmaMemoryRegistrationPolicyTest.LocalOnlyBufferHasNoPublishedRkey: Verifies that registering local memory withremote_accessible=falsekeeps itsrkeyempty.TransferMetadataPublicationTest.OmitsBufferWithoutRkey: Verifies that buffers with emptyrkeys are excluded when encoding P2P segment descriptions for network transfer.Test commands: