Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1540922

Re: [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence()

From Gerd Hoffmann <kraxel@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence()
Date 2016-12-13 10:20 +0100
Message-ID <sNRpD-7Pf-3@gated-at.bofh.it> (permalink)
References <sNFHP-v6-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


  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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence() Gustavo Padovan <gustavo@padovan.org> - 2016-12-12 21:50 +0100
  Re: [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence() Gerd Hoffmann <kraxel@redhat.com> - 2016-12-13 10:20 +0100
    Re: [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence() Gustavo Padovan <gustavo@padovan.org> - 2016-12-13 13:00 +0100

csiph-web