drm/atomic: protect crtc|connector->state with rcu
Subsystems (2)
PATCH 1/1 drm/atomic: protect crtc|connector->state with rcu
The vblank code really wants to look at crtc->state without having to take a ww_mutex. One option might be to take one of the vblank locks right when assigning crtc->state, which would ensure that the vblank code doesn't race and access freed memory.
But userspace tends to poke the vblank_ioctl to query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.
v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic.c +17 -9
@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);
@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } } + +/** +* __drm_atomic_state_free - free all memory for an atomic state +* @ref: This atomic state to deallocate +* +* This frees all memory associated with an atomic state, including all the +* per-object state for planes, crtcs and connectors. +*/ +void __drm_atomic_state_free (struct kref *ref) +{ +struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); + +call_rcu (&state->rhead, ___drm_atomic_state_free); +}EXPORT_SYMBOL (__drm_atomic_state_free);/**
drivers/gpu/drm/drm_atomic_helper.c +1 -1
@@ -2041,7 +2041,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, new_crtc_state->state =NULL ; state->crtcs[i].state = old_crtc_state; - crtc->state = new_crtc_state; +rcu_assign_pointer (crtc->state, new_crtc_state);if (state->crtcs[i].commit) {spin_lock (&crtc->commit_lock);
include/drm/drm_atomic.h +5 -0
@@ -28,6 +28,8 @@#ifndef DRM_ATOMIC_H_ #define DRM_ATOMIC_H_ +#include <linux/rcupdate.h> +#include <drm/drm_crtc.h> /**
@@ -188,6 +190,9 @@ struct drm_atomic_state {* commit without blocking. */ struct work_struct commit_work; + +/* private: */ +struct rcu_head rhead; };void __drm_crtc_commit_free (struct kref *kref);
include/drm/drm_connector.h +12 -1
@@ -603,7 +603,6 @@ struct drm_cmdline_mode {* @bad_edid_counter: track sinks that give us an EDID with invalid checksum * @edid_corrupt: indicates whether the last read EDID was corrupt * @debugfs_entry: debugfs directory for this connector -* @state: current atomic state for this connector * @has_tile: is this connector connected to a tiled monitor * @tile_group: tile group for the connected monitor * @tile_is_single_monitor: whether the tile is one monitor housing
@@ -771,6 +770,18 @@ struct drm_connector {struct dentry *debugfs_entry; +/** +* @state: +* +* Current atomic state for this connector. Note that this is protected +* by @mutex, but also by RCU (for the mode validation code, which needs +* to peek at this with only hold &drm_mode_config.mutex). +* +* FIXME: +* +* This isn't annoted with __rcu because fixing up all the drivers is a +* massive amount of work. +*/ struct drm_connector_state *state;/* DisplayID bits */
include/drm/drm_crtc.h +8 -1
@@ -747,7 +747,14 @@ struct drm_crtc {/** * @state: * -* Current atomic state for this CRTC. +* Current atomic state for this CRTC. Note that this is protected by +* @mutex, but also by RCU (for the vblank code, which needs to peek at +* this from interrupt context). +* +* FIXME: +* +* This isn't annoted with __rcu because fixing up all the drivers is a +* massive amount of work. */ struct drm_crtc_state *state;
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerOp 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.
I'm not sure this is the right approach for vblank.
crtc->state might not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.
Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);
drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }
whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."
Looking at
commit 6f0f02dc56f18760b46dc1bf5b3f7386869d4162
Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000
drm/i915: Move atomic state free from out of fence release
I would say that drm_atomic_state_free would definitely block..
The only thing that makes sense IMO is doing kfree_rcu on the object_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.
I think I would try to use the crtc ww_mutex in the vblank code and serialize it to pending commits, if at all possible.
Quoted 94 lines
drivers/gpu/drm/drm_atomic.c +14
-0+ +/** +* __drm_atomic_state_free - free all memory for an atomic state +* @ref: This atomic state to deallocate +* +* This frees all memory associated with an atomic state, including all the +* per-object state for planes, crtcs and connectors. +*/ +void __drm_atomic_state_free (struct kref *ref) +{ +struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); + +call_rcu (&state->rhead, ___drm_atomic_state_free); +}EXPORT_SYMBOL (__drm_atomic_state_free);/** drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2041,7 +2041,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, new_crtc_state->state =NULL ; state->crtcs[i].state = old_crtc_state; - crtc->state = new_crtc_state; +rcu_assign_pointer (crtc->state, new_crtc_state);if (state->crtcs[i].commit) {spin_lock (&crtc->commit_lock);include/drm/drm_atomic.h +5
-0@@ -28,6 +28,8 @@#ifndef DRM_ATOMIC_H_ #define DRM_ATOMIC_H_ +#include <linux/rcupdate.h> +#include <drm/drm_crtc.h> /** @@ -188,6 +190,9 @@ struct drm_atomic_state {* commit without blocking. */ struct work_struct commit_work; + +/* private: */ +struct rcu_head rhead; };void __drm_crtc_commit_free (struct kref *kref);include/drm/drm_connector.h +12
-1@@ -603,7 +603,6 @@ struct drm_cmdline_mode {* @bad_edid_counter: track sinks that give us an EDID with invalid checksum * @edid_corrupt: indicates whether the last read EDID was corrupt * @debugfs_entry: debugfs directory for this connector -* @state: current atomic state for this connector * @has_tile: is this connector connected to a tiled monitor * @tile_group: tile group for the connected monitor * @tile_is_single_monitor: whether the tile is one monitor housing @@ -771,6 +770,18 @@ struct drm_connector {struct dentry *debugfs_entry; +/** +* @state: +* +* Current atomic state for this connector. Note that this is protected +* by @mutex, but also by RCU (for the mode validation code, which needs +* to peek at this with only hold &drm_mode_config.mutex). +* +* FIXME: +* +* This isn't annoted with __rcu because fixing up all the drivers is a +* massive amount of work. +*/ struct drm_connector_state *state;/* DisplayID bits */ include/drm/drm_crtc.h +1
-1@@ -747,7 +747,14 @@ struct drm_crtc {/** * @state: * -* Current atomic state for this CRTC. +* Current atomic state for this CRTC. Note that this is protected by
include/drm/drm_crtc.h struct drm_crtc { · line 760
Quoted 10 lines
include/drm/drm_crtc.h +7
-0+* @mutex, but also by RCU (for the vblank code, which needs to peek at +* this from interrupt context). +* +* FIXME: +* +* This isn't annoted with __rcu because fixing up all the drivers is a +* massive amount of work. */ struct drm_crtc_state *state;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Maarten Lankhorst
Op 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.I'm not sure this is the right approach for vblank.
It's not, it's just that I've had to resurrect this patch quickly before leaving and accidentally left the vblank stuff in.
Quoted 60 lines
crtc->statemight not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."Looking at
commit6f0f02dc56f18760b46dc1bf5b3f7386869d4162Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000drm/i915: Move atomic state free from out of fence release
Quoted 7 lines
I would say that
drm_atomic_state_freewould definitely block..The only thing that makes sense IMO is doing
kfree_rcuon theobject_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.I think I would try to use the crtc
ww_mutexin the vblank code and serialize it to pending commits, if at all possible.
Oops. I guess it should have come with "totally untested". In that case we need a workter which does a synchronize_rcu() before releasing. I don't just want to do a simple kfree_rcu() because by that point we've (partially) destroyed the state alreayd (so it's already unsafe to access, and special ruels are ugly). And doing it here before we release anything in the core would avoid the need for drivers to bother with kfree_rcu().
I'll try to respin something less obviously buggy tomorrow :-) -Daniel
Quoted 107 lines
Quoted 105 lines
drivers/gpu/drm/drm_atomic.c +14
-0+ +/** +* __drm_atomic_state_free - free all memory for an atomic state +* @ref: This atomic state to deallocate +* +* This frees all memory associated with an atomic state, including all the +* per-object state for planes, crtcs and connectors. +*/ +void __drm_atomic_state_free (struct kref *ref) +{ +struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); + +call_rcu (&state->rhead, ___drm_atomic_state_free); +}EXPORT_SYMBOL (__drm_atomic_state_free);/** drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2041,7 +2041,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, new_crtc_state->state =NULL ; state->crtcs[i].state = old_crtc_state; - crtc->state = new_crtc_state; +rcu_assign_pointer (crtc->state, new_crtc_state);if (state->crtcs[i].commit) {spin_lock (&crtc->commit_lock);include/drm/drm_atomic.h +5
-0@@ -28,6 +28,8 @@#ifndef DRM_ATOMIC_H_ #define DRM_ATOMIC_H_ +#include <linux/rcupdate.h> +#include <drm/drm_crtc.h> /** @@ -188,6 +190,9 @@ struct drm_atomic_state {* commit without blocking. */ struct work_struct commit_work; + +/* private: */ +struct rcu_head rhead; };void __drm_crtc_commit_free (struct kref *kref);include/drm/drm_connector.h +12
-1@@ -603,7 +603,6 @@ struct drm_cmdline_mode {* @bad_edid_counter: track sinks that give us an EDID with invalid checksum * @edid_corrupt: indicates whether the last read EDID was corrupt * @debugfs_entry: debugfs directory for this connector -* @state: current atomic state for this connector * @has_tile: is this connector connected to a tiled monitor * @tile_group: tile group for the connected monitor * @tile_is_single_monitor: whether the tile is one monitor housing @@ -771,6 +770,18 @@ struct drm_connector {struct dentry *debugfs_entry; +/** +* @state: +* +* Current atomic state for this connector. Note that this is protected +* by @mutex, but also by RCU (for the mode validation code, which needs +* to peek at this with only hold &drm_mode_config.mutex). +* +* FIXME: +* +* This isn't annoted with __rcu because fixing up all the drivers is a +* massive amount of work. +*/ struct drm_connector_state *state;/* DisplayID bits */ include/drm/drm_crtc.h +8
-1@@ -747,7 +747,14 @@ struct drm_crtc {/** * @state: * -* Current atomic state for this CRTC. +* Current atomic state for this CRTC. Note that this is protected by +* @mutex, but also by RCU (for the vblank code, which needs to peek at +* this from interrupt context). +* +* FIXME: +* +* This isn't annoted with __rcu because fixing up all the drivers is a +* massive amount of work. */ struct drm_crtc_state *state;
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerOp 16-03-17 om 21:15 schreef Daniel Vetter:
Quoted 85 lines
Quoted 6 lines · Maarten Lankhorst
Op 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.I'm not sure this is the right approach for vblank.
It's not, it's just that I've had to resurrect this patch quickly before leaving and accidentally left the vblank stuff in.
Quoted 59 lines
crtc->statemight not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."Looking at
commit6f0f02dc56f18760b46dc1bf5b3f7386869d4162Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000drm/i915: Move atomic state free from out of fence release
Quoted 7 lines
I would say that
drm_atomic_state_freewould definitely block..The only thing that makes sense IMO is doing
kfree_rcuon theobject_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.I think I would try to use the crtc
ww_mutexin the vblank code and serialize it to pending commits, if at all possible.Oops. I guess it should have come with "totally untested". In that case we need a workter which does a
synchronize_rcu()before releasing. I don't just want to do a simplekfree_rcu()because by that point we've (partially) destroyed the state alreayd (so it's already unsafe to access, and special ruels are ugly). And doing it here before we release anything in the core would avoid the need for drivers to bother withkfree_rcu().
Quoted 1 line
I'll try to respin something less obviously buggy tomorrow :-)
It will still be buggy tomorrow, since you have no way to know if the current hardware crtc_state is anything like crtc->state.
:(
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 86 lines · Maarten Lankhorst
Op 16-03-17 om 21:15 schreef Daniel Vetter:
Quoted 85 lines
Quoted 6 lines · Maarten Lankhorst
Op 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.I'm not sure this is the right approach for vblank.
It's not, it's just that I've had to resurrect this patch quickly before leaving and accidentally left the vblank stuff in.
Quoted 59 lines
crtc->statemight not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."Looking at
commit6f0f02dc56f18760b46dc1bf5b3f7386869d4162Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000drm/i915: Move atomic state free from out of fence release
Quoted 7 lines
I would say that
drm_atomic_state_freewould definitely block..The only thing that makes sense IMO is doing
kfree_rcuon theobject_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.I think I would try to use the crtc
ww_mutexin the vblank code and serialize it to pending commits, if at all possible.Oops. I guess it should have come with "totally untested". In that case we need a workter which does a
synchronize_rcu()before releasing. I don't just want to do a simplekfree_rcu()because by that point we've (partially) destroyed the state alreayd (so it's already unsafe to access, and special ruels are ugly). And doing it here before we release anything in the core would avoid the need for drivers to bother withkfree_rcu().
Quoted 4 lines
Quoted 1 line
I'll try to respin something less obviously buggy tomorrow :-)
It will still be buggy tomorrow, since you have no way to know if the current hardware
crtc_stateis anything likecrtc->state.:(
Maybe I wasnt' clear, so let me retry:
- this approach doesn't work for vblank and crtc state. Agreed. I'll remove all the leftover comments I've forgotten to remove in a hurry.
- the patch itself is broken, so can't be used for connector->state peeking in mode_valid either. That one I'll fix.
Does that make sense?
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerOp 20-03-17 om 09:18 schreef Daniel Vetter:
Quoted 93 lines · Maarten Lankhorst
Quoted 86 lines
Op 16-03-17 om 21:15 schreef Daniel Vetter:
Quoted 85 lines
Quoted 6 lines · Maarten Lankhorst
Op 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.I'm not sure this is the right approach for vblank.
It's not, it's just that I've had to resurrect this patch quickly before leaving and accidentally left the vblank stuff in.
Quoted 59 lines
crtc->statemight not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."Looking at
commit6f0f02dc56f18760b46dc1bf5b3f7386869d4162Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000drm/i915: Move atomic state free from out of fence release
Quoted 7 lines
I would say that
drm_atomic_state_freewould definitely block..The only thing that makes sense IMO is doing
kfree_rcuon theobject_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.I think I would try to use the crtc
ww_mutexin the vblank code and serialize it to pending commits, if at all possible.Oops. I guess it should have come with "totally untested". In that case we need a workter which does a
synchronize_rcu()before releasing. I don't just want to do a simplekfree_rcu()because by that point we've (partially) destroyed the state alreayd (so it's already unsafe to access, and special ruels are ugly). And doing it here before we release anything in the core would avoid the need for drivers to bother withkfree_rcu().Quoted 4 lines
Quoted 1 line
I'll try to respin something less obviously buggy tomorrow :-)
It will still be buggy tomorrow, since you have no way to know if the current hardware
crtc_stateis anything likecrtc->state.:(
Maybe I wasnt' clear, so let me retry:
Quoted 8 lines
- this approach doesn't work for vblank and crtc state. Agreed. I'll remove all the leftover comments I've forgotten to remove in a hurry.
- the patch itself is broken, so can't be used for
connector->statepeeking inmode_valideither. That one I'll fix.Does that make sense?
-Daniel
Yes, but I'm still not completely convinced it's required for connector state to use RCU. During detect() we would take the connection_mutex anyway, so I can probably do that for mode_valid as well.
~Maarten
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 97 lines · Maarten Lankhorst
Op 20-03-17 om 09:18 schreef Daniel Vetter:
Quoted 96 lines · Maarten Lankhorst
Quoted 86 lines
Op 16-03-17 om 21:15 schreef Daniel Vetter:
Quoted 85 lines
Quoted 6 lines · Maarten Lankhorst
Op 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.I'm not sure this is the right approach for vblank.
It's not, it's just that I've had to resurrect this patch quickly before leaving and accidentally left the vblank stuff in.
Quoted 59 lines
crtc->statemight not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."Looking at
commit6f0f02dc56f18760b46dc1bf5b3f7386869d4162Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000drm/i915: Move atomic state free from out of fence release
Quoted 7 lines
I would say that
drm_atomic_state_freewould definitely block..The only thing that makes sense IMO is doing
kfree_rcuon theobject_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.I think I would try to use the crtc
ww_mutexin the vblank code and serialize it to pending commits, if at all possible.Oops. I guess it should have come with "totally untested". In that case we need a workter which does a
synchronize_rcu()before releasing. I don't just want to do a simplekfree_rcu()because by that point we've (partially) destroyed the state alreayd (so it's already unsafe to access, and special ruels are ugly). And doing it here before we release anything in the core would avoid the need for drivers to bother withkfree_rcu().Quoted 4 lines
Quoted 1 line
I'll try to respin something less obviously buggy tomorrow :-)
It will still be buggy tomorrow, since you have no way to know if the current hardware
crtc_stateis anything likecrtc->state.:(
Maybe I wasnt' clear, so let me retry:
- this approach doesn't work for vblank and crtc state. Agreed. I'll remove all the leftover comments I've forgotten to remove in a hurry.
Quoted 8 lines
Quoted 5 lines
- the patch itself is broken, so can't be used for
connector->statepeeking inmode_valideither. That one I'll fix.Does that make sense?
-DanielYes, but I'm still not completely convinced it's required for connector state to use RCU. During
detect()we would take theconnection_mutexanyway, so I can probably do that formode_validas well.
Why do you want to take the connection_mutex there? If we just go with taking that everywhere we touch shared state, we might as well push that up in the callchain ... With the connector_iter stuff there's no reason at all anymore to hold the mode_config.mutex for anything really around connector probing.
The only thing we need is that we pass the acquire_ctx down into callars somehow, so that the load detect stuff still works.
But my idea was kinda that we'd do the same for probe -> modeset data flows like here for the other way round: Just a bunch of READ_ONCE and maybe lookup the edid with rcu too. That way it's clear to anybody that probe and modeset are entirely not synchronized.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerOp 20-03-17 om 09:59 schreef Daniel Vetter:
Quoted 103 lines · Maarten Lankhorst
Quoted 102 lines
Op 20-03-17 om 09:18 schreef Daniel Vetter:
Quoted 101 lines · Maarten Lankhorst
Quoted 86 lines
Op 16-03-17 om 21:15 schreef Daniel Vetter:
Quoted 85 lines
Quoted 6 lines · Maarten Lankhorst
Op 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.I'm not sure this is the right approach for vblank.
It's not, it's just that I've had to resurrect this patch quickly before leaving and accidentally left the vblank stuff in.
Quoted 59 lines
crtc->statemight not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."Looking at
commit6f0f02dc56f18760b46dc1bf5b3f7386869d4162Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000drm/i915: Move atomic state free from out of fence release
Quoted 7 lines
I would say that
drm_atomic_state_freewould definitely block..The only thing that makes sense IMO is doing
kfree_rcuon theobject_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.I think I would try to use the crtc
ww_mutexin the vblank code and serialize it to pending commits, if at all possible.Oops. I guess it should have come with "totally untested". In that case we need a workter which does a
synchronize_rcu()before releasing. I don't just want to do a simplekfree_rcu()because by that point we've (partially) destroyed the state alreayd (so it's already unsafe to access, and special ruels are ugly). And doing it here before we release anything in the core would avoid the need for drivers to bother withkfree_rcu().Quoted 4 lines
Quoted 1 line
I'll try to respin something less obviously buggy tomorrow :-)
It will still be buggy tomorrow, since you have no way to know if the current hardware
crtc_stateis anything likecrtc->state.:(
Maybe I wasnt' clear, so let me retry:
- this approach doesn't work for vblank and crtc state. Agreed. I'll remove all the leftover comments I've forgotten to remove in a hurry.
- the patch itself is broken, so can't be used for
connector->statepeeking inmode_valideither. That one I'll fix.Does that make sense?
-Daniel
Quoted 7 lines
Quoted 2 lines
Yes, but I'm still not completely convinced it's required for connector state to use RCU. During
detect()we would take theconnection_mutexanyway, so I can probably do that formode_validas well.Why do you want to take the
connection_mutexthere? If we just go with taking that everywhere we touch shared state, we might as well push that up in the callchain ... With theconnector_iterstuff there's no reason at all anymore to hold the mode_config.mutex for anything really around connector probing.
Lets kill that lock, then. :D
Quoted 7 lines
The only thing we need is that we pass the
acquire_ctxdown into callars somehow, so that the load detect stuff still works.But my idea was kinda that we'd do the same for probe -> modeset data flows like here for the other way round: Just a bunch of
READ_ONCEand maybe lookup the edid with rcu too. That way it's clear to anybody that probe and modeset are entirely not synchronized.
Though I think it's beneficial to lock them. if it is. I'm not sure there are many usecases for parallel modeset vs probe. And if someone does care, they can use nonblocking modesets, maybe.
Legacy userspace probably can't do blocking modeset and probe at the same time, so I don't think it will regress.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Maarten Lankhorst
Op 20-03-17 om 09:59 schreef Daniel Vetter:
Quoted 4 lines
But my idea was kinda that we'd do the same for probe -> modeset data flows like here for the other way round: Just a bunch of
READ_ONCEand maybe lookup the edid with rcu too. That way it's clear to anybody that probe and modeset are entirely not synchronized.
Quoted 6 lines
Though I think it's beneficial to lock them. if it is. I'm not sure there are many usecases for parallel modeset vs probe. And if someone does care, they can use nonblocking modesets, maybe.
Legacy userspace probably can't do blocking modeset and probe at the same time, so I don't think it will regress.
It can happen - just consider two clients, such as system-logind walking sysfs. Delaying most modesets would not be an issue, except where the modeset is being uses to e.g. changes strides before in the middle of a pageflip sequence.
I would welcome kms_flip flip/set/vblank-vs-probe, and definitely should add it to legacy-cursor and legacy-plane as well.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerOp 20-03-17 om 11:22 schreef Chris Wilson:
Quoted 10 lines · Maarten Lankhorst
Quoted 9 lines
Op 20-03-17 om 09:59 schreef Daniel Vetter:
Quoted 4 lines
But my idea was kinda that we'd do the same for probe -> modeset data flows like here for the other way round: Just a bunch of
READ_ONCEand maybe lookup the edid with rcu too. That way it's clear to anybody that probe and modeset are entirely not synchronized.Though I think it's beneficial to lock them. if it is. I'm not sure there are many usecases for parallel modeset vs probe. And if someone does care, they can use nonblocking modesets, maybe.
Quoted 6 lines
Quoted 2 lines
Legacy userspace probably can't do blocking modeset and probe at the same time, so I don't think it will regress.
It can happen - just consider two clients, such as system-logind walking sysfs. Delaying most modesets would not be an issue, except where the modeset is being uses to e.g. changes strides before in the middle of a pageflip sequence.
With atomic pageflip, this is no longer required on i915. :)
Quoted 2 lines
I would welcome
kms_flipflip/set/vblank-vs-probe, and definitely should add it to legacy-cursor and legacy-plane as well.
Could be useful, the normal paths should never take connection_mutex anyway, so either way it should pass.
~Maarten
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 104 lines · Maarten Lankhorst
Op 20-03-17 om 09:59 schreef Daniel Vetter:
Quoted 103 lines · Maarten Lankhorst
Quoted 102 lines
Op 20-03-17 om 09:18 schreef Daniel Vetter:
Quoted 101 lines · Maarten Lankhorst
Quoted 86 lines
Op 16-03-17 om 21:15 schreef Daniel Vetter:
Quoted 85 lines
Quoted 6 lines · Maarten Lankhorst
Op 16-03-17 om 16:52 schreef Daniel Vetter:
Quoted 4 lines
The vblank code really wants to look at
crtc->statewithout having to take aww_mutex. One option might be to take one of the vblank locks right when assigningcrtc->state, which would ensure that the vblank code doesn't race and access freed memory.I'm not sure this is the right approach for vblank.
It's not, it's just that I've had to resurrect this patch quickly before leaving and accidentally left the vblank stuff in.
Quoted 59 lines
crtc->statemight not be the same as the current state in case of a nonblocking modeset that hasn't even disabled the old crtc yet.Quoted 42 lines
But userspace tends to poke the
vblank_ioctlto query the current vblank timestamp rather often, and going all in with rcu would help a bit. We're not there yet, but also doesn't really hurt.v2: Maarten needs this to make connector properties atomic, so he can peek at state from the various ->mode_valid hooks.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++++--------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- include/drm/drm_atomic.h | 5 +++++ include/drm/drm_connector.h | 13 ++++++++++++- include/drm/drm_crtc.h | 9 ++++++++- 5 files changed, 43 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_atomic.c +3
-9@@ -213,16 +213,10 @@ void drm_atomic_state_clear(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_state_clear); -/** -* __drm_atomic_state_free - free all memory for an atomic state -* @ref: This atomic state to deallocate -* -* This frees all memory associated with an atomic state, including all the -* per-object state for planes, crtcs and connectors. -*/ -void __drm_atomic_state_free (struct kref *ref) +void ___drm_atomic_state_free (struct rcu_head *rhead) { -struct drm_atomic_state *state =container_of (ref,typeof (*state), ref); +struct drm_atomic_state *state = +container_of (rhead,typeof (*state), rhead);struct drm_mode_config *config = &state->dev->mode_config;drm_atomic_state_clear (state);drivers/gpu/drm/drm_atomic.c void __drm_atomic_state_free(struct kref *ref) · line 232
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +0
-0@@ -236,6 +230,20 @@ void __drm_atomic_state_free(struct kref *ref)kfree (state); } }whatisRCU.txt:
"This function invokes func(head) after a grace period has elapsed. This invocation might happen from either softirq or process context, so the function is not permitted to block."Looking at
commit6f0f02dc56f18760b46dc1bf5b3f7386869d4162Author: Chris Wilson <[email protected]> Date: Mon Jan 23 21:29:39 2017 +0000drm/i915: Move atomic state free from out of fence release
Quoted 7 lines
I would say that
drm_atomic_state_freewould definitely block..The only thing that makes sense IMO is doing
kfree_rcuon theobject_states. But I don't think RCU is the answer here, it won't protect you against using the wrong crtc state.I think I would try to use the crtc
ww_mutexin the vblank code and serialize it to pending commits, if at all possible.Oops. I guess it should have come with "totally untested". In that case we need a workter which does a
synchronize_rcu()before releasing. I don't just want to do a simplekfree_rcu()because by that point we've (partially) destroyed the state alreayd (so it's already unsafe to access, and special ruels are ugly). And doing it here before we release anything in the core would avoid the need for drivers to bother withkfree_rcu().Quoted 4 lines
Quoted 1 line
I'll try to respin something less obviously buggy tomorrow :-)
It will still be buggy tomorrow, since you have no way to know if the current hardware
crtc_stateis anything likecrtc->state.:(
Maybe I wasnt' clear, so let me retry:
- this approach doesn't work for vblank and crtc state. Agreed. I'll remove all the leftover comments I've forgotten to remove in a hurry.
- the patch itself is broken, so can't be used for
connector->statepeeking inmode_valideither. That one I'll fix.Does that make sense?
-Daniel
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Yes, but I'm still not completely convinced it's required for connector state to use RCU. During
detect()we would take theconnection_mutexanyway, so I can probably do that formode_validas well.Why do you want to take the
connection_mutexthere? If we just go with taking that everywhere we touch shared state, we might as well push that up in the callchain ... With theconnector_iterstuff there's no reason at all anymore to hold the mode_config.mutex for anything really around connector probing.Lets kill that lock, then. :D
Yeah, that might be the thing to do ... I just would like to have some consistent rules, and very much preferrably implemented entirely in helpers.
We probably need to keep it around for legacy drivers (out of abundance of caution), but could otherwise entirely nerf mode_config.mutex.
Note that it is used in some strange places, e.g. fbdev emulation helpers use it to protect their datastructures (which really should be fixed, bkls are evil).
Quoted 8 lines
Quoted 7 lines
The only thing we need is that we pass the
acquire_ctxdown into callars somehow, so that the load detect stuff still works.But my idea was kinda that we'd do the same for probe -> modeset data flows like here for the other way round: Just a bunch of
READ_ONCEand maybe lookup the edid with rcu too. That way it's clear to anybody that probe and modeset are entirely not synchronized.
Quoted 6 lines
Though I think it's beneficial to lock them. if it is. I'm not sure there are many usecases for parallel modeset vs probe. And if someone does care, they can use nonblocking modesets, maybe.
Legacy userspace probably can't do blocking modeset and probe at the same time, so I don't think it will regress.
What we might want to keep working is a read-only probe path, for sysfs and also perhaps for the GetConnectorCached ioctl (num = 1 trickery). -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✗ Fi.CI.BAT: warning for drm/atomic: protect crtc|connector->state with rcu
In reply to Daniel Vetter== Series Details ==
== Series Details ==
Series: drm/atomic: protect crtc|connector->state with rcu
URL : https://patchwork.freedesktop.org/series/21389/
State : warning
== Summary ==
Series 21389v1 drm/atomic: protect crtc|connector->state with rcu
https://patchwork.freedesktop.org/api/1.0/series/21389/revisions/1/mbox/
Test core_auth:
Subgroup basic-auth:
pass -> DMESG-WARN (fi-hsw-4770r)
pass -> DMESG-WARN (fi-skl-6700k)
pass -> DMESG-WARN (fi-skl-6260u)
pass -> DMESG-WARN (fi-bsw-n3050)
pass -> DMESG-WARN (fi-bdw-5557u)
pass -> DMESG-WARN (fi-bxt-t5700)
pass -> DMESG-WARN (fi-bxt-j4205)
pass -> DMESG-WARN (fi-ivb-3770)
pass -> DMESG-WARN (fi-snb-2600)
pass -> DMESG-WARN (fi-kbl-7500u)
pass -> DMESG-WARN (fi-snb-2520m)
pass -> DMESG-WARN (fi-byt-n2820)
pass -> DMESG-WARN (fi-byt-j1900)
pass -> DMESG-WARN (fi-skl-6700hq)
Test core_prop_blob:
Subgroup basic:
pass -> DMESG-WARN (fi-hsw-4770)
Test drv_hangman:
Subgroup error-state-basic:
pass -> DMESG-WARN (fi-snb-2520m)
pass -> DMESG-WARN (fi-bxt-t5700)
Test drv_module_reload:
Subgroup basic-no-display:
pass -> DMESG-WARN (fi-bxt-j4205)
pass -> DMESG-WARN (fi-bxt-t5700)
pass -> DMESG-WARN (fi-skl-6260u)
pass -> DMESG-WARN (fi-snb-2520m)
pass -> DMESG-WARN (fi-hsw-4770)
pass -> DMESG-WARN (fi-skl-6700hq)
Subgroup basic-reload:
pass -> DMESG-WARN (fi-hsw-4770r)
pass -> DMESG-WARN (fi-skl-6260u)
pass -> DMESG-WARN (fi-ilk-650) fdo#100045
pass -> DMESG-WARN (fi-bsw-n3050)
pass -> DMESG-WARN (fi-bdw-5557u)
pass -> DMESG-WARN (fi-hsw-4770)
pass -> DMESG-WARN (fi-bxt-t5700)
pass -> DMESG-WARN (fi-bxt-j4205)
pass -> DMESG-WARN (fi-ivb-3770)
pass -> DMESG-WARN (fi-snb-2600)
pass -> DMESG-WARN (fi-kbl-7500u)
pass -> DMESG-WARN (fi-snb-2520m)
pass -> DMESG-WARN (fi-byt-n2820)
pass -> DMESG-WARN (fi-byt-j1900)
pass -> DMESG-WARN (fi-skl-6700hq)
Subgroup basic-reload-final:
pass -> DMESG-WARN (fi-hsw-4770r)
pass -> DMESG-WARN (fi-skl-6260u)
pass -> DMESG-WARN (fi-ilk-650) fdo#100045
pass -> DMESG-WARN (fi-bsw-n3050)
pass -> DMESG-WARN (fi-bdw-5557u)
pass -> DMESG-WARN (fi-hsw-4770)
pass -> DMESG-WARN (fi-bxt-t5700)
pass -> DMESG-WARN (fi-bxt-j4205)
pass -> DMESG-WARN (fi-ivb-3770)
pass -> DMESG-WARN (fi-snb-2600)
pass -> DMESG-WARN (fi-kbl-7500u)
pass -> DMESG-WARN (fi-snb-2520m)
pass -> DMESG-WARN (fi-byt-n2820)
pass -> DMESG-WARN (fi-byt-j1900)
pass -> DMESG-WARN (fi-skl-6700hq)
Subgroup basic-reload-inject:
pass -> DMESG-WARN (fi-hsw-4770r)
pass -> DMESG-WARN (fi-ilk-650) fdo#100045
pass -> DMESG-WARN (fi-bsw-n3050)
pass -> DMESG-WARN (fi-bdw-5557u)
pass -> DMESG-WARN (fi-hsw-4770)
pass -> DMESG-WARN (fi-bxt-t5700)
pass -> DMESG-WARN (fi-bxt-j4205)
pass -> DMESG-WARN (fi-ivb-3770)
pass -> DMESG-WARN (fi-snb-2600)
pass -> DMESG-WARN (fi-kbl-7500u)
pass -> DMESG-WARN (fi-snb-2520m)
pass -> DMESG-WARN (fi-byt-n2820)
pass -> DMESG-WARN (fi-byt-j1900)
pass -> DMESG-WARN (fi-skl-6700hq)
Test gem_basic:
Subgroup bad-close:
pass -> DMESG-WARN (fi-bsw-n3050)
pass -> DMESG-WARN (fi-bxt-j4205)
pass -> DMESG-WARN (fi-skl-6700hq)
Subgroup create-close:
pass -> DMESG-WARN (fi-ivb-3770)
Subgroup create-fd-close:
pass -> DMESG-WARN (fi-byt-n2820)
pass -> DMESG-WARN (fi-skl-6260u)
Test gem_busy:
Subgroup basic-busy-default:
pass -> DMESG-WARN (fi-snb-2520m)
pass -> DMESG-WARN (fi-kbl-7500u)
pass -> DMESG-WARN (fi-byt-j1900)
pass -> DMESG-WARN (fi-bxt-t5700)
pass -> DMESG-WARN (fi-ilk-650)
Subgroup basic-hang-default:
pass -> DMESG-WARN (fi-hsw-4770r) fdo#100046WARNING: Long output truncated
fi-ivb-3520m failed to connect after reboot
c1374a7a4a7fb0093d98ad6aa7071c8671fcdf08 drm-tip: 2017y-03m-16d-14h-28m-12s UTC integration manifest fd90276 drm/atomic: protect crtc|connector->state with rcu
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4203/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx