-
Notifications
You must be signed in to change notification settings - Fork 67
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
Further "-variant self" changes #573
Conversation
20b9863
to
b63b5de
Compare
@artkhyzha can you rebase and clean this up, so we can have a look? IIUC, the change that adds CMODX seems ready for review. Then we have the options to either extend the set of instructions that can be ovewriten/can overwrite as per the two patches in this PR, or make them equal to the CMODX set, or get rid of the restriction altogether as we've discussed. What do you think would be best and not too challenging? |
@relokin, yes, will do this next. I wanted to finish trying out the (already initiated) idea for different treatment of DIC/IDC, which now seems to work, so back to cleaning up the changes before making next steps. I'll be revisiting the logic in AArch64Sem to see what the tradeoff is as per your question. |
9120a4b
to
3570310
Compare
Hi @relokin, @maranget -- if you have time, may I ask you to review the changes of this PR? I have just moved it out of draft. The PR description gives a brief motivation for each of the separate commits, but please let me know if any extra information (or changes) would help. Many thanks in advance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor comments otherwise LGTM!
Thanks for all the changes Artem, LGTM! Let's see if @maranget has any comments and then we can merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! I don't think I understand totally the magic that is happening here with the variants, and I don't know what cmodx is, but I have a few comments on ocaml
Note that this PR has a conflict with #599, but probably very minor.
Thank you for your feedback, @HadrienRenaud, it is very much appreciated! Looking at #599: yes, I agree it looks like a minor conflict, so shouldn't be too hard to rebase. (Happy to rebase or help out either way.) |
Looks great, thank you! For #599, we'll see what gets merged first and rebase the other :) |
56a5c7e
to
b38a5c8
Compare
Had this rebased w.r.t. master (and to clean up a few intermediate steps). |
In recent commits I simplified the support for DIC/IDC. These are parsed as global flags only. This allowed for a bit of refactoring, so the occurrences of |
Separately, I've realised that the rebasing against the master uncovered what might be a regression. Right now
However, writing UPD. Also, adding a line break into |
As a matter of a brief status update: the bug is localised in |
It turned out there was another bug. Or rather let's call it a subtlety. Consider the following litmus test:
The prefix of it serves no purpose other than introducing a value In contrast, the following litmus test does result in an out-of-bounds jump, so the user error is appropriate.
The proposed fix is to defer the user error until the memory constraints are resolved. |
de53c90
to
781b6b4
Compare
The first bug could be illustrated with this litmus test (rather than a more complex
The logic in This bit of logic revisiting the test had a tiny issue with enumerating instructions: if there were a line like "L0:L1: STR W0,[X1];", it would not get counted as an instruction. However, if that counter is not accurate, it turns out that converting branches to labels into branches with offsets is done incorrectly as a part of this logic -- to devastating effects. The commit bdc28b0 fixes the tiny issue in the logic processing litmus tests. The subsequent commit a364b22 does something more radical: it removes the need for that logic at all. To the best of my understanding, all the relevant instructions will be found as a part of the preparation of the initial state (in |
STR W0,[X1]| L2: B Lout1; | ||
Lself00: | L1:L0:Lsrc: NOP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STR W0,[X1]| L2: B Lout1; | |
Lself00: | L1:L0:Lsrc: NOP; | |
STR W0,[X1]| B Lout1; | |
Lself00: | Lsrc: NOP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the redundant labels were put there intentionally. The behaviors the test was trying to focus on are sensitive to what sequence of "pseudoinstructions" the test gets parsed into.
0e3f656
to
c64b0e4
Compare
+ Exporting the set of CMODX-sensitive instructions + Update the comment in lib/AArch64Base.ml + Cleaning up CMODX + Allowing ISBs overwrite instructions + Removing the constraint on overwriteable instructions + Changing the support for DIC/IDC + It is now based on variants, but parsed from the cachetype field in tess. The ability to parse DIC/IDC as variants is disabled (except in the cat interpreter). + Update the list manipulations in patch_variant in herd/semExtra.ml + Simplifying the error messages for DIC/IDC + Removing redundant cache_type structure from various places + Adding unit tests for a suspected bug in lib/pseudo.ml + Making an error message for "segfaults" due to jumps to an address be deferred until constraints are solved. The motivation is that "-variant self" may create graphs where segfaults only manifest themselves only if certain values are read from memory. + Removing a comment. Removing a bit of logic preparing a list of ovewriting instructions: currently instructions loaded from the initial state are a superset of what gets loaded from code, therefore, removing the latter. + Addressing relokin's comment for CMODX in herd/machAction.ml + Synonym for the variant name (self -> ifetch), only in herd7 Co-authored-by: Nikos Nikoleris <[email protected]> Co-authored-by: Hadrien Renaud <[email protected]> Co-authored-by: Luc Maranget <[email protected]>
e6b9a63
to
1d445e9
Compare
Merged, thanks @artkhyzha, @relokin, @HadrienRenaud @jalglave. |
[herd] Further "-variant self" changes This is a PR aiming to make a few adjustments to the tools in relation to the ifetch functionality: 1. The set of ifetch accesses that need to be subject to CMODX rules is exported into cat. 2. Previously, ISB instructions were prevented from overwriting instructions -- this limitation is removed. 3. The support for DIC/IDC features is being changed. There has been feedback suggesting that the ifetch model will want to support those as globally enabled flags. To this end, these features are being implemented as variants, but the previously suggested syntax of using "CacheType" field is being preserved. Hence, the logic for this support is somewhat special. 4. The "self" semantics of AArch64 instructions drops the check for whether the instruction "is_overwriteable". It has been introduced for optimisation purposes, but presently the gains are minimal -- on the one hand. On the other, for running tests taking advantage of CMODX, this checks needs to be removed. Therefore, this PR suggests removing it (and, perhaps, reintroduce it via a flag once optimisation becomes necessary).
This is a PR aiming to make a few adjustments to the tools in relation to the ifetch functionality: