From: Gustavo Padovan <gustavo@padovan.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: David Airlie <airlied@linux.ie>,
open list <linux-kernel@vger.kernel.org>,
dri-devel@lists.freedesktop.org,
"open list:VIRTIO GPU DRIVER"
<virtualization@lists.linux-foundation.org>,
robdclark@gmail.com,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: Re: [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence()
Date: Tue, 13 Dec 2016 09:53:09 -0200 [thread overview]
Message-ID: <20161213115309.GC17187@joana> (raw)
In-Reply-To: <1481611645.27088.56.camel@redhat.com>
2016-12-13 Gerd Hoffmann <kraxel@redhat.com>:
> Hi,
>
> > +struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *vgdev)
> > +{
> > + struct virtio_gpu_fence_driver *drv = &vgdev->fence_drv;
> > + struct virtio_gpu_fence *fence;
> > + unsigned long irq_flags;
> > +
> > + fence = kmalloc(sizeof(struct virtio_gpu_fence), GFP_ATOMIC);
> > + if (!fence)
> > + return NULL;
> > +
>
> > + spin_lock_irqsave(&drv->lock, irq_flags);
> > + fence->drv = drv;
> > + fence->seq = ++drv->sync_seq;
> > + dma_fence_init(&fence->f, &virtio_fence_ops, &drv->lock,
> > + drv->context, fence->seq);
> > + spin_unlock_irqrestore(&drv->lock, irq_flags);
>
> seq assignment ...
>
> > +
> > + return fence;
> > +}
> > +
> > int virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev,
> > struct virtio_gpu_ctrl_hdr *cmd_hdr,
> > - struct virtio_gpu_fence **fence)
> > + struct virtio_gpu_fence *fence)
> > {
> > struct virtio_gpu_fence_driver *drv = &vgdev->fence_drv;
> > unsigned long irq_flags;
> >
> > - *fence = kmalloc(sizeof(struct virtio_gpu_fence), GFP_ATOMIC);
> > - if ((*fence) == NULL)
> > - return -ENOMEM;
> > -
> > spin_lock_irqsave(&drv->lock, irq_flags);
> > - (*fence)->drv = drv;
> > - (*fence)->seq = ++drv->sync_seq;
> > - dma_fence_init(&(*fence)->f, &virtio_fence_ops, &drv->lock,
> > - drv->context, (*fence)->seq);
>
> ... must stay here. Otherwise requests can be submitted to the virt
> queue with fence sequence numbers out of order.
Yes, makes sense. So I'll just leave the kmalloc in there.
Gustavo
prev parent reply other threads:[~2016-12-13 11:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 20:48 [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence() Gustavo Padovan
2016-12-12 20:48 ` [RFC 2/5] drm/virtio: add uapi for in and out explicit fences Gustavo Padovan
2016-12-12 20:48 ` [RFC 3/5] drm/virtio: add in-fences support for explicit synchronization Gustavo Padovan
2016-12-12 20:48 ` [RFC 4/5] drm/virtio: add out-fences " Gustavo Padovan
2016-12-12 20:48 ` [RFC 5/5] drm/virtio: bump driver version after explicit synchronization addition Gustavo Padovan
2016-12-13 6:47 ` [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence() Gerd Hoffmann
[not found] ` <1481611645.27088.56.camel@redhat.com>
2016-12-13 11:53 ` Gustavo Padovan [this message]
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=20161213115309.GC17187@joana \
--to=gustavo@padovan.org \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo.padovan@collabora.co.uk \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@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).