Skip to content

crimson/net: change ConnectionRef to be a local_shared_foreign_ptr - #50835

Merged
athanatos merged 5 commits into
ceph:mainfrom
cyx1231st:wip-seastar-adjust-conn-ref
Apr 20, 2023
Merged

athanatos merged 5 commits into
ceph:mainfrom
cyx1231st:wip-seastar-adjust-conn-ref

Conversation

@cyx1231st

@cyx1231st cyx1231st commented Apr 3, 2023 •

Copy link
Copy Markdown
Member

Make it possible for connections and messages to be dispatched in
arbitrary core without asynchronous foreign copy.

The local_shared_foreign_ptr conn cannot be moved (with Message) to another core
implicitly, maintain it outside Message independently.

Do asynchronous foreign copy to the new ConnectionRef only in
with_remote_shard_state_and_op().

TODO: validate in CI.

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@cyx1231st

Copy link
Copy Markdown
Member Author

Crimson test suite detects that Message::get_connection() is used, fix by 00bb462

@cyx1231st

Copy link
Copy Markdown
Member Author

@athanatos athanatos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable

Make ptr nullable and add necessary operators.

Signed-off-by: Yingxin Cheng <[email protected]>
Make it possible for connections and messages to be dispatched in
arbitrary core without asynchronous foreign copy.

The local_shared_foreign_ptr conn cannot be moved to another core
implicitly, maintain it outside Message independently.

Do asynchronous foreign copy to the new ConnectionRef only in
with_remote_shard_state_and_op().

Signed-off-by: Yingxin Cheng <[email protected]>
@cyx1231st
cyx1231st force-pushed the wip-seastar-adjust-conn-ref branch from 00bb462 to ebda490 Compare April 14, 2023 05:46
@cyx1231st

Copy link
Copy Markdown
Member Author

changeset:

  • make local_shared_foreign_ptr::ptr nullable with reset(): f96ae0b

get_local_state().registry.remove_from_registry(*op);
return with_remote_shard_state(
core,
[op=std::move(op)](

@cyx1231st cyx1231st Apr 19, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although T::IRef is a boost::intrusive_ptr, looks it works like unique-ptr with ceph_assert(op->use_count() == 1) above.

However, this still looks tricky to move the op to another core directly, it seems to result in allocating the op in one core and deallocate it in a different core, which should be wrong but I don't know why there is no visible failure.

Same applies to other unique-ptrs that may be owned by a different core, for example MessageURef should be a foreign-ptr.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that make me confused also.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see that seastar allocator can recognize and handle foreign free internally. So it is fine.

@athanatos
athanatos merged commit 49bd470 into ceph:main Apr 20, 2023
conn.shared_from_this());
Message *message = decode_message(nullptr, 0, header, footer,
msg_frame.front(), msg_frame.middle(), msg_frame.data(), conn_ref);
msg_frame.front(), msg_frame.middle(), msg_frame.data(), nullptr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why here set nullptr?

@cyx1231st cyx1231st Apr 21, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

message and the new connection-ref have different core ownership, so decouple them and maintain them in crimson OSD independently.

@cyx1231st
cyx1231st deleted the wip-seastar-adjust-conn-ref branch April 21, 2023 02:55
yuvalif pushed a commit to yuvalif/ceph that referenced this pull request Apr 30, 2023
crimson/net: change ConnectionRef to be a local_shared_foreign_ptr

Reviewed-by: Samuel Just <[email protected]>
Matan-B added a commit to Matan-B/ceph that referenced this pull request May 3, 2023
See ceph#50835.
In crimson, conn is independently maintained outside Message.
Therefore, when trying to use the message's connection for
`get_orig_source_inst()` we won't be able to get the peer address.

Fixes: https://tracker.ceph.com/issues/59589

Signed-off-by: Matan Breizman <[email protected]>
Matan-B added a commit to Matan-B/ceph that referenced this pull request May 7, 2023
See ceph#50835.
In crimson, conn is independently maintained outside Message.
Therefore, when trying to use the message's connection for `get_peer_addr()`
we won't be able to get the peer address.

Signed-off-by: Matan Breizman <[email protected]>
Matan-B added a commit to Matan-B/ceph that referenced this pull request May 8, 2023
In continuation to: ceph#50835
Do not include Crimson's SocketConnection in Message header.

Signed-off-by: Matan Breizman <[email protected]>
Matan-B added a commit to Matan-B/ceph that referenced this pull request May 23, 2023
See ceph#50835.
In crimson, conn is independently maintained outside Message.
Therefore, when trying to use the message's connection for `get_peer_addr()`
we won't be able to get the peer address.

Signed-off-by: Matan Breizman <[email protected]>
(cherry picked from commit 9c1531c)
Matan-B added a commit to Matan-B/ceph that referenced this pull request May 23, 2023
See ceph#50835.
In crimson, conn is independently maintained outside Message.
Therefore, when trying to use the message's connection for
`get_orig_source_inst()` we won't be able to get the peer address.

Fixes: https://tracker.ceph.com/issues/59589

Signed-off-by: Matan Breizman <[email protected]>
(cherry picked from commit d569703)
rsacherer pushed a commit to rsacherer/ceph that referenced this pull request May 26, 2023
In continuation to: ceph#50835
Do not include Crimson's SocketConnection in Message header.

Signed-off-by: Matan Breizman <[email protected]>
joscollin pushed a commit to joscollin/ceph that referenced this pull request Jul 31, 2023
In continuation to: ceph#50835
Do not include Crimson's SocketConnection in Message header.

Signed-off-by: Matan Breizman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants