<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Mar 6, 2025 at 2:52 AM Huang, Honglei1 <<a href="mailto:Honglei1.Huang@amd.com">Honglei1.Huang@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 2025/3/1 5:21, Demi Marie Obenour wrote:<br>
> On 2/28/25 12:36 AM, Honglei Huang wrote:<br>
>> From: Honglei Huang <<a href="mailto:Honglei1.Huang@amd.com" target="_blank">Honglei1.Huang@amd.com</a>><br>
>><br>
>> Add a new resource for blob resource, called userptr, used for let<br>
>> host access guest user space memory, to acquire buffer based userptr<br>
>> feature in virtio GPU.<br>
>><br>
>> - The capset VIRTIO_GPU_CAPSET_HSAKMT used for context init,<br>
>> in this series patches only HSAKMT context can use the userptr<br>
>> feature. HSAKMT is a GPU compute library in HSA stack, like<br>
>> the role libdrm in mesa stack.<br>
> <br>
> Userptr should not be limited to HSMKMT contexts.  Userptr can<br>
> accelerate shm buffers by avoiding a copy from guest to host, and<br>
> it can be implemented using grant tables on Xen.<br>
<br>
Yes, I totally agree userptr can accelerate shm buffers, but I currently<br>
don't know if there are any other projects working on similar features,<br>
or if maintainers have any opinions or better ways to implement them, so<br>
I temporarily limit this feature to HSAKMT context only.<br>
<br>
I am waiting for everyone's opinions, please provide your thoughts.<br></blockquote><div><br></div><div>I wonder if you can emulate userptr using udmabuf on the host-side?</div><div><br></div><div>Essentially for the guest, it'll be a malloc'ed memory, which means a guest sg list.  We can convert the guest sg-list to udmabuf using well-known mechanisms on the host side.  I hope amdkfd can operate on dma-bufs too?</div><div><br></div><div>I do such a feature that would have a more generic utility outside of HSAKMT contexts and not rely on Xen-specific grant tables  ... checkout VIRTIO_GPU_BLOB_FLAG_CREATE_GUEST_HANDLE in crosvm for an example.   </div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Regards,<br>
Honglei<br>
</blockquote></div></div>