lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 13 Dec 2016 09:53:09 -0200
From:   Gustavo Padovan <gustavo@...ovan.org>
To:     Gerd Hoffmann <kraxel@...hat.com>
Cc:     dri-devel@...ts.freedesktop.org, robdclark@...il.com,
        Gustavo Padovan <gustavo.padovan@...labora.co.uk>,
        David Airlie <airlied@...ux.ie>,
        "open list:VIRTIO GPU DRIVER" 
        <virtualization@...ts.linux-foundation.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC 1/5] drm/virtio: add virtio_gpu_alloc_fence()

2016-12-13 Gerd Hoffmann <kraxel@...hat.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ