-
Notifications
You must be signed in to change notification settings - Fork 106
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
user_driver: specify tags when allocating dma buffers #912
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -1835,7 +1835,7 @@ async fn request_igvm_attest( | |
let allocator = gpa_allocator.ok_or(FatalError::GpaAllocatorUnavailable)?; | ||
let dma_size = request.response_buffer_len; | ||
let mem = allocator | ||
.allocate_dma_buffer(dma_size) | ||
.allocate_dma_buffer(dma_size, "attest request".into()) | ||
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. This one too |
||
.map_err(FatalError::GpaMemoryAllocationError)?; | ||
|
||
// Host expects the vTOM bit to be stripped | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,7 +185,7 @@ impl QueuePair { | |
QueuePair::SQ_SIZE + QueuePair::CQ_SIZE + QueuePair::PER_QUEUE_PAGES * PAGE_SIZE; | ||
let dma_client = device.dma_client(); | ||
let mem = dma_client | ||
.allocate_dma_buffer(total_size) | ||
.allocate_dma_buffer(total_size, "nvme-queues".into()) | ||
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 should include 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. pci_id is tied to the client (this is allocated off a specific device's client), but sure - what's the source of qid you want 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. qid is passed as a parameter to this function, I think it would help to know for which queue number (qid) we allocated this particular block. |
||
.context("failed to allocate memory for queues")?; | ||
|
||
assert!(sq_entries <= Self::MAX_SQ_ENTRIES); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,7 +273,7 @@ pub struct EmulatedDmaAllocator { | |
} | ||
|
||
impl DmaClient for EmulatedDmaAllocator { | ||
fn allocate_dma_buffer(&self, len: usize) -> anyhow::Result<MemoryBlock> { | ||
fn allocate_dma_buffer(&self, len: usize, _tag: String) -> anyhow::Result<MemoryBlock> { | ||
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. Could still be useful here right? 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, add it to |
||
let memory = MemoryBlock::new(self.shared_mem.alloc(len).context("out of memory")?); | ||
memory.as_slice().atomic_fill(0); | ||
Ok(memory) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,11 @@ unsafe impl MappedDmaTarget for LockedMemory { | |
pub struct LockedMemorySpawner; | ||
|
||
impl crate::DmaClient for LockedMemorySpawner { | ||
fn allocate_dma_buffer(&self, len: usize) -> anyhow::Result<crate::memory::MemoryBlock> { | ||
fn allocate_dma_buffer( | ||
&self, | ||
len: usize, | ||
_tag: String, | ||
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. Could be useful here too right? |
||
) -> anyhow::Result<crate::memory::MemoryBlock> { | ||
Ok(crate::memory::MemoryBlock::new(LockedMemory::new(len)?)) | ||
} | ||
|
||
|
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 one doesn't really follow the format of all the others, but i guess it doesn't matter?