-
Notifications
You must be signed in to change notification settings - Fork 167
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
Use physical addresses for LR/SC reservations #501
Use physical addresses for LR/SC reservations #501
Conversation
11e63e7
to
085b37a
Compare
This changes the behaviour of At first glance the new behaviour seems to match spike: https://github.com/riscv-software-src/riscv-isa-sim/blob/98d2c29e431f3b14feefbda48c5f70c2f451acf2/riscv/mmu.h#L266 |
I suspect the answer is it's implementation defined what happens. Right now the RISC-V axiomatic memory model in the ISA manual does not specify anything regarding virtual memory. If we do end up with an axiomatic model with virtual memory, we might need something like |
model/riscv_insts_aext.sail
Outdated
* For now we set them on virtual addresses, since it makes the | ||
* sequential model of SC a bit simpler, at the cost of an explicit | ||
* call to load_reservation in LR and cancel_reservation in SC. | ||
* However the reservation is architecturally defined in terms of physical |
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.
Is this actually the case? The LR and SC section of the unpriv spec never uses the word physical. "a set of bytes that subsumes the bytes in the addressed word." seems intentionally fuzzy to allow a range of implementations.
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.
OTOH, when I search the priv spec: "For implementations with both page-based virtual memory and the "A" standard extension, the LR/SC
reservation set must lie completely within a single base physical page (i.e., a naturally aligned 4 KiB
physical-memory region)."
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.
This is based on this comment; maybe the language is a little too strong for something in an second hand email... Maybe I should just remove that comment? Though the quote you found does indirectly support it.
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.
Ok comment removed.
This is how reservation is architecturally defined, how real CPUs are likely to be implemented, and doesn't require spurious cancellations on xRET and traps. Fixes riscv#360.
085b37a
to
585e6ff
Compare
@billmcspadden-riscv ok this is ready now. |
This is how reservation is architecturally defined, how real CPUs are likely to be implemented, and doesn't require spurious cancellations on xRET and traps.
Fixes #360.