<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 19, 2021 at 9:38 AM Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.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">On Thu, Nov 18, 2021 at 12:53 AM Daniel Vetter <<a href="mailto:daniel@ffwll.ch" target="_blank">daniel@ffwll.ch</a>> wrote:<br>
><br>
> On Tue, Nov 16, 2021 at 06:31:10PM -0800, Gurchetan Singh wrote:<br>
> > On Tue, Nov 16, 2021 at 7:43 AM Daniel Vetter <<a href="mailto:daniel@ffwll.ch" target="_blank">daniel@ffwll.ch</a>> wrote:<br>
> ><br>
> > > On Mon, Nov 15, 2021 at 07:26:14PM +0000, Kasireddy, Vivek wrote:<br>
> > > > Hi Daniel, Greg,<br>
> > > ><br>
> > > > If it is the same or a similar crash reported here:<br>
> > > ><br>
> > > <a href="https://lists.freedesktop.org/archives/dri-devel/2021-November/330018.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/dri-devel/2021-November/330018.html</a><br>
> > > > and here:<br>
> > > <a href="https://lists.freedesktop.org/archives/dri-devel/2021-November/330212.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/dri-devel/2021-November/330212.html</a><br>
> > > > then the fix is already merged:<br>
> > > ><br>
> > > <a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d89c0c8322ecdc9a2ec84b959b6f766be082da76" rel="noreferrer" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d89c0c8322ecdc9a2ec84b959b6f766be082da76</a><br>
> ><br>
> > Yeah but that still leaves the problem of why exaxtly virtgpu is<br>
> > > reinventing drm_poll here?<br>
> ><br>
> ><br>
> > > Can you please replace it with drm_poll like all other drivers, including<br>
> > > the ones that have private events?<br>
> > ><br>
> ><br>
> > Hi Daniel,<br>
> ><br>
> > Allow me to explain the use case a bit. It's for when virtgpu KMS is not<br>
> > used, but a special Wayland compositor does wayland passthrough instead:<br>
> ><br>
> > <a href="https://www.youtube.com/watch?v=WwrXqDERFm8https://www.youtube.com/watch?v=EkNBsBx501Q" rel="noreferrer" target="_blank">https://www.youtube.com/watch?v=WwrXqDERFm8https://www.youtube.com/watch?v=EkNBsBx501Q</a><br>
> ><br>
> > This technique has gained much popularity in the virtualized laptop<br>
> > space, where it offers better performance/user experience than virtgpu<br>
> > KMS. The relevant paravirtualized userspace is "Sommelier":<br>
> ><br>
> > <a href="https://chromium.googlesource.com/chromiumos/platform2/+/main/vm_tools/sommelier/" rel="noreferrer" target="_blank">https://chromium.googlesource.com/chromiumos/platform2/+/main/vm_tools/sommelier/</a><br>
> > <a href="https://chromium.googlesource.com/chromiumos/platform2/+/main/vm_tools/sommelier/virtualization/virtgpu_channel.cc" rel="noreferrer" target="_blank">https://chromium.googlesource.com/chromiumos/platform2/+/main/vm_tools/sommelier/virtualization/virtgpu_channel.cc</a><br>
> ><br>
> > Previously, we were using the out-of-tree virtio-wl device and there<br>
> > were many discussions on how we could get this upstream:<br>
> ><br>
> > <a href="https://lists.freedesktop.org/archives/dri-devel/2017-December/160309.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/dri-devel/2017-December/160309.html</a><br>
> > <a href="https://lists.oasis-open.org/archives/virtio-dev/202002/msg00005.html" rel="noreferrer" target="_blank">https://lists.oasis-open.org/archives/virtio-dev/202002/msg00005.html</a><br>
> ><br>
> > Extending virtgpu was deemed the least intrusive option:<br>
> ><br>
> > <a href="https://www.spinics.net/lists/kvm/msg159206.html" rel="noreferrer" target="_blank">https://www.spinics.net/lists/kvm/msg159206.html</a><br>
> ><br>
> > We ultimately settled on the context type abstraction and used<br>
> > virtio_gpu_poll to tell the guest "hey, we have a Wayland event". The<br>
> > host response is actually in a buffer of type BLOB_MEM_GUEST.<br>
> ><br>
> > It is possible to use drm_poll(..), but that would have to be<br>
> > accompanied by a drm_read(..). You'll need to define a dummy<br>
> > VIRTGPU_EVENT_FENCE_SIGNALED in the uapi too.<br>
> ><br>
> > That's originally how I did it, but some pointed out that's<br>
> > unnecessary since the host response is in the BLOB_MEM_GUEST buffer<br>
> > and virtgpu event is a dummy event. So we decided just to modify<br>
> > virtio_gpu_poll(..) to have the desired semantics in that case.<br>
> ><br>
> > For the regular virtio-gpu KMS path, things remain unchanged.<br>
> ><br>
> > There are of course other ways to do it (perhaps polling a dma_fence),<br>
> > but that was the cleanest way we could find.<br>
> ><br>
> > It's not rare for virtio to "special things" (see virtio_dma_buf_ops,<br>
> > virtio_dma_ops), since they are in fake devices.<br>
><br>
> These are all internal interfaces, not uapi.<br>
><br>
> > We're open to other ideas, but hopefully that answers some of your<br>
> > questions.<br>
><br>
> Well for one, why does the commit message not explain any of this. You're<br>
> building uapi, which is forever, it's paramount all considerations are<br>
> properly explained.<br>
><br>
> Second, I really don't like that youre redefining poll semantics in<br>
> incompatible ways from all other drm drivers. If you want special poll<br>
> semantics then just create a sperate fd for that (or a dma_fence or<br>
> whatever, maybe that saves some typing), but bending the drm fd semantics<br>
> is no good at all. We have tons of different fd with their dedicated<br>
> semantics in drm, trying to shoehorn it all into one just isn't very good<br>
> design.<br>
><br>
> Or do the dummy event which is just the event code, but does not contain<br>
> any data. Either is fine with me.<br>
><br>
> Can you pls do this asap? I really don't want to bake this in as uapi<br>
> which we then have to quirk and support forever. I'd say revert for -rc2<br>
> of these two and then maybe sort it out properly in -next.<br>
<br>
I think as a general rule, if there is not consensus about uabi<br>
change, even if it is just a semantic change, then revert and reland<br>
later is ok..<br>
<br>
As far as dummy VIRTGPU_EVENT_FENCE_SIGNALED.. that doesn't entirely<br>
sound like a bad thing to me. Actually, it sounds like a good thing..<br>
it makes it more explicit what is going on. And would avoid confusing<br>
a different userspace polling for kms related events expecting to be<br>
able to do a read.<br></blockquote><div><br></div><div>If dummy events work, then it's actually not a big change to make. Expect patches in the upcoming business days.</div><div> <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>
BR,<br>
-R<br>
<br>
> Cheers, Daniel<br>
> ><br>
> ><br>
> > > Thanks, Daniel<br>
> > ><br>
> > > ><br>
> > > > Thanks,<br>
> > > > Vivek<br>
> > > ><br>
> > > > > On Sat, Nov 13, 2021 at 03:51:48PM +0100, Greg KH wrote:<br>
> > > > > > On Tue, Sep 21, 2021 at 04:20:23PM -0700, Gurchetan Singh wrote:<br>
> > > > > > > Similar to DRM_VMW_EVENT_FENCE_SIGNALED. Sends a pollable event<br>
> > > > > > > to the DRM file descriptor when a fence on a specific ring is<br>
> > > > > > > signaled.<br>
> > > > > > ><br>
> > > > > > > One difference is the event is not exposed via the UAPI -- this is<br>
> > > > > > > because host responses are on a shared memory buffer of type<br>
> > > > > > > BLOB_MEM_GUEST [this is the common way to receive responses with<br>
> > > > > > > virtgpu]. As such, there is no context specific read(..)<br>
> > > > > > > implementation either -- just a poll(..) implementation.<br>
> > > > > > ><br>
> > > > > > > Signed-off-by: Gurchetan Singh <<a href="mailto:gurchetansingh@chromium.org" target="_blank">gurchetansingh@chromium.org</a>><br>
> > > > > > > Acked-by: Nicholas Verne <<a href="mailto:nverne@chromium.org" target="_blank">nverne@chromium.org</a>><br>
> > > > > > > ---<br>
> > > > > > > drivers/gpu/drm/virtio/virtgpu_drv.c | 43<br>
> > > +++++++++++++++++++++++++-<br>
> > > > > > > drivers/gpu/drm/virtio/virtgpu_drv.h | 7 +++++<br>
> > > > > > > drivers/gpu/drm/virtio/virtgpu_fence.c | 10 ++++++<br>
> > > > > > > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 34 ++++++++++++++++++++<br>
> > > > > > > 4 files changed, 93 insertions(+), 1 deletion(-)<br>
> > > > > ><br>
> > > > > > This commit seems to cause a crash in a virtual drm gpu driver for<br>
> > > > > > Android. I have reverted this, and the next commit in the series<br>
> > > from<br>
> > > > > > Linus's tree and all is good again.<br>
> > > > > ><br>
> > > > > > Any ideas?<br>
> > > > ><br>
> > > > > Well no, but also this patch looks very questionable of hand-rolling<br>
> > > > > drm_poll. Yes you can do driver private events like<br>
> > > > > DRM_VMW_EVENT_FENCE_SIGNALED, that's fine. But you really should not<br>
> > > need<br>
> > > > > to hand-roll the poll callback. vmwgfx (which generally is a very old<br>
> > > > > driver which has lots of custom stuff, so not a great example) doesn't<br>
> > > do<br>
> > > > > that either.<br>
> > > > ><br>
> > > > > So that part should go no matter what I think.<br>
> > > > > -Daniel<br>
> > > > > --<br>
> > > > > Daniel Vetter<br>
> > > > > Software Engineer, Intel Corporation<br>
> > > > > <a href="http://blog.ffwll.ch" rel="noreferrer" target="_blank">http://blog.ffwll.ch</a><br>
> > ><br>
> > > --<br>
> > > Daniel Vetter<br>
> > > Software Engineer, Intel Corporation<br>
> > > <a href="http://blog.ffwll.ch" rel="noreferrer" target="_blank">http://blog.ffwll.ch</a><br>
> > ><br>
><br>
> --<br>
> Daniel Vetter<br>
> Software Engineer, Intel Corporation<br>
> <a href="http://blog.ffwll.ch" rel="noreferrer" target="_blank">http://blog.ffwll.ch</a><br>
</blockquote></div></div>