* [PATCH 1/2] drm/syncobj: Mark up the fence as an RCU protected pointer
@ 2017-09-01 14:57 Chris Wilson
2017-09-01 14:57 ` [PATCH 2/2] dma-buf/fence: Sparse wants __rcu on the object itself Chris Wilson
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Chris Wilson @ 2017-09-01 14:57 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
We take advantage of that syncobj->fence is an RCU-protected pointer, and
so sparse complains that it is lacking annotation.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
include/drm/drm_syncobj.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h
index c00fee539822..455660673259 100644
--- a/include/drm/drm_syncobj.h
+++ b/include/drm/drm_syncobj.h
@@ -49,7 +49,7 @@ struct drm_syncobj {
* This field should not be used directly. Use drm_syncobj_fence_get
* and drm_syncobj_replace_fence instead.
*/
- struct dma_fence *fence;
+ struct dma_fence __rcu *fence;
/**
* @cb_list:
* List of callbacks to call when the fence gets replaced
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] dma-buf/fence: Sparse wants __rcu on the object itself
2017-09-01 14:57 [PATCH 1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Chris Wilson
@ 2017-09-01 14:57 ` Chris Wilson
2017-09-01 15:30 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Patchwork
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-09-01 14:57 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
In order to silent sparse in dma_fence_get_rcu_safe(), we need to mark
the incoming fence object as being RCU protected and not the pointer to
the object.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
include/linux/dma-fence.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 171895072435..bad861f8f914 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -242,7 +242,7 @@ static inline struct dma_fence *dma_fence_get_rcu(struct dma_fence *fence)
* The caller is required to hold the RCU read lock.
*/
static inline struct dma_fence *
-dma_fence_get_rcu_safe(struct dma_fence * __rcu *fencep)
+dma_fence_get_rcu_safe(struct dma_fence __rcu **fencep)
{
do {
struct dma_fence *fence;
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer
2017-09-01 14:57 [PATCH 1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Chris Wilson
2017-09-01 14:57 ` [PATCH 2/2] dma-buf/fence: Sparse wants __rcu on the object itself Chris Wilson
@ 2017-09-01 15:30 ` Patchwork
2017-09-01 16:27 ` [PATCH 1/2] " Ville Syrjälä
2017-09-01 18:55 ` ✓ Fi.CI.IGT: success for series starting with [1/2] " Patchwork
3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-09-01 15:30 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer
URL : https://patchwork.freedesktop.org/series/29700/
State : success
== Summary ==
Series 29700v1 series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer
https://patchwork.freedesktop.org/api/1.0/series/29700/revisions/1/mbox/
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-snb-2600) fdo#100215
Test kms_flip:
Subgroup basic-flip-vs-modeset:
skip -> PASS (fi-skl-x1585l) fdo#101781
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> PASS (fi-byt-n2820) fdo#101705
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705
fi-bdw-5557u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:455s
fi-bdw-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:443s
fi-blb-e6850 total:288 pass:224 dwarn:1 dfail:0 fail:0 skip:63 time:362s
fi-bsw-n3050 total:288 pass:243 dwarn:0 dfail:0 fail:0 skip:45 time:553s
fi-bwr-2160 total:288 pass:184 dwarn:0 dfail:0 fail:0 skip:104 time:253s
fi-bxt-j4205 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:526s
fi-byt-j1900 total:288 pass:254 dwarn:1 dfail:0 fail:0 skip:33 time:526s
fi-byt-n2820 total:288 pass:251 dwarn:0 dfail:0 fail:0 skip:37 time:517s
fi-elk-e7500 total:288 pass:230 dwarn:0 dfail:0 fail:0 skip:58 time:437s
fi-glk-2a total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:609s
fi-hsw-4770 total:288 pass:263 dwarn:0 dfail:0 fail:0 skip:25 time:452s
fi-hsw-4770r total:288 pass:263 dwarn:0 dfail:0 fail:0 skip:25 time:427s
fi-ilk-650 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:422s
fi-ivb-3520m total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:502s
fi-ivb-3770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:474s
fi-kbl-7500u total:288 pass:264 dwarn:1 dfail:0 fail:0 skip:23 time:516s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:595s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:602s
fi-pnv-d510 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:522s
fi-skl-6260u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:474s
fi-skl-6700k total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:539s
fi-skl-6770hq total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:488s
fi-skl-gvtdvm total:288 pass:266 dwarn:0 dfail:0 fail:0 skip:22 time:444s
fi-skl-x1585l total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:503s
fi-snb-2520m total:288 pass:251 dwarn:0 dfail:0 fail:0 skip:37 time:547s
fi-snb-2600 total:288 pass:249 dwarn:0 dfail:0 fail:1 skip:38 time:401s
8b962a9a16b3a4e3cc2a56cba82ee9c0dc0941b5 drm-tip: 2017y-09m-01d-13h-56m-06s UTC integration manifest
b14fe9611f8f dma-buf/fence: Sparse wants __rcu on the object itself
0ac977638e78 drm/syncobj: Mark up the fence as an RCU protected pointer
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5565/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/syncobj: Mark up the fence as an RCU protected pointer
2017-09-01 14:57 [PATCH 1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Chris Wilson
2017-09-01 14:57 ` [PATCH 2/2] dma-buf/fence: Sparse wants __rcu on the object itself Chris Wilson
2017-09-01 15:30 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Patchwork
@ 2017-09-01 16:27 ` Ville Syrjälä
2017-09-01 18:55 ` ✓ Fi.CI.IGT: success for series starting with [1/2] " Patchwork
3 siblings, 0 replies; 5+ messages in thread
From: Ville Syrjälä @ 2017-09-01 16:27 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, dri-devel
On Fri, Sep 01, 2017 at 03:57:06PM +0100, Chris Wilson wrote:
> We take advantage of that syncobj->fence is an RCU-protected pointer, and
> so sparse complains that it is lacking annotation.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> include/drm/drm_syncobj.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h
> index c00fee539822..455660673259 100644
> --- a/include/drm/drm_syncobj.h
> +++ b/include/drm/drm_syncobj.h
> @@ -49,7 +49,7 @@ struct drm_syncobj {
> * This field should not be used directly. Use drm_syncobj_fence_get
> * and drm_syncobj_replace_fence instead.
> */
> - struct dma_fence *fence;
> + struct dma_fence __rcu *fence;
drm_syncobj.c uses that pointer directly quite a bit which seems to
generate more sparse warnings.
Would something like this be needed (just typing stuff blindly here)?
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 0422b8c2c2e7..1786787ecc30 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -106,7 +106,8 @@ static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj,
* callback when a fence has already been set.
*/
if (syncobj->fence) {
- *fence = dma_fence_get(syncobj->fence);
+ *fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
+ lockdep_is_held(&syncobj->lock)));
ret = 1;
} else {
*fence = NULL;
@@ -168,8 +169,9 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
spin_lock(&syncobj->lock);
- old_fence = syncobj->fence;
- syncobj->fence = fence;
+ old_fence = rcu_dereference_protected(syncobj->fence,
+ lockdep_is_held(&syncobj->lock));
+ rcu_assign_pointer(syncobj->fence, fence);
if (fence != old_fence) {
list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) {
@@ -613,7 +615,8 @@ static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj,
container_of(cb, struct syncobj_wait_entry, syncobj_cb);
/* This happens inside the syncobj lock */
- wait->fence = dma_fence_get(syncobj->fence);
+ wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
+ lockdep_is_held(&syncobj->lock)));
wake_up_process(wait->task);
}
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* ✓ Fi.CI.IGT: success for series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer
2017-09-01 14:57 [PATCH 1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Chris Wilson
` (2 preceding siblings ...)
2017-09-01 16:27 ` [PATCH 1/2] " Ville Syrjälä
@ 2017-09-01 18:55 ` Patchwork
3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-09-01 18:55 UTC (permalink / raw)
To: ville.syrjala; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer
URL : https://patchwork.freedesktop.org/series/29700/
State : success
== Summary ==
Test perf:
Subgroup polling:
fail -> PASS (shard-hsw) fdo#102252
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2263 pass:1233 dwarn:0 dfail:0 fail:14 skip:1015 time:9439s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5565/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-01 18:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 14:57 [PATCH 1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Chris Wilson
2017-09-01 14:57 ` [PATCH 2/2] dma-buf/fence: Sparse wants __rcu on the object itself Chris Wilson
2017-09-01 15:30 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/syncobj: Mark up the fence as an RCU protected pointer Patchwork
2017-09-01 16:27 ` [PATCH 1/2] " Ville Syrjälä
2017-09-01 18:55 ` ✓ Fi.CI.IGT: success for series starting with [1/2] " 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.