Skip to content
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

Provide atomic accesses to guest memory #16

Closed
alexandruag opened this issue May 2, 2019 · 2 comments
Closed

Provide atomic accesses to guest memory #16

alexandruag opened this issue May 2, 2019 · 2 comments
Assignees

Comments

@alexandruag
Copy link
Collaborator

We should fix logic that handles guest memory access and does not guarantee the operations will have volatile semantics. One example is the copy here:

copy(self.addr, slice.addr, min(self.size, slice.size));

@bonzini bonzini changed the title Enforce/ensure volatile semantics on guest memory access Provide atomic accesses to guest memory May 2, 2019
@bonzini
Copy link
Member

bonzini commented May 2, 2019

Hmm, this is not actually what I wanted to work on. The issue is that the rust compiler (and the processor on weakly-ordered architectures) need to be told about possibly concurrent access, and they should be properly annotated as "atomic" rather than "volatile". My idea here is to add a VolatileAtomicRef struct similar to VolatileRef, but supporting atomic load and store instead of Deref and DerefMut.

@alexandruag alexandruag assigned alexandruag and unassigned bonzini May 2, 2019
@alexandruag
Copy link
Collaborator Author

Sorry about that :( For some reason I thought this one implies the other as well, but even if it did, the description was not clear at all in this regard. Assigned myself for this one.

bonzini added a commit to bonzini/vm-memory that referenced this issue May 28, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue May 28, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue May 28, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue May 28, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue May 30, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue May 30, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 3, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 4, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 4, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 4, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 4, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 4, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 4, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 4, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 5, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added a commit to bonzini/vm-memory that referenced this issue Jun 5, 2019
This allows writing safely drivers that access memory concurrently
with the guest and that require memory barriers between DMA
accesses.

I'm adding a feature for AtomicU* types because they were only
stabilized in Rust 1.34.0.

Fixes: rust-vmm#16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants