-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lkmm making rmw barriers explicit #865
Lkmm making rmw barriers explicit #865
Conversation
Do you really need all of those matches? It seems to me most of those are just identity now, e.g.,
would be
and
would be
|
I think this is not true. Otherwise, we would end up we |
Good point, I forgot about those. I would exclude those in the .bell, although perhaps there ought to be a way to either state what tags apply to each read/write or how to "decay" barriers where they don't belong - one could say that if one declares R[x,y,z] then every tag other than x y z on a R decays to x. |
It looks to me like what your are proposing here ends up in backward incompatible changes in herd7. Please note that you can not expect every existing out-of-tree CAT/BELL code be updated in sync with herd7. So I think you need to come up with a more considerate approach which won't need changes in existing code. Or am saying something unreasonable? |
It is true that if we change herd7, but the cat model is not updated, one gets different results.
Backward compatibility is probably a must for previous lkmm versions in the kernel, but I assume the changes in the cat model can be backported to all stable kernel versions since lkmm was introduced. My (probably naive) question is: do we really have a backward compatibility requirement for cat/bell code outside the kernel? Notice that lkmm has evolved since its first version and it definitely has changes that modify the expected results on some litmus tests. Thus, if you are using an old cat file, you anyway get "wrong" results. Wouldn't it be sufficient to have this backward incompatibility clearly documented somewhere? E.g., not sure if herd7 uses semantic versioning, but there are proper ways of documenting such kind of changes. |
There's two ways, one is to:
The other is not to update herd at all, and just hide its hardcoded behaviors as much as possible. In my opinion, all of this hardcoded behavior ought to be removed as soon as possible, independently of whether we add a fuller macro language and define the representations explicitly in .def, or change the representations and define analogous semantics in .cat and .bell. |
3a3d387
to
d462f13
Compare
The latest version of the code solves the backward compatibility mentioned by @akiyks. I added an option that allows to skip the hardcoded barriers, but by default herd7 still behaves the same. |
Thank you for taking your time for backward compatibility! That said, if I mistakenly put the Wouldn't it possible to put a version info somewhere in your new LKMM model, and make |
One possibility would be to implement the legacy mode as an "architecture variant" rather than as an option and then use something like this in the new model
Some arm models use something like this. Strictly speaking, this would not make herd7 to error out, but at least it would flag that the model is not being used as intended. |
The code is fully functional with the changes proposed in the LKML and backwards compatible by default. @maranget would you mind taking a look to this PR? |
e079617
to
c69b5de
Compare
There is a new patch series in the linux kernel mailing list depending on these changes. It would be great if somebody can take a look. |
Hi @hernanponcedeleon. I am willing to merge. Is the default behaviour still the intended one ? |
Thanks @maranget for taking a look. Can we wait a bit to see if someone requests changes on the patch series? If those need further changes in herd, I would prefer to have those integrated in this PR as a single commit.
Yes, this is to guarantee backwards compatibility with all versions of the model as requested by Akira. |
Ok, let us wait. I have checked that the PR does not impact C11 tests. Everything is fine. |
c69b5de
to
3987868
Compare
…xplicit Mb fences and adding noreturn tags Signed-off-by: Hernan Ponce de Leon <zeta96@gmail.com>
Yes. This works as expected against Jonas' v4 patch series at https://lore.kernel.org/lkmm/20240930105710.383284-1-jonas.oberhauser@huaweicloud.com/. @maranget, this should be good for merging. Thanks! |
…king-rmw-barriers-explicit' LKMM upgrade
Merged by hand, thanks @hernanponcedeleon, @akiyks, @JonasOberhauser. |
[LKMM] Fix regression of atomic_add_unless @akiyks noticed I introduced a regression in c0ce66d (PR #865). In the version previous to that commit, `atomic_add_unless` could be used even if not properly defined in the *.bell file. This PR restores the previous behavior, but it also allows to "redefine" the `atomic_add_unless` macro in the *.bell file.
This PR implements the changes discussed in [1,2]
The idea is to
I tested the changes using the scripts from the kernel (
tools/memory-model/scripts
) and I do get the expected results.I also added a test case showing that the first two cases alone are not enough and indeed the model needs to be updated.
I have a few open questions and thus the DRAFT status
mb
inRMW
instructions as mentioned in [3]? I would expect so, but I still get the correct results without this changeNOTE: the proposed changes in the cat file are not final. I just used one of the alternatives discussed in the mailing list.
[1] https://lkml.org/lkml/2024/4/4/1236
[2] https://lkml.org/lkml/2024/5/15/1026
[3] https://lkml.org/lkml/2024/5/21/357