* [PATCH] dma-buf: Provide wrappers for reservation's lock @ 2016-11-15 15:46 Chris Wilson 2016-11-15 17:16 ` ✓ Fi.CI.BAT: success for " Patchwork 2016-11-15 21:43 ` [PATCH] " Daniel Vetter 0 siblings, 2 replies; 6+ messages in thread From: Chris Wilson @ 2016-11-15 15:46 UTC (permalink / raw) To: dri-devel; +Cc: intel-gfx, Sumit Semwal Joonas complained that writing ww_mutex_lock(&resv->lock, ctx) was too intrusive compared to reservation_object_lock(resv, ctx); 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> --- include/linux/reservation.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/linux/reservation.h b/include/linux/reservation.h index ed238961e1bf..9cfc0d857862 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h @@ -129,6 +129,40 @@ reservation_object_fini(struct reservation_object *obj) } /** + * reservation_object_lock - lock the reservation object + * @obj: the reservation object + * @ctx: the locking context + * + * Locks 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. + * + * As the reservation object may be locked by multiple parties in an + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation + * object may be locked by itself by passing NULL as @ctx. + */ +static inline int +reservation_object_lock(struct reservation_object *obj, + struct ww_acquire_ctx *ctx) +{ + return ww_mutex_lock(&obj->lock, ctx); +} + +/** + * reservation_object_unlock - unlock the reservation object + * @obj: the reservation object + * + * Unlocks the reservation object following exclusive access. + */ +static inline void +reservation_object_unlock(struct reservation_object *obj) +{ + ww_mutex_unlock(&obj->lock); +} + +/** * reservation_object_get_excl - get the reservation object's * exclusive fence, with update-side lock held * @obj: the reservation object -- 2.10.2 _______________________________________________ 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: Provide wrappers for reservation's lock 2016-11-15 15:46 [PATCH] dma-buf: Provide wrappers for reservation's lock Chris Wilson @ 2016-11-15 17:16 ` Patchwork 2016-11-15 21:43 ` [PATCH] " Daniel Vetter 1 sibling, 0 replies; 6+ messages in thread From: Patchwork @ 2016-11-15 17:16 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx == Series Details == Series: dma-buf: Provide wrappers for reservation's lock URL : https://patchwork.freedesktop.org/series/15353/ State : success == Summary == Series 15353v1 dma-buf: Provide wrappers for reservation's lock https://patchwork.freedesktop.org/api/1.0/series/15353/revisions/1/mbox/ fi-bdw-5557u total:244 pass:229 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:244 pass:204 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:244 pass:191 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7200u total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:244 pass:223 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:244 pass:222 dwarn:1 dfail:0 fail:0 skip:21 fi-skl-6770hq total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:244 pass:211 dwarn:0 dfail:0 fail:0 skip:33 04145fe15cf8c81c221e62fc9d65d93053f9bd1a drm-intel-nightly: 2016y-11m-15d-14h-47m-07s UTC integration manifest e98f07e dma-buf: Provide wrappers for reservation's lock == Logs == For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3004/ _______________________________________________ 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: Provide wrappers for reservation's lock 2016-11-15 15:46 [PATCH] dma-buf: Provide wrappers for reservation's lock Chris Wilson 2016-11-15 17:16 ` ✓ Fi.CI.BAT: success for " Patchwork @ 2016-11-15 21:43 ` Daniel Vetter 2016-12-11 17:12 ` Chris Wilson 1 sibling, 1 reply; 6+ messages in thread From: Daniel Vetter @ 2016-11-15 21:43 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx, Joonas Lahtinen, dri-devel On Tue, Nov 15, 2016 at 03:46:42PM +0000, Chris Wilson wrote: > Joonas complained that writing ww_mutex_lock(&resv->lock, ctx) was too > intrusive compared to reservation_object_lock(resv, ctx); > > 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> > --- > include/linux/reservation.h | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/include/linux/reservation.h b/include/linux/reservation.h > index ed238961e1bf..9cfc0d857862 100644 > --- a/include/linux/reservation.h > +++ b/include/linux/reservation.h > @@ -129,6 +129,40 @@ reservation_object_fini(struct reservation_object *obj) > } > > /** > + * reservation_object_lock - lock the reservation object > + * @obj: the reservation object > + * @ctx: the locking context > + * > + * Locks 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. > + * > + * As the reservation object may be locked by multiple parties in an > + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle s/#/&/ for struct references. Otherwise the magic hotlink won't appear (once we get around to pulling all the core docs into the overall sphinx build). I can fix this while applying if everyone else is ok with the patch - imo it makes sense. -Daniel > + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation > + * object may be locked by itself by passing NULL as @ctx. > + */ > +static inline int > +reservation_object_lock(struct reservation_object *obj, > + struct ww_acquire_ctx *ctx) > +{ > + return ww_mutex_lock(&obj->lock, ctx); > +} > + > +/** > + * reservation_object_unlock - unlock the reservation object > + * @obj: the reservation object > + * > + * Unlocks the reservation object following exclusive access. > + */ > +static inline void > +reservation_object_unlock(struct reservation_object *obj) > +{ > + ww_mutex_unlock(&obj->lock); > +} > + > +/** > * reservation_object_get_excl - get the reservation object's > * exclusive fence, with update-side lock held > * @obj: the reservation object > -- > 2.10.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ 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
* Re: [PATCH] dma-buf: Provide wrappers for reservation's lock 2016-11-15 21:43 ` [PATCH] " Daniel Vetter @ 2016-12-11 17:12 ` Chris Wilson 2016-12-11 21:05 ` Alex Deucher 0 siblings, 1 reply; 6+ messages in thread From: Chris Wilson @ 2016-12-11 17:12 UTC (permalink / raw) To: Daniel Vetter; +Cc: intel-gfx, Joonas Lahtinen, dri-devel On Tue, Nov 15, 2016 at 10:43:34PM +0100, Daniel Vetter wrote: > On Tue, Nov 15, 2016 at 03:46:42PM +0000, Chris Wilson wrote: > > Joonas complained that writing ww_mutex_lock(&resv->lock, ctx) was too > > intrusive compared to reservation_object_lock(resv, ctx); > > > > 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> > > --- > > include/linux/reservation.h | 34 ++++++++++++++++++++++++++++++++++ > > 1 file changed, 34 insertions(+) > > > > diff --git a/include/linux/reservation.h b/include/linux/reservation.h > > index ed238961e1bf..9cfc0d857862 100644 > > --- a/include/linux/reservation.h > > +++ b/include/linux/reservation.h > > @@ -129,6 +129,40 @@ reservation_object_fini(struct reservation_object *obj) > > } > > > > /** > > + * reservation_object_lock - lock the reservation object > > + * @obj: the reservation object > > + * @ctx: the locking context > > + * > > + * Locks 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. > > + * > > + * As the reservation object may be locked by multiple parties in an > > + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle > > s/#/&/ for struct references. Otherwise the magic hotlink won't appear > (once we get around to pulling all the core docs into the overall sphinx > build). I can fix this while applying if everyone else is ok with the > patch - imo it makes sense. Anyone want to second these ww_mutex wrappers for reservation objects? > > + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation > > + * object may be locked by itself by passing NULL as @ctx. > > + */ > > +static inline int > > +reservation_object_lock(struct reservation_object *obj, > > + struct ww_acquire_ctx *ctx) > > +{ > > + return ww_mutex_lock(&obj->lock, ctx); > > +} > > + > > +/** > > + * reservation_object_unlock - unlock the reservation object > > + * @obj: the reservation object > > + * > > + * Unlocks the reservation object following exclusive access. > > + */ > > +static inline void > > +reservation_object_unlock(struct reservation_object *obj) > > +{ > > + ww_mutex_unlock(&obj->lock); > > +} > > + > > +/** > > * reservation_object_get_excl - get the reservation object's > > * exclusive fence, with update-side lock held > > * @obj: the reservation object -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ 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
* Re: [PATCH] dma-buf: Provide wrappers for reservation's lock 2016-12-11 17:12 ` Chris Wilson @ 2016-12-11 21:05 ` Alex Deucher 2016-12-12 6:55 ` Daniel Vetter 0 siblings, 1 reply; 6+ messages in thread From: Alex Deucher @ 2016-12-11 21:05 UTC (permalink / raw) To: Chris Wilson, Daniel Vetter, Maling list - DRI developers, Intel Graphics Development, Joonas Lahtinen On Sun, Dec 11, 2016 at 12:12 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote: > On Tue, Nov 15, 2016 at 10:43:34PM +0100, Daniel Vetter wrote: >> On Tue, Nov 15, 2016 at 03:46:42PM +0000, Chris Wilson wrote: >> > Joonas complained that writing ww_mutex_lock(&resv->lock, ctx) was too >> > intrusive compared to reservation_object_lock(resv, ctx); >> > >> > 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> >> > --- >> > include/linux/reservation.h | 34 ++++++++++++++++++++++++++++++++++ >> > 1 file changed, 34 insertions(+) >> > >> > diff --git a/include/linux/reservation.h b/include/linux/reservation.h >> > index ed238961e1bf..9cfc0d857862 100644 >> > --- a/include/linux/reservation.h >> > +++ b/include/linux/reservation.h >> > @@ -129,6 +129,40 @@ reservation_object_fini(struct reservation_object *obj) >> > } >> > >> > /** >> > + * reservation_object_lock - lock the reservation object >> > + * @obj: the reservation object >> > + * @ctx: the locking context >> > + * >> > + * Locks 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. >> > + * >> > + * As the reservation object may be locked by multiple parties in an >> > + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle >> >> s/#/&/ for struct references. Otherwise the magic hotlink won't appear >> (once we get around to pulling all the core docs into the overall sphinx >> build). I can fix this while applying if everyone else is ok with the >> patch - imo it makes sense. > > Anyone want to second these ww_mutex wrappers for reservation objects? Looks good to me. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> > >> > + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation >> > + * object may be locked by itself by passing NULL as @ctx. >> > + */ >> > +static inline int >> > +reservation_object_lock(struct reservation_object *obj, >> > + struct ww_acquire_ctx *ctx) >> > +{ >> > + return ww_mutex_lock(&obj->lock, ctx); >> > +} >> > + >> > +/** >> > + * reservation_object_unlock - unlock the reservation object >> > + * @obj: the reservation object >> > + * >> > + * Unlocks the reservation object following exclusive access. >> > + */ >> > +static inline void >> > +reservation_object_unlock(struct reservation_object *obj) >> > +{ >> > + ww_mutex_unlock(&obj->lock); >> > +} >> > + >> > +/** >> > * reservation_object_get_excl - get the reservation object's >> > * exclusive fence, with update-side lock held >> > * @obj: the reservation object > > -- > Chris Wilson, Intel Open Source Technology Centre > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel _______________________________________________ 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: Provide wrappers for reservation's lock 2016-12-11 21:05 ` Alex Deucher @ 2016-12-12 6:55 ` Daniel Vetter 0 siblings, 0 replies; 6+ messages in thread From: Daniel Vetter @ 2016-12-12 6:55 UTC (permalink / raw) To: Alex Deucher; +Cc: Intel Graphics Development, Maling list - DRI developers On Sun, Dec 11, 2016 at 04:05:21PM -0500, Alex Deucher wrote: > On Sun, Dec 11, 2016 at 12:12 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote: > > On Tue, Nov 15, 2016 at 10:43:34PM +0100, Daniel Vetter wrote: > >> On Tue, Nov 15, 2016 at 03:46:42PM +0000, Chris Wilson wrote: > >> > Joonas complained that writing ww_mutex_lock(&resv->lock, ctx) was too > >> > intrusive compared to reservation_object_lock(resv, ctx); > >> > > >> > 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> > >> > --- > >> > include/linux/reservation.h | 34 ++++++++++++++++++++++++++++++++++ > >> > 1 file changed, 34 insertions(+) > >> > > >> > diff --git a/include/linux/reservation.h b/include/linux/reservation.h > >> > index ed238961e1bf..9cfc0d857862 100644 > >> > --- a/include/linux/reservation.h > >> > +++ b/include/linux/reservation.h > >> > @@ -129,6 +129,40 @@ reservation_object_fini(struct reservation_object *obj) > >> > } > >> > > >> > /** > >> > + * reservation_object_lock - lock the reservation object > >> > + * @obj: the reservation object > >> > + * @ctx: the locking context > >> > + * > >> > + * Locks 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. > >> > + * > >> > + * As the reservation object may be locked by multiple parties in an > >> > + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle > >> > >> s/#/&/ for struct references. Otherwise the magic hotlink won't appear > >> (once we get around to pulling all the core docs into the overall sphinx > >> build). I can fix this while applying if everyone else is ok with the > >> patch - imo it makes sense. > > > > Anyone want to second these ww_mutex wrappers for reservation objects? > > Looks good to me. > > Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Applied to drm-misc, thanks. -Daniel > > > > >> > + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation > >> > + * object may be locked by itself by passing NULL as @ctx. > >> > + */ > >> > +static inline int > >> > +reservation_object_lock(struct reservation_object *obj, > >> > + struct ww_acquire_ctx *ctx) > >> > +{ > >> > + return ww_mutex_lock(&obj->lock, ctx); > >> > +} > >> > + > >> > +/** > >> > + * reservation_object_unlock - unlock the reservation object > >> > + * @obj: the reservation object > >> > + * > >> > + * Unlocks the reservation object following exclusive access. > >> > + */ > >> > +static inline void > >> > +reservation_object_unlock(struct reservation_object *obj) > >> > +{ > >> > + ww_mutex_unlock(&obj->lock); > >> > +} > >> > + > >> > +/** > >> > * reservation_object_get_excl - get the reservation object's > >> > * exclusive fence, with update-side lock held > >> > * @obj: the reservation object > > > > -- > > Chris Wilson, Intel Open Source Technology Centre > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- 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:[~2016-12-12 6:55 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-11-15 15:46 [PATCH] dma-buf: Provide wrappers for reservation's lock Chris Wilson 2016-11-15 17:16 ` ✓ Fi.CI.BAT: success for " Patchwork 2016-11-15 21:43 ` [PATCH] " Daniel Vetter 2016-12-11 17:12 ` Chris Wilson 2016-12-11 21:05 ` Alex Deucher 2016-12-12 6:55 ` Daniel Vetter
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).