dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
	Maarten Lankhorst <maarten.lankhorst@canonical.com>
Subject: Re: [Linaro-mm-sig] [PATCH 6/7] reservation: cross-device reservation support
Date: Mon, 4 Feb 2013 16:06:55 +0900	[thread overview]
Message-ID: <CAAQKjZPJX9Rt0LH0PMpwRSv3etNvoGh3MvNcmFpvCXTtJeeFqw@mail.gmail.com> (raw)
In-Reply-To: <1358253244-11453-7-git-send-email-maarten.lankhorst@canonical.com>

> +/**
> + * ticket_commit - commit a reservation with a new fence
> + * @ticket:    [in]    the reservation_ticket returned by
> + * ticket_reserve
> + * @entries:   [in]    a linked list of struct reservation_entry
> + * @fence:     [in]    the fence that indicates completion
> + *
> + * This function will call reservation_ticket_fini, no need
> + * to do it manually.
> + *
> + * This function should be called after a hardware command submission is
> + * completed succesfully. The fence is used to indicate completion of
> + * those commands.
> + */
> +void
> +ticket_commit(struct reservation_ticket *ticket,
> +                 struct list_head *entries, struct fence *fence)
> +{
> +       struct list_head *cur;
> +
> +       if (list_empty(entries))
> +               return;
> +
> +       if (WARN_ON(!fence)) {
> +               ticket_backoff(ticket, entries);
> +               return;
> +       }
> +
> +       list_for_each(cur, entries) {
> +               struct reservation_object *bo;
> +               bool shared;
> +
> +               reservation_entry_get(cur, &bo, &shared);
> +
> +               if (!shared) {
> +                       int i;
> +                       for (i = 0; i < bo->fence_shared_count; ++i) {
> +                               fence_put(bo->fence_shared[i]);
> +                               bo->fence_shared[i] = NULL;
> +                       }
> +                       bo->fence_shared_count = 0;
> +                       if (bo->fence_excl)
> +                               fence_put(bo->fence_excl);
> +
> +                       bo->fence_excl = fence;
> +               } else {
> +                       if (WARN_ON(bo->fence_shared_count >=
> +                                   ARRAY_SIZE(bo->fence_shared))) {
> +                               mutex_unreserve_unlock(&bo->lock);
> +                               continue;
> +                       }
> +
> +                       bo->fence_shared[bo->fence_shared_count++] = fence;
> +               }

Hi,

I got some questions to fence_excl and fence_shared. At the above
code, if bo->fence_excl is not NULL then it puts bo->fence_excl and
sets a new fence to it. This seems like that someone that committed a
new fence, wants to access the given dmabuf exclusively even if
someone is accessing the given dmabuf.

On the other hand, in case of fence_shared, someone wants to access
that dmabuf non-exclusively. So this case seems like that the given
dmabuf could be accessed by two more devices. So I guess that the
fence_excl could be used for write access(may need buffer sync like
blocking) and read access for the fence_shared(may not need buffer
sync). I'm not sure that I understand these two things correctly so
could you please give me more comments for them?

Thanks,
Inki Dae

> +               fence_get(fence);
> +
> +               mutex_unreserve_unlock(&bo->lock);
> +       }
> +       reservation_ticket_fini(ticket);
> +}
> +EXPORT_SYMBOL(ticket_commit);

  parent reply	other threads:[~2013-02-04  7:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 12:33 [PATCH 0/7] cross-device reservation for dma-buf support Maarten Lankhorst
2013-01-15 12:33 ` [PATCH 1/7] arch: add __mutex_fastpath_lock_retval_arg to generic/sh/x86/powerpc/ia64 Maarten Lankhorst
2013-01-15 13:49   ` Maarten Lankhorst
2013-01-15 12:33 ` [PATCH 2/7] mutex: add support for reservation style locks Maarten Lankhorst
2013-01-15 13:43   ` Maarten Lankhorst
2013-01-30  1:07   ` Rob Clark
2013-01-30 11:08     ` Daniel Vetter
2013-01-30 11:52       ` Rob Clark
2013-01-31 13:38         ` Rob Clark
2013-01-30 11:16     ` Maarten Lankhorst
2013-01-15 12:34 ` [PATCH 3/7] sched: allow try_to_wake_up to be used internally outside of core.c Maarten Lankhorst
2013-01-15 12:34 ` [PATCH 4/7] fence: dma-buf cross-device synchronization (v11) Maarten Lankhorst
2013-01-22 15:13   ` [Linaro-mm-sig] " Francesco Lavra
2013-01-23 14:56     ` Maarten Lankhorst
2013-01-23 17:14       ` Francesco Lavra
2013-01-31  9:32   ` Inki Dae
2013-01-31  9:53     ` Maarten Lankhorst
2013-01-31  9:57     ` Daniel Vetter
2013-01-31 14:38       ` Inki Dae
2013-01-31 14:49         ` Daniel Vetter
2013-01-15 12:34 ` [PATCH 5/7] seqno-fence: Hardware dma-buf implementation of fencing (v4) Maarten Lankhorst
2013-01-16  6:28   ` [Linaro-mm-sig] " Inki Dae
2013-01-16 10:36     ` Maarten Lankhorst
2013-01-16 12:00       ` Inki Dae
2013-01-24 14:52       ` Inki Dae
2013-01-15 12:34 ` [PATCH 6/7] reservation: cross-device reservation support Maarten Lankhorst
2013-01-22 16:47   ` [Linaro-mm-sig] " Francesco Lavra
2013-01-22 17:04     ` Maarten Lankhorst
2013-02-04  7:06   ` Inki Dae [this message]
2013-02-04  9:57     ` Maarten Lankhorst
2013-02-04 14:51       ` Daniel Vetter
2013-01-15 12:34 ` [PATCH 7/7] reservation: Add lockdep annotation and selftests Maarten Lankhorst

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=CAAQKjZPJX9Rt0LH0PMpwRSv3etNvoGh3MvNcmFpvCXTtJeeFqw@mail.gmail.com \
    --to=inki.dae@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.b.lankhorst@gmail.com \
    --cc=maarten.lankhorst@canonical.com \
    /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).