All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-buf/reservation: Wrap ww_mutex_trylock
@ 2017-02-21  9:30 Chris Wilson
  2017-02-21 10:52 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-21  9:30 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, Joonas Lahtinen

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>
---
 include/linux/reservation.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/linux/reservation.h b/include/linux/reservation.h
index 24da961b085d..28d544364e52 100644
--- a/include/linux/reservation.h
+++ b/include/linux/reservation.h
@@ -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
+reservation_object_trylock(struct reservation_object *obj)
+{
+	return ww_mutex_trylock(&obj->lock);
+}
+
+/**
  * reservation_object_unlock - unlock the reservation object
  * @obj: the reservation object
  *
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* ✓ Fi.CI.BAT: success for dma-buf/reservation: Wrap ww_mutex_trylock
  2017-02-21  9:30 [PATCH] dma-buf/reservation: Wrap ww_mutex_trylock Chris Wilson
@ 2017-02-21 10:52 ` Patchwork
  2017-02-21 12:38 ` [PATCH] " Joonas Lahtinen
  2017-02-21 14:22 ` ✓ Fi.CI.BAT: success for dma-buf/reservation: Wrap ww_mutex_trylock (rev2) Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-02-21 10:52 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: dma-buf/reservation: Wrap ww_mutex_trylock
URL   : https://patchwork.freedesktop.org/series/19997/
State : success

== Summary ==

Series 19997v1 dma-buf/reservation: Wrap ww_mutex_trylock
https://patchwork.freedesktop.org/api/1.0/series/19997/revisions/1/mbox/

fi-bdw-5557u     total:253  pass:242  dwarn:0   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:253  pass:214  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:253  pass:234  dwarn:0   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:83   pass:70   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:253  pass:226  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:253  pass:222  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:253  pass:237  dwarn:0   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:253  pass:237  dwarn:0   dfail:0   fail:0   skip:16 
fi-ilk-650       total:253  pass:203  dwarn:0   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:253  pass:235  dwarn:0   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:253  pass:235  dwarn:0   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:253  pass:235  dwarn:0   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:253  pass:243  dwarn:0   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:253  pass:236  dwarn:0   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:253  pass:231  dwarn:4   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:253  pass:243  dwarn:0   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:253  pass:225  dwarn:0   dfail:0   fail:0   skip:28 
fi-snb-2600      total:253  pass:224  dwarn:0   dfail:0   fail:0   skip:29 

0a03ea9496b49746b4964d05cc1f483385d1df8a drm-tip: 2017y-02m-20d-17h-19m-56s UTC integration manifest
13af42f dma-buf/reservation: Wrap ww_mutex_trylock

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3908/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dma-buf/reservation: Wrap ww_mutex_trylock
  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
  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
  2 siblings, 2 replies; 6+ messages in thread
From: Joonas Lahtinen @ 2017-02-21 12:38 UTC (permalink / raw)
  To: Chris Wilson, dri-devel; +Cc: Daniel Vetter, intel-gfx

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] dma-buf/reservation: Wrap ww_mutex_trylock
  2017-02-21 12:38 ` [PATCH] " Joonas Lahtinen
@ 2017-02-21 12:48   ` Chris Wilson
  2017-02-26 21:39   ` [PATCH] " Daniel Vetter
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-21 12:48 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, Sumit Semwal

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.

v2: Add __must_check

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>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 include/linux/reservation.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/linux/reservation.h b/include/linux/reservation.h
index 24da961b085d..dcac9a4d9bad 100644
--- a/include/linux/reservation.h
+++ b/include/linux/reservation.h
@@ -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, see ww_mutex_trylock().
+ *
+ * Returns true if the lock was acquired, false otherwise.
+ */
+static inline __must_check bool
+reservation_object_trylock(struct reservation_object *obj)
+{
+	return ww_mutex_trylock(&obj->lock);
+}
+
+/**
  * reservation_object_unlock - unlock the reservation object
  * @obj: the reservation object
  *
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* ✓ Fi.CI.BAT: success for dma-buf/reservation: Wrap ww_mutex_trylock (rev2)
  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 ` [PATCH] " Joonas Lahtinen
@ 2017-02-21 14:22 ` Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-02-21 14:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: dma-buf/reservation: Wrap ww_mutex_trylock (rev2)
URL   : https://patchwork.freedesktop.org/series/19997/
State : success

== Summary ==

Series 19997v2 dma-buf/reservation: Wrap ww_mutex_trylock
https://patchwork.freedesktop.org/api/1.0/series/19997/revisions/2/mbox/

Test kms_force_connector_basic:
        Subgroup prune-stale-modes:
                skip       -> PASS       (fi-ivb-3520m)

fi-bdw-5557u     total:253  pass:242  dwarn:0   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:253  pass:214  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:253  pass:234  dwarn:0   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:83   pass:70   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:253  pass:226  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:253  pass:222  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:253  pass:237  dwarn:0   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:253  pass:237  dwarn:0   dfail:0   fail:0   skip:16 
fi-ilk-650       total:253  pass:203  dwarn:0   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:253  pass:235  dwarn:0   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:253  pass:235  dwarn:0   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:253  pass:235  dwarn:0   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:253  pass:243  dwarn:0   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:253  pass:236  dwarn:0   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:253  pass:231  dwarn:4   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:253  pass:243  dwarn:0   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:253  pass:225  dwarn:0   dfail:0   fail:0   skip:28 
fi-snb-2600      total:253  pass:224  dwarn:0   dfail:0   fail:0   skip:29 

d6ab175397580281e76a5e473410caa8a7dc6881 drm-tip: 2017y-02m-21d-13h-19m-43s UTC integration manifest
b4e67c6 dma-buf/reservation: Wrap ww_mutex_trylock

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3912/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dma-buf/reservation: Wrap ww_mutex_trylock
  2017-02-21 12:38 ` [PATCH] " Joonas Lahtinen
  2017-02-21 12:48   ` [PATCH v2] " Chris Wilson
@ 2017-02-26 21:39   ` Daniel Vetter
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2017-02-26 21:39 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: Daniel Vetter, intel-gfx, Sumit Semwal, dri-devel

On Tue, Feb 21, 2017 at 02:38:07PM +0200, Joonas Lahtinen wrote:
> 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;

Done and applied, thanks.
-Daniel

> 
> 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

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-26 21:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH] " Joonas Lahtinen
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

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.