From: Gerd Hoffmann <kraxel@redhat.com>
To: Chia-I Wu <olvaffe@gmail.com>
Cc: ML dri-devel <dri-devel@lists.freedesktop.org>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
"open list:VIRTIO GPU DRIVER"
<virtualization@lists.linux-foundation.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/virtio: fix command submission with objects but without fence.
Date: Thu, 5 Sep 2019 07:23:40 +0200 [thread overview]
Message-ID: <20190905052340.gfwmzkqwcpxtvzvu@sirius.home.kraxel.org> (raw)
In-Reply-To: <CAPaKu7RWiEr5n_DWcg0H2PPnRs9CUn-ZgQV3NYe8VrdZgEAhTQ@mail.gmail.com>
On Wed, Sep 04, 2019 at 04:10:30PM -0700, Chia-I Wu wrote:
> On Wed, Sep 4, 2019 at 12:48 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> > Only call virtio_gpu_array_add_fence if we actually have a fence.
> >
> > Fixes: da758d51968a ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing")
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> > drivers/gpu/drm/virtio/virtgpu_vq.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> > index 595fa6ec2d58..7fd2851f7b97 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> > @@ -339,11 +339,12 @@ static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
> > goto again;
> > }
> >
> > - if (fence)
> > + if (fence) {
> > virtio_gpu_fence_emit(vgdev, hdr, fence);
> > - if (vbuf->objs) {
> > - virtio_gpu_array_add_fence(vbuf->objs, &fence->f);
> > - virtio_gpu_array_unlock_resv(vbuf->objs);
> > + if (vbuf->objs) {
> > + virtio_gpu_array_add_fence(vbuf->objs, &fence->f);
> > + virtio_gpu_array_unlock_resv(vbuf->objs);
> > + }
> This leaks when fence == NULL and vbuf->objs != NULL (which can really
> happen IIRC... not at my desk to check).
Yes, it can happen, for example when flushing dumb buffers.
But I don't think we leak in this case. The code paths which don't need
a fence also do not call virtio_gpu_array_lock_resv(), so things are
balanced. The actual release of the objs happens in
virtio_gpu_dequeue_ctrl_func() via virtio_gpu_array_put_free_delayed().
cheers,
Gerd
next prev parent reply other threads:[~2019-09-05 5:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 7:48 [PATCH] drm/virtio: fix command submission with objects but without fence Gerd Hoffmann
2019-09-04 23:10 ` Chia-I Wu
2019-09-05 5:23 ` Gerd Hoffmann [this message]
2019-09-05 17:14 ` Chia-I Wu
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=20190905052340.gfwmzkqwcpxtvzvu@sirius.home.kraxel.org \
--to=kraxel@redhat.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olvaffe@gmail.com \
--cc=virtualization@lists.linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).