public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Honglei1" <Honglei1.Huang@amd.com>
To: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Demi Marie Obenour <demiobenour@gmail.com>,
	David Airlie <airlied@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>, Chia-I Wu <olvaffe@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Simona Vetter <simona@ffwll.ch>, Rob Clark <robdclark@gmail.com>,
	Huang Rui <ray.huang@amd.com>,
	dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Dmitry Osipenko <dmitry.osipenko@collabora.com>
Subject: Re: [PATCH v1 1/7] virtio-gpu api: add blob userptr resource
Date: Tue, 18 Mar 2025 19:25:42 +0800	[thread overview]
Message-ID: <e7614b27-e9b4-49a8-831b-0acd33911336@amd.com> (raw)
In-Reply-To: <CAAfnVBk-JJKxJXAstwmgL4=EM15RHfVm4NQST+p3nE4xi2220g@mail.gmail.com>



On 2025/3/18 9:37, Gurchetan Singh wrote:
> 
> 
> On Thu, Mar 6, 2025 at 2:52 AM Huang, Honglei1 <Honglei1.Huang@amd.com 
> <mailto:Honglei1.Huang@amd.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@amd.com
>     <mailto:Honglei1.Huang@amd.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.

> 
> 
> 
>     Regards,
>     Honglei
> 


  parent reply	other threads:[~2025-03-18 11:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28  5:36 [PATCH v1 0/7] Add virtio gpu userptr support Honglei Huang
2025-02-28  5:36 ` [PATCH v1 1/7] virtio-gpu api: add blob userptr resource Honglei Huang
2025-02-28 21:21   ` Demi Marie Obenour
2025-03-06 10:51     ` Huang, Honglei1
     [not found]       ` <CAAfnVBk-JJKxJXAstwmgL4=EM15RHfVm4NQST+p3nE4xi2220g@mail.gmail.com>
2025-03-18 11:25         ` Huang, Honglei1 [this message]
2025-03-24  2:44           ` Huang, Honglei1
2025-03-26 14:46       ` Dmitry Osipenko
2025-03-27  3:00         ` Huang, Honglei1
2025-03-28  1:39           ` Dmitry Osipenko
2025-03-29 19:50         ` Demi Marie Obenour
2025-03-30 11:57           ` Dmitry Osipenko
2025-02-28  5:36 ` [PATCH v1 2/7] drm/virtgpu " Honglei Huang
2025-02-28  5:36 ` [PATCH v1 3/7] drm/virtio: implement userptr: probe for the feature Honglei Huang
2025-02-28  5:36 ` [PATCH v1 4/7] drm/virtio: implement userptr: add userptr obj Honglei Huang
2025-02-28  5:36 ` [PATCH v1 5/7] drm/virtio: advertise base userptr feature to userspace Honglei Huang
2025-02-28  5:36 ` [PATCH v1 6/7] drm/virtio: implement userptr: add interval tree Honglei Huang
2025-02-28  5:36 ` [PATCH v1 7/7] drm/virtio: implement userptr: add mmu notifier Honglei Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7614b27-e9b4-49a8-831b-0acd33911336@amd.com \
    --to=honglei1.huang@amd.com \
    --cc=airlied@redhat.com \
    --cc=demiobenour@gmail.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gurchetansingh@chromium.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=olvaffe@gmail.com \
    --cc=ray.huang@amd.com \
    --cc=robdclark@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox