Repository navigation
Conversation
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
There was a problem hiding this comment.
The gate needs to be closed in the specific shard where it is used, otherwise the same old issue could happen, right?
There was a problem hiding this comment.
I don't think so, as soon as you created the gate, you need to close it anyway, you can't close it more then one time, but you have to close it so the gate and holder will be destroyed later on and the debug gated will work and count the gates
There was a problem hiding this comment.
Yeah, the gates need to be closed.
I meant the specific gate should be closed in the shard where it is used in dispatch(). For example, gates[4] is used in shard 4, so it should be closed also in shard 4, because close() will access the internal _count which shouldn't be safe from a different shard.
There was a problem hiding this comment.
@cyx1231st we will close the gates only when osd is prepared to stop, so the gates remain open, then we are closing all the gates, for each shard we will call its close. is that what you mean? or I'm missing your point?
There was a problem hiding this comment.
Correct, inside parallel_for_each(), refer to seastar::smp::submit_to(core, fn) about how to run logic in a specific shard.
There was a problem hiding this comment.
@Matan-B now it is. took me some time to get it
There was a problem hiding this comment.
Correct, inside
parallel_for_each(), refer toseastar::smp::submit_to(core, fn)about how to run logic in a specific shard.
@cyx1231st please let me know if that's what you meant (I changed close_all)
There was a problem hiding this comment.
I think that you got it right with submit_to usage in close_all. Why did you drop parallel_for_each usage?
There was a problem hiding this comment.
In case the reason was to use the index of the loop as shard id, we can introduce get_shard_id() for Gated.
There was a problem hiding this comment.
@NitzanMordhai Yes, looks good to me now. Feel free to reach me (Yingxin) in slack if my comment isn't clear in the future.
Regarding to parallel_for_each, and to make code cleaner, probably the following seastar document is useful:
/// \note parallel_for_each() schedules all invocations of \c func on the
/// current shard. If you want to run a function on all shards in parallel,
/// have a look at \ref smp::invoke_on_all() instead.
c0c2021 to
3842333
Compare
cyx1231st
left a comment
There was a problem hiding this comment.
Approve except for the comments.
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Matan-B
left a comment
There was a problem hiding this comment.
lgtm! Last comments. Seastar submodule should be rebased
There was a problem hiding this comment.
I think we can remove set_shard_id and set the shard_id only in the ctor
There was a problem hiding this comment.
we are setting it during the ctor of gate_per_shard:
gate_per_shard() : gates(seastar::smp::count) {
for (unsigned shard = 0; shard < seastar::smp::count; ++shard) {
gates[shard].set_shard_id(shard);
}
}
There was a problem hiding this comment.
I meant that this should not compile now as sid is const.
There was a problem hiding this comment.
assert(seastar::this_shard_id() == sid);
Shard id is printed in each log line, we can simply mention "closing gate" after the assert above.
There was a problem hiding this comment.
I can't find the assertion in the new commit.
There was a problem hiding this comment.
@cyx1231st asserting during close will cause some issues with io_handle, we are doing close of prev sid (cleanup_prv_shard) and trying to close the gate on a different shard it was created on. checking that
There was a problem hiding this comment.
@cyx1231st do you have any opinion on io_handler, do you think it should be changed as well to use gate_per_shard?
it should run on each core, but currently using single gate
I think not, io_handler can only run on a single core (it is owned by Connection living on one core as well). However, it (as well as Connection) may switch cores due to connection recovery (which is a complicated mechanism).
Probably there were some unexpected issues revealed by adding Gated::sid asserts in this PR. But I believe it shouldn't use gate_per_shard for the reasons.
There was a problem hiding this comment.
See IOHandler::cleanup_prv_shard(prv_sid):
ceph/src/crimson/net/io_handler.cc
Lines 656 to 664 in dc8d75f
Looks to me this part is correct, because the logic is submitted to prv_sid in calling prv_states.close(), and prv_states (containing the gate) is destructed inside prv_sid as well.
There was a problem hiding this comment.
However, it seems to be an issue when switch to a new core
ceph/src/crimson/net/io_handler.cc
Lines 734 to 735 in dc8d75f
^ The new shard_states (and shard_states_t::gate) isn't created by the new shard new_sid where it will be used.
A potential fix might be introducing another constructor for Gated to specify sid where it will be used, so that:
ceph/src/crimson/net/io_handler.h
Lines 257 to 258 in dc8d75f
can be modified as:
shard_states_t(seastar::shard_id _sid, io_state_t state)
: sid{_sid}, io_state{state}, gate{_sid} {} // allow gate to be constructed by one sid, and used by another sidIf this looks reasonable, can you have a try to see whether it works?
Matan-B
left a comment
There was a problem hiding this comment.
wip-nitzan-seastar-enable-gate-debug branch should be rebased
There was a problem hiding this comment.
I meant that this should not compile now as sid is const.
|
@cyx1231st do you have any opinion on io_handler, do you think it should be changed as well to use gate_per_shard? |
|
The commit that made the change in seastar submodule was removed |
There was a problem hiding this comment.
Nit, seems smp::invoke_on_all() is a better choice in this case. Up to you, though.
There was a problem hiding this comment.
@cyx1231st if i'm using smp::invoke_on_all i'll need to loop over all the gates vector to find the one with the same shard_id and for that only to call the close, unlike the parallel for each and submit_to
Matan-B
left a comment
There was a problem hiding this comment.
Allowing to construct gates from shards different from the ones they are being used on can open a "gate" for more unexpectancies. I would suggest to assert the this_shard is same as sid in all of the relevant methods.
Moreover, this should also be a separate commit as it's not related to gate_per_shard, and is only a side effect of the added assertion, right?
Note that makecheck fails due to the new submodule branch not pushed to remote.
|
I commented few of the new ceph_assert that check for shard id and added https://tracker.ceph.com/issues/67773 |
This change modifies AlienStore and OSD to use a gate per seastar shard instead of a shared gate. It introduces a new `gate_per_shard` class in `Gated` to manage a vector of gates, ensuring proper gate handling across shards. Fixes: https://tracker.ceph.com/issues/64332 Signed-off-by: NitzanMordhai <[email protected]>
seastar submodule - rebasing seastar to branc wip-nitzan-gate-re-enable-gate https://github.com/ceph/seastar/tree/wip-nitzan-gate-re-enable-gate Fixes: https://tracker.ceph.com/issues/64332 Signed-off-by: NitzanMordhai <[email protected]>
Matan-B
left a comment
There was a problem hiding this comment.
@cyx1231st, can you take a final look at the last commit?
There was a problem hiding this comment.
Is io_handler still related to this violation?
There was a problem hiding this comment.
@cyx1231st Yes, but I'm not sure if it's the only one, I ran some local tests and found out it failed for io_handler, but it can be in other cases, that's the reason I opened a new tracker and commented those added asserts
There was a problem hiding this comment.
OK, please let me know if io_handler still breaks after 4f77386
|
jenkins test signed |
|
jenkins test api |
IOHandler::to_new_sid provides a mechanism to switch to a new core from the current one used. This behavior is tricky for making sure that we keep the IOHandler::shard_states_t::gate instance to be used on the same core that it was created. In order to resolve this, we should be able to construct Gated out of specified core_id (and not from this_shard_id). See: ceph#58986 (comment) Signed-off-by: NitzanMordhai <[email protected]>
After adding sid (shard ID) to Gated, each shard should have its own gate. However, some users of Gated had a single instance, which either failed these assertions or created the Gated object on the wrong shard. A tracker issue ceph#67773 was opened for this, and this commit comments out the assertions until the issue is resolved. Signed-off-by: NitzanMordhai <[email protected]>
|
@Matan-B tests suite: https://pulpito.ceph.com/nmordech-2024-09-09_04:25:13-crimson-rados-wip-nitzan-crimson-op_gate-alianstore-multi-core-distro-crimson-smithi/ 2 unrelated issues: |
Can you please reference the trackers next time if the issues are known? Thanks! What does testing issue mean? The crash looks meaningful: |
|
@Matan-B I re-run the suite, and the assertion in RadosModel didn't happen again, I ran it against main as well, and it didn't appear there either. |
|
Thank you for the additional check! Merging |
This change modifies AlienStore and OSD to use a gate per seastar
shard instead of a shared gate.
It introduces a new
gate_per_shardclass inGatedto managea vector of gates, ensuring proper gate handling across shards.
Fixes: https://tracker.ceph.com/issues/64332
Signed-off-by: NitzanMordhai [email protected]
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. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.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 windowsjenkins test rook e2e