All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] dma-buf/reservation: Wrap ww_mutex_trylock
Date: Tue, 21 Feb 2017 14:38:07 +0200	[thread overview]
Message-ID: <1487680687.3137.3.camel@linux.intel.com> (raw)
In-Reply-To: <20170221093000.22802-1-chris@chris-wilson.co.uk>

On ti, 2017-02-21 at 09:30 +0000, Chris Wilson wrote:
> In a similar fashion to reservation_object_lock() and
> reservation_object_unlock(), ww_mutex_trylock is also useful and so is
> worth wrapping for consistency.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

<SNIP>

> @@ -151,6 +151,26 @@ reservation_object_lock(struct reservation_object *obj,
>  }
>  
>  /**
> + * reservation_object_trylock - trylock the reservation object
> + * @obj: the reservation object
> + *
> + * Tries to lock the reservation object for exclusive access and modification.
> + * Note, that the lock is only against other writers, readers will run
> + * concurrently with a writer under RCU. The seqlock is used to notify readers
> + * if they overlap with a writer.
> + *
> + * Also note that since no context is provided, no deadlock protection is
> + * possible.
> + *
> + * Returns true if the lock was acquired, false otherwise.
> + */
> +static inline bool

I'd carry over the __must_check flag, with that;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas

> +reservation_object_trylock(struct reservation_object *obj)
> +{
> +	return ww_mutex_trylock(&obj->lock);
> +}
> +
> +/**
>   * reservation_object_unlock - unlock the reservation object
>   * @obj: the reservation object
>   *
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-02-21 12:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21  9:30 [PATCH] dma-buf/reservation: Wrap ww_mutex_trylock Chris Wilson
2017-02-21 10:52 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-02-21 12:38 ` Joonas Lahtinen [this message]
2017-02-21 12:48   ` [PATCH v2] " Chris Wilson
2017-02-26 21:39   ` [PATCH] " Daniel Vetter
2017-02-21 14:22 ` ✓ Fi.CI.BAT: success for dma-buf/reservation: Wrap ww_mutex_trylock (rev2) Patchwork

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=1487680687.3137.3.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.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.