drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
Subsystems (3)
PATCH 1/1 drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
intel_crtc_prepare_cleared_state() frees the old CRTC hw state before calling intel_dp_tunnel_atomic_clear_stream_bw(). The latter can fail while looking up the DP tunnel group state, for example with -EDEADLK.
If that happens, the function returns without completing the cleared state preparation, leaving the duplicated CRTC state with its hw color blob references already dropped. The failed atomic state will then be cleared by the atomic core, which can drop the same references again.
Move the hw state release after the DP tunnel stream BW clear has succeeded. Keep the temporary state allocation before the failable DP tunnel operation so an allocation failure cannot happen after the stream BW has already been cleared.
--- drivers/gpu/drm/i915/display/intel_display.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +3 -3
@@ -4646,9 +4646,6 @@ intel_crtc_prepare_cleared_state(struct intel_atomic_state *state,if (!saved_state)return -ENOMEM ; -/* free the old crtc_state->hw members */ -intel_crtc_free_hw_state (crtc_state); - err =intel_dp_tunnel_atomic_clear_stream_bw (state, crtc_state);if (err) {kfree (saved_state);
@@ -4656,6 +4653,9 @@ intel_crtc_prepare_cleared_state(struct intel_atomic_state *state,return err; } +/* free the old crtc_state->hw members */ +intel_crtc_free_hw_state (crtc_state); +/* FIXME: before the switch to atomic started, a new pipe_config was * kzalloc'd. Code that depends on any field being zero should be * fixed, so that the crtc_state can be safely duplicated. For now,
Signature · 1 line
2.43.0
Patchwork
CI✗ LGCI.VerificationFailed: failure for drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
== Series Details ==
== Series Details ==
Series: drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
URL : https://patchwork.freedesktop.org/series/167952/
State : failure
== Summary ==
Address '[email protected]' is not on the allowlist, which prevents CI from being triggered for this patch. If you want Intel GFX CI to accept this address, please contact the script maintainers at [email protected]. Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/178831/ (on built-in)
Patchwork
CI✗ LGCI.VerificationFailed: failure for drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
In reply to Guangshuo Li== Series Details ==
== Series Details ==
Series: drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
URL : https://patchwork.freedesktop.org/series/167953/
State : failure
== Summary ==
Address '[email protected]' is not on the allowlist, which prevents CI from being triggered for this patch. If you want Intel GFX CI to accept this address, please contact the script maintainers at [email protected]. Exception occurred during validation, bailing out!
Build URL: http://intel-gfx-ci-public.igk.intel.com:8080/job/xe_pw_trigger/1180256/ (on master)
Quoted 25 lines · Guangshuo Li
intel_crtc_prepare_cleared_state()frees the old CRTC hw state before callingintel_dp_tunnel_atomic_clear_stream_bw(). The latter can fail while looking up the DP tunnel group state, for example with-EDEADLK.If that happens, the function returns without completing the cleared state preparation, leaving the duplicated CRTC state with its hw color blob references already dropped. The failed atomic state will then be cleared by the atomic core, which can drop the same references again.
Move the hw state release after the DP tunnel stream BW clear has succeeded. Keep the temporary state allocation before the failable DP tunnel operation so an allocation failure cannot happen after the stream BW has already been cleared.
Fixes fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")Signed-off-by Guangshuo Li <[email protected]>--- drivers/gpu/drm/i915/display/intel_display.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/display/intel_display.c +0
-0
drivers/gpu/drm/i915/display/intel_display.c intel_crtc_prepare_cleared_state(struct intel_atomic_state *state, · line 4650
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0
-2@@ -4646,9 +4646,6 @@ intel_crtc_prepare_cleared_state(struct intel_atomic_state *state,if (!saved_state)return -ENOMEM ; -/* free the old crtc_state->hw members */ -intel_crtc_free_hw_state (crtc_state);
The fix is valid, however I think instead of this change it'd be better to clear the blob reference pointers in intel_crtc_free_hw_state().
Quoted 17 lines
drivers/gpu/drm/i915/display/intel_display.c +3
-1- err =intel_dp_tunnel_atomic_clear_stream_bw (state, crtc_state);if (err) {kfree (saved_state);@@ -4656,6 +4653,9 @@ intel_crtc_prepare_cleared_state(struct intel_atomic_state *state,return err; } +/* free the old crtc_state->hw members */ +intel_crtc_free_hw_state (crtc_state); +/* FIXME: before the switch to atomic started, a new pipe_config was * kzalloc'd. Code that depends on any field being zero should be * fixed, so that the crtc_state can be safely duplicated. For now, Signature · 1 line
2.43.0
Hi Imre,
Thanks for the review.
Quoted 44 lines · Imre Deak
Quoted 25 lines · Guangshuo Li
intel_crtc_prepare_cleared_state()frees the old CRTC hw state before callingintel_dp_tunnel_atomic_clear_stream_bw(). The latter can fail while looking up the DP tunnel group state, for example with-EDEADLK.If that happens, the function returns without completing the cleared state preparation, leaving the duplicated CRTC state with its hw color blob references already dropped. The failed atomic state will then be cleared by the atomic core, which can drop the same references again.
Move the hw state release after the DP tunnel stream BW clear has succeeded. Keep the temporary state allocation before the failable DP tunnel operation so an allocation failure cannot happen after the stream BW has already been cleared.
Fixes fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")Signed-off-by Guangshuo Li <[email protected]>--- drivers/gpu/drm/i915/display/intel_display.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/display/intel_display.c +0
-0drivers/gpu/drm/i915/display/intel_display.c intel_crtc_prepare_cleared_state(struct intel_atomic_state *state, · line 4650
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0
-2@@ -4646,9 +4646,6 @@ intel_crtc_prepare_cleared_state(struct intel_atomic_state *state,if (!saved_state)return -ENOMEM ; -/* free the old crtc_state->hw members */ -intel_crtc_free_hw_state (crtc_state);The fix is valid, however I think instead of this change it'd be better to clear the blob reference pointers in
intel_crtc_free_hw_state().Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display.c +0
-1- err =intel_dp_tunnel_atomic_clear_stream_bw (state, crtc_state);if (err) {kfree (saved_state);@@ -4656,6 +4653,9 @@ intel_crtc_prepare_cleared_state(struct intel_atomic_state *state,return err; }
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +3
-1+/* free the old crtc_state->hw members */ +intel_crtc_free_hw_state (crtc_state); +/* FIXME: before the switch to atomic started, a new pipe_config was * kzalloc'd. Code that depends on any field being zero should be * fixed, so that the crtc_state can be safely duplicated. For now, -- 2.43.0
Agreed, clearing the blob reference pointers in intel_crtc_free_hw_state() makes the cleanup safe against repeated calls and avoids changing the ordering in intel_crtc_prepare_cleared_state().
I'll send a v2 with that change.
Best regards,
Guangshuo