Conversation
|
Draft, for comments and |
3fee515 to
4e75239
Compare
relokin
left a comment
There was a problem hiding this comment.
Overall looks good to me but I have a couple of comments about the tests.
|
Hi @relokin. What this PR basically does is changing the test that controls performing the store conditional. First observe that the reservation (a.k.a exclusive monitor) is implemented by using a unique register RES (for AArch64, VMSA and ASL. VMSA+ASL uses an additional flag). Schematic behaviour is a follows
See also the tests L020 (LDXR and STXR to different addresses, store was always failing now it may succeed) and L021 (LDXR followed by two STXR, all to the same address, the second STXR never succeeds). Finally an new test L106 consists in a simple STXR, without LDXR, the store normally always fails but may succeed when |
832dc8d to
eaecbf6
Compare
|
I have also added L107 (L021 with |
|
Looks good to me. Perhaps one concern I have is that for AArch64 |
Given x and y that are different addresses `LDXR x; ...; STXR y`, STXR to y can succeed. Hence, the only situation when STXR always fail is when there is no reservation, which we implement by the reservation address being null. Detailed changes: + The new semantics is also implemented for AArch64 ASL and ASL+VMSA modes + With `-variant ConstrainedUnpredictable`, STXR can succeed even in the absence of a reservation (non-ASL only, no access to variant in ASL). + Same semantics of LR/SC pairs for RISCV Notice that this semantics (SC can succeed event with a reservation to a different address) was activated by the variant `LrScDiffOk`. This behaviour now being the default, we suppress the variant.
+ Add constrained unpredictable tests Note that these tests are disabled in ASL mode. (No access to the ConstrainedUnpredicable variant) + Add "LDXR x; LDXR y, STXR x" tests.
|
Hi @relokin and @HadrienRenaud. Rebased on master since prerequisite PR #1889 is merged, all commits squashed into two commits, ready for review. |
HadrienRenaud
left a comment
There was a problem hiding this comment.
This looks ok to me but I think the handling of reserved addresses in ASL could be cleaner.
| | _ -> | ||
| if setzero then | ||
| state_add loc ASLS.V.zero st | ||
| else st |
There was a problem hiding this comment.
I don't really understand why this is needed. In both physmem-*.asl, the address is initialised to Zeros{_}
Also the initial environment would not be correctly typed checked: this is an integer and we expect a 56 or 64 bits bitvector (depending on whether VMSA is activated, i.e. whether RESADDR stores a physical or virtual address)
|
|
||
| if SuccessVA then | ||
| CheckEq(address, reserved); | ||
| CheckProp(reserved != 0); |
There was a problem hiding this comment.
reserved has type bits(64) here
| CheckProp(reserved != 0); | |
| CheckProp(!IsZeros(reserved)); |
or
| CheckProp(reserved != 0); | |
| CheckProp(reserved != Zeros{64}); |
|
|
||
| if SuccessPA then | ||
| CheckEq(paddress.address, reserved); | ||
| CheckProp(reserved != 0); |
There was a problem hiding this comment.
reserved has type bits(56) here
| CheckProp(reserved != 0); | |
| CheckProp(!IsZeros(reserved)); |
Or
| CheckProp(reserved != 0); | |
| CheckProp(reserved != Zeros{56}); |
There was a problem hiding this comment.
Consider two STXR in a row. The first STXR sets the RES register to zero (integer zero) and this value is seen as zero (integer) by the next STXR. In the case we have no LDXR nor STXR before an exclusive instruction, RES is not initialised, hence the setzero flag above...
There was a problem hiding this comment.
I no longer have time to do this in a safe manner, I leave it to you.
|
Not really the point of this PR so you can go ahead and merge as soon as @HadrienRenaud is happy but I don't understand why we support |
|
I do not understand the intent of |
My bad, this usage is for generators... Hence we can suppress |
The following test may succeed: