public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: dri-devel@lists.freedesktop.org, robdclark@gmail.com,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	David Airlie <airlied@linux.ie>,
	"open list:VIRTIO GPU DRIVER" 
	<virtualization@lists.linux-foundation.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence()
Date: Tue, 13 Dec 2016 07:47:25 +0100	[thread overview]
Message-ID: <1481611645.27088.56.camel@redhat.com> (raw)
In-Reply-To: <1481575710-12535-1-git-send-email-gustavo@padovan.org>

  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.

cheers,
  Gerd

  parent reply	other threads:[~2016-12-13  9:14 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 ` Gerd Hoffmann [this message]
2016-12-13 11:53   ` [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence() Gustavo Padovan

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=1481611645.27088.56.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=gustavo@padovan.org \
    --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