All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Oleksandr Andrushchenko <andr2000@gmail.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
	jgross@suse.com, konrad.wilk@oracle.com
Cc: daniel.vetter@intel.com, dongwon.kim@intel.com,
	matthew.d.roper@intel.com
Subject: Re: [PATCH v3 9/9] xen/gntdev: Implement dma-buf import functionality
Date: Wed, 13 Jun 2018 12:04:49 +0300	[thread overview]
Message-ID: <cca7b9dd-a0c6-8052-c294-9e6c5d65e9eb@epam.com> (raw)
In-Reply-To: <b08fdccf-2f1b-a902-f00b-a4cecf44a1b1@oracle.com>

On 06/13/2018 06:14 AM, Boris Ostrovsky wrote:
>
>
> On 06/12/2018 09:42 AM, Oleksandr Andrushchenko wrote:
>
>>   int gntdev_dmabuf_imp_release(struct gntdev_dmabuf_priv *priv, u32 fd)
>>   {
>> -    return -EINVAL;
>> +    struct gntdev_dmabuf *gntdev_dmabuf;
>> +    struct dma_buf_attachment *attach;
>> +    struct dma_buf *dma_buf;
>> +
>> +    gntdev_dmabuf = dmabuf_imp_find_unlink(priv, fd);
>> +    if (IS_ERR(gntdev_dmabuf))
>> +        return PTR_ERR(gntdev_dmabuf);
>> +
>> +    pr_debug("Releasing DMA buffer with fd %d\n", fd);
>> +
>> +    attach = gntdev_dmabuf->u.imp.attach;
>> +
>> +    if (gntdev_dmabuf->u.imp.sgt)
>> +        dma_buf_unmap_attachment(attach, gntdev_dmabuf->u.imp.sgt,
>> +                     DMA_BIDIRECTIONAL);
>> +    dma_buf = attach->dmabuf;
>> +    dma_buf_detach(attach->dmabuf, attach);
>> +    dma_buf_put(dma_buf);
>> +
>> +    dmabuf_imp_end_foreign_access(gntdev_dmabuf->u.imp.refs,
>> +                      gntdev_dmabuf->nr_pages);
>
>
>
> Should you first end foreign access, before doing anything?
>
I am rolling back in reverse order here, so I think we first need
to finish local activities with the buffer and then end foreign
access.
> -boris
>
>
>> + dmabuf_imp_free_storage(gntdev_dmabuf);
>> +    return 0;
>>   }


  parent reply	other threads:[~2018-06-13  9:05 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 13:41 [PATCH v3 0/9] xen: dma-buf support for grant device Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41 ` [PATCH v3 1/9] xen/grant-table: Export gnttab_{alloc|free}_pages as GPL Oleksandr Andrushchenko
2018-06-12 13:41   ` Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41 ` [PATCH v3 2/9] xen/grant-table: Make set/clear page private code shared Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41   ` Oleksandr Andrushchenko
2018-06-12 13:41 ` [PATCH v3 3/9] xen/balloon: Share common memory reservation routines Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41   ` Oleksandr Andrushchenko
2018-06-13  0:47   ` Boris Ostrovsky
2018-06-13  6:26     ` Oleksandr Andrushchenko
2018-06-13  6:26     ` Oleksandr Andrushchenko
2018-06-13 12:02       ` Boris Ostrovsky
2018-06-13 12:02       ` Boris Ostrovsky
2018-06-13 12:03         ` Oleksandr Andrushchenko
2018-06-13 12:03         ` Oleksandr Andrushchenko
2018-06-13 12:27           ` Oleksandr Andrushchenko
2018-06-13 12:27           ` Oleksandr Andrushchenko
2018-06-13  0:47   ` Boris Ostrovsky
2018-06-13  1:07   ` Boris Ostrovsky
2018-06-13  6:50     ` Oleksandr Andrushchenko
2018-06-13  6:50     ` Oleksandr Andrushchenko
2018-06-13  1:07   ` Boris Ostrovsky
2018-06-12 13:41 ` [PATCH v3 4/9] xen/grant-table: Allow allocating buffers suitable for DMA Oleksandr Andrushchenko
2018-06-12 13:41   ` Oleksandr Andrushchenko
2018-06-13  1:12   ` Boris Ostrovsky
2018-06-13  7:07     ` Oleksandr Andrushchenko
2018-06-13  7:07     ` Oleksandr Andrushchenko
2018-06-13  7:07       ` Oleksandr Andrushchenko
2018-06-13  1:12   ` Boris Ostrovsky
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41 ` [PATCH v3 5/9] xen/gntdev: Allow mappings for DMA buffers Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41   ` Oleksandr Andrushchenko
2018-06-13  1:26   ` Boris Ostrovsky
2018-06-13  1:26   ` Boris Ostrovsky
2018-06-13  7:16     ` Oleksandr Andrushchenko
2018-06-13  7:16     ` Oleksandr Andrushchenko
2018-06-14  7:00   ` Oleksandr Andrushchenko
2018-06-14  7:00   ` Oleksandr Andrushchenko
2018-06-12 13:41 ` [PATCH v3 6/9] xen/gntdev: Make private routines/structures accessible Oleksandr Andrushchenko
2018-06-12 13:41   ` Oleksandr Andrushchenko
2018-06-13  1:38   ` Boris Ostrovsky
2018-06-13  1:38   ` Boris Ostrovsky
2018-06-13  7:23     ` Oleksandr Andrushchenko
2018-06-13  7:23     ` Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41 ` [PATCH v3 7/9] xen/gntdev: Add initial support for dma-buf UAPI Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-13  1:49   ` Boris Ostrovsky
2018-06-13  1:49   ` Boris Ostrovsky
2018-06-13  8:17     ` Oleksandr Andrushchenko
2018-06-13  8:17     ` Oleksandr Andrushchenko
2018-06-12 13:41 ` [PATCH v3 8/9] xen/gntdev: Implement dma-buf export functionality Oleksandr Andrushchenko
2018-06-12 13:41 ` Oleksandr Andrushchenko
2018-06-12 13:41   ` Oleksandr Andrushchenko
2018-06-13  2:58   ` Boris Ostrovsky
2018-06-13 11:57     ` Oleksandr Andrushchenko
2018-06-13 11:57     ` Oleksandr Andrushchenko
2018-06-13 22:19       ` Boris Ostrovsky
2018-06-13 22:19       ` Boris Ostrovsky
2018-06-14  5:41         ` Oleksandr Andrushchenko
2018-06-14  5:41         ` Oleksandr Andrushchenko
2018-06-13  2:58   ` Boris Ostrovsky
2018-06-12 13:42 ` [PATCH v3 9/9] xen/gntdev: Implement dma-buf import functionality Oleksandr Andrushchenko
2018-06-13  3:14   ` Boris Ostrovsky
2018-06-13  9:04     ` Oleksandr Andrushchenko
2018-06-13  9:04     ` Oleksandr Andrushchenko [this message]
2018-06-13 22:03       ` Boris Ostrovsky
2018-06-13 22:03       ` Boris Ostrovsky
2018-06-14  6:39         ` Oleksandr Andrushchenko
2018-06-14  6:39         ` Oleksandr Andrushchenko
2018-06-13  3:14   ` Boris Ostrovsky
2018-06-12 13:42 ` Oleksandr Andrushchenko
2018-06-14  6:47 ` [PATCH v3 0/9] xen: dma-buf support for grant device Oleksandr Andrushchenko
2018-06-14  6:47 ` Oleksandr Andrushchenko
2018-06-14 17:48   ` Boris Ostrovsky
2018-06-14 17:48   ` Boris Ostrovsky

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=cca7b9dd-a0c6-8052-c294-9e6c5d65e9eb@epam.com \
    --to=oleksandr_andrushchenko@epam.com \
    --cc=andr2000@gmail.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=daniel.vetter@intel.com \
    --cc=dongwon.kim@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=matthew.d.roper@intel.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.