Skip to content

Commit 79956e8

Browse files
committed
kvm-ioctls: Remove Send and Sync from KvmDirtyLogRing
Remove Send and Sync from KvmDirtyLogRing Signed-off-by: David Kleymann <[email protected]>
1 parent 483342a commit 79956e8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

kvm-ioctls/src/ioctls/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ pub(crate) struct KvmDirtyLogRing {
4444
use_acq_rel: bool,
4545
}
4646

47-
// SAFETY: TBD
48-
unsafe impl Send for KvmDirtyLogRing {}
49-
unsafe impl Sync for KvmDirtyLogRing {}
47+
// // SAFETY: For each vcpu we only allow creating a single instance of the KvmDirtyLogRing,
48+
// // therefore ownership can safely be transferred between threads (`Send`).
49+
// unsafe impl Send for KvmDirtyLogRing {}
50+
51+
// // SAFETY: TBD
52+
// unsafe impl Sync for KvmDirtyLogRing {}
5053
impl KvmDirtyLogRing {
5154
/// Maps the KVM dirty log ring from the vCPU file descriptor.
5255
///
@@ -132,7 +135,7 @@ impl Iterator for KvmDirtyLogRing {
132135

133136
if gfn.flags & KVM_DIRTY_GFN_F_DIRTY == 0 {
134137
// next_dirty stays the same, it will become the next dirty element
135-
return None;
138+
None
136139
} else {
137140
self.next_dirty += 1;
138141
let mut updated_gfn = gfn;
@@ -144,7 +147,7 @@ impl Iterator for KvmDirtyLogRing {
144147
if self.use_acq_rel {
145148
fence(Ordering::Release);
146149
}
147-
return Some((gfn.slot, gfn.offset));
150+
Some((gfn.slot, gfn.offset))
148151
}
149152
}
150153
}

0 commit comments

Comments
 (0)