[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d1cb3ade-997b-45c5-a197-4e2ab88f9835@amd.com>
Date: Mon, 24 Mar 2025 10:44:46 +0800
From: "Huang, Honglei1" <Honglei1.Huang@....com>
To: Gurchetan Singh <gurchetansingh@...omium.org>
Cc: Demi Marie Obenour <demiobenour@...il.com>,
David Airlie <airlied@...hat.com>, Gerd Hoffmann <kraxel@...hat.com>,
Chia-I Wu <olvaffe@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
Simona Vetter <simona@...ll.ch>, Rob Clark <robdclark@...il.com>,
Huang Rui <ray.huang@....com>, dri-devel@...ts.freedesktop.org,
virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
Dmitry Osipenko <dmitry.osipenko@...labora.com>
Subject: Re: [PATCH v1 1/7] virtio-gpu api: add blob userptr resource
On 2025/3/18 19:25, Huang, Honglei1 wrote:
>
>
> On 2025/3/18 9:37, Gurchetan Singh wrote:
>>
>>
>> On Thu, Mar 6, 2025 at 2:52 AM Huang, Honglei1 <Honglei1.Huang@....com
>> <mailto:Honglei1.Huang@....com>> wrote:
>>
>>
>> On 2025/3/1 5:21, Demi Marie Obenour wrote:
>> > On 2/28/25 12:36 AM, Honglei Huang wrote:
>> >> From: Honglei Huang <Honglei1.Huang@....com
>> <mailto:Honglei1.Huang@....com>>
>> >>
>> >> Add a new resource for blob resource, called userptr, used for
>> let
>> >> host access guest user space memory, to acquire buffer based
>> userptr
>> >> feature in virtio GPU.
>> >>
>> >> - The capset VIRTIO_GPU_CAPSET_HSAKMT used for context init,
>> >> in this series patches only HSAKMT context can use the userptr
>> >> feature. HSAKMT is a GPU compute library in HSA stack, like
>> >> the role libdrm in mesa stack.
>> >
>> > Userptr should not be limited to HSMKMT contexts. Userptr can
>> > accelerate shm buffers by avoiding a copy from guest to host, and
>> > it can be implemented using grant tables on Xen.
>>
>> Yes, I totally agree userptr can accelerate shm buffers, but I
>> currently
>> don't know if there are any other projects working on similar
>> features,
>> or if maintainers have any opinions or better ways to implement
>> them, so
>> I temporarily limit this feature to HSAKMT context only.
>>
>> I am waiting for everyone's opinions, please provide your thoughts.
>>
>>
>> I wonder if you can emulate userptr using udmabuf on the host-side?
>>
>> 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?
>>
>> 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.
>
> I think userptr can be emulated by udmabuf if the sg list is from guest
> user sapce and not moveable, amdkfd can operate dma-buf, and the userptr
> feature can be achieved by partial functions of dma-buf as far as I can
> see.
>
> But the udmabuf need managed by UMD, this will result in some
> performance loss, and we are planning to implement virtio GPU userptr
> using hmm_rang_fault, udmabuf solution may be completely different from
> this one.
>
> I saw the feature VIRTIO_GPU_BLOB_FLAG_CREATE_GUEST_HANDLE is used by
> the crosvm in beta branch, but I can not find the kernel virtio gpu
> part, how to access it? Maybe I can try or help.
Hi Gurchetan,
I found VIRTIO_GPU_BLOB_FLAG_CREATE_GUEST_HANDLE has been added into
crosvm 4 years ago. But I can not find the corresponding kernel
implementation, also can not find in chromeos kernel:
https://chromium.googlesource.com/chromiumos/third_party/kernel/.
And it seems like the VIRTIO_GPU_BLOB_FLAG_CREATE_GUEST_HANDLE only
support the system memory according to the commit message, but I can see
the virtio has plan to support guest
heap:https://github.com/google/crosvm/blob/dee7838993bae90cad49d5595b958cfe4c28b58d/devices/src/virtio/gpu/virtio_gpu.rs#L1056.
Can I create new virtio gpu patches for adding heap supported virtio
gpu udmabuf?
Regards,
Honglei
>
>>
>>
>>
>> Regards,
>> Honglei
>>
>
Powered by blists - more mailing lists