All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
@ 2026-06-05  6:05 Guangshuo Li
  2026-06-05 12:27 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-06-05  6:05 UTC (permalink / raw)
  To: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
	David Airlie, Simona Vetter, Imre Deak, Uma Shankar,
	Michał Grzelak, intel-gfx, intel-xe, dri-devel, linux-kernel
  Cc: Guangshuo Li

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.

Fixes: fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index ad2fe10b6b1f..0c015bc6c9fd 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -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,
-- 
2.43.0


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

* ✗ LGCI.VerificationFailed: failure for drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
  2026-06-05  6:05 [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering Guangshuo Li
@ 2026-06-05 12:27 ` Patchwork
  2026-06-05 12:54 ` Patchwork
  2026-06-05 14:36 ` [PATCH] " Imre Deak
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2026-06-05 12:27 UTC (permalink / raw)
  To: Guangshuo Li; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
URL   : https://patchwork.freedesktop.org/series/167952/
State : failure

== Summary ==

Address 'lgs201920130244@gmail.com' 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 i915-ci-infra@lists.freedesktop.org.
Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/178831/ (on built-in)



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

* ✗ LGCI.VerificationFailed: failure for drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
  2026-06-05  6:05 [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering Guangshuo Li
  2026-06-05 12:27 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
@ 2026-06-05 12:54 ` Patchwork
  2026-06-05 14:36 ` [PATCH] " Imre Deak
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2026-06-05 12:54 UTC (permalink / raw)
  To: Guangshuo Li; +Cc: intel-xe

== Series Details ==

Series: drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
URL   : https://patchwork.freedesktop.org/series/167953/
State : failure

== Summary ==

Address 'lgs201920130244@gmail.com' 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 i915-ci-infra@lists.freedesktop.org.
Exception occurred during validation, bailing out!
Build URL: http://intel-gfx-ci-public.igk.intel.com:8080/job/xe_pw_trigger/1180256/ (on master)



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

* Re: [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
  2026-06-05  6:05 [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering Guangshuo Li
  2026-06-05 12:27 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
  2026-06-05 12:54 ` Patchwork
@ 2026-06-05 14:36 ` Imre Deak
  2026-06-10  3:56   ` Guangshuo Li
  2 siblings, 1 reply; 5+ messages in thread
From: Imre Deak @ 2026-06-05 14:36 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
	David Airlie, Simona Vetter, Uma Shankar, Michał Grzelak,
	Ville Syrjälä, intel-gfx, intel-xe, dri-devel,
	linux-kernel

On Fri, Jun 05, 2026 at 02:05:27PM +0800, Guangshuo Li wrote:
> 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.
> 
> Fixes: fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ad2fe10b6b1f..0c015bc6c9fd 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -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().

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

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

* Re: [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering
  2026-06-05 14:36 ` [PATCH] " Imre Deak
@ 2026-06-10  3:56   ` Guangshuo Li
  0 siblings, 0 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-06-10  3:56 UTC (permalink / raw)
  To: imre.deak
  Cc: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
	David Airlie, Simona Vetter, Uma Shankar, Michał Grzelak,
	Ville Syrjälä, intel-gfx, intel-xe, dri-devel,
	linux-kernel

Hi Imre,

Thanks for the review.

On Fri, 5 Jun 2026 at 22:36, Imre Deak <imre.deak@intel.com> wrote:
>
> On Fri, Jun 05, 2026 at 02:05:27PM +0800, Guangshuo Li wrote:
> > 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.
> >
> > Fixes: fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")
> > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index ad2fe10b6b1f..0c015bc6c9fd 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -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().
>
> > -
> >       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,
> > --
> > 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

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

end of thread, other threads:[~2026-06-10  3:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05  6:05 [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering Guangshuo Li
2026-06-05 12:27 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
2026-06-05 12:54 ` Patchwork
2026-06-05 14:36 ` [PATCH] " Imre Deak
2026-06-10  3:56   ` Guangshuo Li

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.