Repository navigation
Crimson/osd: support multicore osd - #51147
Conversation
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
cfae875 to
87de13f
Compare
6368a8a to
a6e9e12
Compare
|
jenkins test make check |
There was a problem hiding this comment.
conn.get_foreign() cannot guarantee the ordering here, so it may not be caused by invoke_on().
If invoke_on() or smp::submit_to() cannot guarantee fifo in the submitted shard, it would be a larger issue. We probably need to scan all the places that is using them.
There was a problem hiding this comment.
I just took a quick look at the smp::submit_to() implementation, looks it is operating a pending_fifo queue explicitly, which strongly implies that it enforces fifo.
So I don't think it worths protecting invoke_on() or smp::submit_to() with additional cross-core unlock mechanisms.
@athanatos @liu-chunmei what do you think?
There was a problem hiding this comment.
Seems reasonable to me, leave a comment though.
There was a problem hiding this comment.
seems I only need to guarantee conn.get_foreign() ordering, will modify it.
There was a problem hiding this comment.
@athanatos @cyx1231st if I only add mutex to guarantee conn.get_foreign() order, still has out-of-ordering problem. see below PR, still has out-of-ordering issue.
+ return op_mutex.lock().then([=, this] {
+ return conn.get_foreign().then([this, m = std::move(m),
+ core = insert_iter->second](auto f_conn) {
+ op_mutex.unlock();
+ return shard_dispatchers.invoke_on(core,
+ [f_conn = std::move(f_conn), m = std::move(m)]
+ (auto &local_dispatcher) mutable ->seastar::future<>{
+ return local_dispatcher.ms_dispatch(std::move(f_conn), m);
+ });
There was a problem hiding this comment.
I got this ordering with only lock conn.get_foreign, the same problem as without any lock here.
primary core ms_dispatch sequence
---osd::ms_dispatch version = 0'0---reqid = 11735
---osd::ms_dispatch version = 0'0---reqid = 11736
shardDispatcher: handle_rep_op seqeunce
---osd::handle_rep_op version = 19'98---reqid = 11736---shard id = 1
---osd::handle_rep_op version = 19'97---reqid = 11735---shard id = 1
There was a problem hiding this comment.
print location:
in osd::ms_dispatch:
switch (m->get_type()) {
+ case MSG_OSD_REPOP:
+std::cout<<"---osd::ms_dispatch version = "<<boost::static_pointer_cast<MOSDRepOp>(m)->version<<"---reqid = "<<boost::static_pointer_cast<MOSDRepOp>(m)->reqid.tid<<std::endl;
+ [[fallthrough]];
OSD::ShardDispatcher::handle_rep_op(
m->finish_decode();
+std::cout<<"---osd::handle_rep_op version = "<<m->version<<"---reqid = "<<m->reqid.tid<<"---shard id = "<<seastar::this_shard_id()<<std::endl;
std::ignore = pg_shard_manager.start_pg_operation<RepRequest>(
std::move(conn),
std::move(m));
There was a problem hiding this comment.
There is a semaphore in invoke_on()/submit_to(), which cannot grarantee the FIFO order at wait(), quoted "Waits are serviced in FIFO order, though if several are awakened at once, they may be reordered by the scheduler."
So we shouldn't expect the target core gets called in the same order. I have also observed the same issue during multi-core messenger testing, which needs to be addressed separately.
Another impact is that we need to chain the future returned by Connection::send() wherever there is an ordering requirement.
5802917 to
aee4729
Compare
|
without mutlicore-osd PR: ci test result: https://pulpito.ceph.com/yingxin-2023-05-31_07:43:42-crimson-rados-wip-chunmei-multicore-os-crimson-only-distro-default-smithi/ |
|
jenkins test make check |
aee4729 to
d71df60
Compare
|
@athanatos updated, please review again. |
d71df60 to
a5290c6
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Signed-off-by: chunmei <[email protected]>
Previously, all accesses (incuding loookups) had to occur on core 0. Now that we want to be able to dispatch from all cores, we need PGShardManager to be accessible from all cores. To that end, we now proxy updates to core 0, but maintain local copies of the map so that cores can perform local lookups. Signed-off-by: chunmei <[email protected]>
… on PRIMARY_CORE Proxy uses of osd_singleton_state to PRIMARY_CORE as needed. Signed-off-by: chunmei <[email protected]>
Shortly, we will need to be able to pass a ConnectionRef from another core. Signed-off-by: chunmei <[email protected]>
put them into PerShardState to avoid cross core calling for normal cases. Signed-off-by: chunmei <[email protected]>
in debug build, if wait_barrier is seastar::now, will cause reactor schedule the following continuation away, but can't schedule them back in the same order as by which they are scheduled away, so the continuations are out of order here. Signed-off-by: chunmei <[email protected]>
Signed-off-by: chunmei <[email protected]>
a5290c6 to
00a5eae
Compare
|
@athanatos updated, please review again. |
|
main branch + this PR + #51916 + the following modification, can do multicore-osd-msg-seastore testing. |
|
I'll kick off a test run in the next few hours (branch wip-sjust-crimson-multicore-testing-2023-06-28) |
cyx1231st
left a comment
There was a problem hiding this comment.
Comments and questions towards really enabling multi-core message dispatching.
| return container().invoke_on(0,[pgid, core] | ||
| (auto &primary_mapping) { | ||
| auto [insert_iter, inserted] = primary_mapping.pg_to_core.emplace(pgid, core); | ||
| ceph_assert_always(inserted); |
There was a problem hiding this comment.
Why is it true that multiple shards won't create the same pgid at the same time? Same for remove_pg().
There was a problem hiding this comment.
| case MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY: | ||
| { | ||
| return conn.get_foreign().then([this, m = std::move(m)](auto f_conn) { | ||
| return shard_dispatchers.local().ms_dispatch(std::move(f_conn), std::move(m)); |
There was a problem hiding this comment.
Local dispatching doesn't need a foreign copy, the asynchronous foreign copy can also reorder the message unexpectedly. Fixed in #52306
| default: | ||
| dispatched = false; | ||
| return seastar::now(); | ||
| return container().invoke_on(PRIMARY_CORE, |
There was a problem hiding this comment.
The message may be reordered at cross-core invoke, will it be a problem ?
Added FIXME comment in #52306
based on multicore-seastore : #48717
based on local_shared_foreign_ptr : #50835
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows