-
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?
Conversation
0d69fd1
to
681ed2a
Compare
.allocate_dma_buffer(HV_PAGE_SIZE as usize) | ||
.allocate_dma_buffer( | ||
HV_PAGE_SIZE as usize, | ||
format!("tdx-flush-page vp {}", params.vp_info.base.vp_index.index()), |
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?
@@ -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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, add it to .context
below
fn allocate_dma_buffer( | ||
&self, | ||
len: usize, | ||
_tag: String, |
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.
Could be useful here too right?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
We should include qid
here at least, and possibly pci_id if we can retreive one
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.
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 comment
The 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.
Specify allocation tags when allocating dma buffers.
Restore requires some additional thought as drivers will need to save/restore tags if we want to require them to match. But this at least helps attribute the allocations that previously just had a not very useful tag.