From nobody Mon Jun 8 06:36:52 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE94B399D0D for ; Fri, 5 Jun 2026 06:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780639672; cv=none; b=W4e7D40bm8z1euKfYNyDsr5i1RePu2qE23+CcPqlvagOK+vLWmQQbCRRk4P60q/zAUIOZIJ5WsZCt3JWM6HkDeHxUMKnC8S0+70J2N2Tb//AfyXcRUVc4jspZTYKzoM5XHdz2A11BUUZh8RkJ4fEQUr8xKS8apIPyGPnxTw8MZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780639672; c=relaxed/simple; bh=/uc1fUJ97pcLgqJMSpWCSA6ZzNJOnBQRfaaeP6FXlqs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OCm2V6POqCuJ080SKzjZrXUE0Srg62i8UySAFEZ7knCHfVjrDpY1tJje0LBSFMHSJgGj5cZO9SX5jqmsbapnnDNrd5BXSATWRiuzDZSwfzRIG7Rbs/viiiWMe6ZZz0j4ChMdArpg2mTiCg0dsDYE7USRcbDb8HfUjbeq90J9soc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Zs0k4eIe; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zs0k4eIe" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2c0c3543590so10947175ad.2 for ; Thu, 04 Jun 2026 23:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780639670; x=1781244470; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=M5WkcatAHhLMBNeD67NubkG9Mg0FFDk4z9wml5JZOUU=; b=Zs0k4eIe30GjZR/WSiScbqvpcjqxyE+8RCz10awETg1BFAc7RxEoQxD2AJODvhVjwK v1VmLGy+feaufASlHT1Ap4SfVKbcvSEK27Vcml8QV8grtrRVq+4JQDz8MD1stlCPlqQX eOgPXHAnxu5jE80mrshw3RD4MeRrSgFDem0/FOc+qHJ1oqDlhcr3uZsytFORZ0uMoI7K 2DGW225hJKNw0X1X3PjFpXMEJKaB3CBWT8YlDT4c36dIFh2n/phEVFpE3rouCUzxHRGe KC3RVma3XnRI2vptzA1csBDP99Gl8MXvGd3oblsGKIqS5iDuW4zskvMoVNUpau93yCWZ vvFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780639670; x=1781244470; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=M5WkcatAHhLMBNeD67NubkG9Mg0FFDk4z9wml5JZOUU=; b=Vrs7FTkvqdu9aQX/O39q7fNflx9XsTwd61x6FGvjncdOCZpsiBwUT9rDJEkTjWRA9x 03zpp5i11y/+GuurVehEguW5lHltSPvwntuSfk+578yK4+76GciwLzqYEySSPuw/rM9Y XOszYPSpjFY45CB6xHZj3Qro5lVtO/PguhjhW5gaJVtW12Ahf46n9y2W/BXy7mtU4mBV r3kel2I14LGnP1htgDR/h1xQr5buhMFQs5ui8cXWUKl1U+8AX06L4W35NAVvp6CpfSpK ZU1UJWznitT+oKzMqkMXsA27cZU734R79HXBUSQ/V58SC4Y0Y6HjDyX7XEyPUghpqNLf cNfA== X-Forwarded-Encrypted: i=1; AFNElJ+B+h8RL2aw//d0zAeSxF8CwPBUXZcvQ7qINpiaRhW3NUoena+SkhNHOa9/ACT7Is+8agrju9TrswscZuo=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/xwx9S7d91ZeBexA7hzRdZlFIyHr8rErKj3CwwkCoOxLphbCR zrpgGlWK3lw9JgutX/hIP250y+ZdNNn9SSgriyEO1lQhvT38nrbasKeG X-Gm-Gg: Acq92OFEg00WhqV0SdZAQTdryR9/08uEt753CDdTWfOpdPmuZueg4NteIQWXfsjsYJo c9kgRDlyhRxTS5YuqSbrZ5TUJl1zpdpEGDMGxbl/TP+x6qSYNIHlCUWA/8ZR3iDyj8BPNVY9r1W QwvmUvXHfsoGiTJrVMQwET0h/tlqhFZNChlZUUnbNjx1QtP8bAtgKzyJm4JBvGS39ZOfKxI44un J8IAca/d1k93Rh62ta++BxCJRyfguA2XHoMfzQZj9roenbMp6m1CGfDOqor5pwYp52mYpW1FTwr Clg5WhtDayhOwsR+YqPEM2G0euxFZ7yujD2HXAoXxRzndqxzC2KuVje+5OBofvAN47tsHn10AnU peUqdgzEpq/D7ddITvKCz7d+sUY2mpho1DJxYDdMdvsQ/m5sQpj9Wc1q33k2/d2NCwolWM8Kmwl GDjcnNlG4DIHEAcQzZ X-Received: by 2002:a17:902:fc46:b0:2c0:b9a1:6493 with SMTP id d9443c01a7336-2c1e7b082b4mr20237105ad.10.1780639670162; Thu, 04 Jun 2026 23:07:50 -0700 (PDT) Received: from lgs.. ([2001:250:5800:1000::f280]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c1646e5c51sm77298475ad.0.2026.06.04.23.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 23:07:49 -0700 (PDT) From: Guangshuo Li To: Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Simona Vetter , Imre Deak , Uma Shankar , =?UTF-8?q?Micha=C5=82=20Grzelak?= , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li Subject: [PATCH] drm/i915/dp_tunnel: fix CRTC hw state cleanup ordering Date: Fri, 5 Jun 2026 14:05:27 +0800 Message-ID: <20260605060527.1443552-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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; =20 - /* free the old crtc_state->hw members */ - intel_crtc_free_hw_state(crtc_state); - err =3D 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; } =20 + /* 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, --=20 2.43.0