-
Notifications
You must be signed in to change notification settings - Fork 79
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
Bring back DAX #205
Bring back DAX #205
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -554,13 +554,27 @@ pub fn build_microvm( | |
)?; | ||
} | ||
|
||
// Use half of the shmem region for virtio-gpu and half for DAX | ||
let _shm_region_size = arch_memory_info.shm_size >> 1; | ||
|
||
#[cfg(not(feature = "tee"))] | ||
let _shm_region = Some(VirtioShmRegion { | ||
let dax_shm_region = Some(VirtioShmRegion { | ||
host_addr: guest_memory | ||
.get_host_address(GuestAddress(arch_memory_info.shm_start_addr)) | ||
.unwrap() as u64, | ||
guest_addr: arch_memory_info.shm_start_addr, | ||
size: arch_memory_info.shm_size as usize, | ||
size: _shm_region_size as usize, | ||
}); | ||
|
||
#[cfg(feature = "gpu")] | ||
let gpu_shm_region = Some(VirtioShmRegion { | ||
host_addr: guest_memory | ||
.get_host_address(GuestAddress( | ||
arch_memory_info.shm_start_addr + _shm_region_size, | ||
)) | ||
.unwrap() as u64, | ||
guest_addr: arch_memory_info.shm_start_addr + _shm_region_size, | ||
size: _shm_region_size as usize, | ||
}); | ||
|
||
let mut vmm = Vmm { | ||
|
@@ -591,15 +605,15 @@ pub fn build_microvm( | |
attach_gpu_device( | ||
&mut vmm, | ||
event_manager, | ||
_shm_region, | ||
gpu_shm_region, | ||
intc.clone(), | ||
virgl_flags, | ||
#[cfg(target_os = "macos")] | ||
_map_sender, | ||
)?; | ||
} | ||
#[cfg(not(feature = "tee"))] | ||
attach_fs_devices(&mut vmm, &vm_resources.fs, None, intc.clone())?; | ||
attach_fs_devices(&mut vmm, &vm_resources.fs, dax_shm_region, intc.clone())?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have the feeling, from what I have tested, that this share memory region can't be used by more than one virtio device. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to work fine for me? I don't see why it wouldn't work as long as the range used by each device does not overlap (which is why I split it in half here). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the half/half splitting between gpu and fs clearly works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ohh, sorry, I misunderstood. Maybe @slp knows what the intent was here? I only brought back the previous behavior from back when DAX was enabled, so I'm guessing this same problem already existed before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to implement some kind of shm region manager that manages the window and can be used to request regions of a certain size. I'm adding this to my TODO list and I think I'll have bandwidth to implement it next week, in case no one beats me implementing it first. |
||
#[cfg(feature = "blk")] | ||
attach_block_devices(&mut vmm, &vm_resources.block, intc.clone())?; | ||
if let Some(vsock) = vm_resources.vsock.get() { | ||
|
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.
My rust is still very recent: should the underscore be removed, here?
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.
That silences the unused variable warning, in the case of a build with the
tee
feature enabled and thegpu
feature disabled (which would cause it to become unused).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.
Sorry for the noise!