Skip to contentSkip to conversation

drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation

PATCH In review Hanson Wang 3 participants 4 messages Oct 16 – Nov 18

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation

The per-CRTC bandwidth helpers use cached active_planes and data_rate values without checking whether the CRTC is active. During hardware state readout an inactive CRTC may retain stale plane state, causing intel_bw_state to account phantom bandwidth.

This can leave bandwidth and an active plane accounted after an HDMI disconnect and make the QGV check reject otherwise valid atomic commits.

Return zero from both helpers for inactive CRTCs so hardware readout and atomic checks cannot propagate stale bandwidth.

---
 drivers/gpu/drm/i915/display/intel_bw.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/display/intel_bw.c +6 -0
index ac6da20d9..62d9ae416 100644
@@ -838,6 +838,9 @@ void intel_bw_init_hw(struct intel_display *display)
 
 static unsigned int intel_bw_crtc_num_active_planes(const struct intel_crtc_state *crtc_state)
 {
+	if (!crtc_state->hw.active)
+		return 0;
+
 	/*
 	 * We assume cursors are small enough
 	 * to not not cause bandwidth problems.
@@ -852,6 +855,9 @@ static unsigned int intel_bw_crtc_data_rate(const struct intel_crtc_state *crtc_
 	unsigned int data_rate = 0;
 	enum plane_id plane_id;
 
+	if (!crtc_state->hw.active)
+		return 0;
+
 	for_each_plane_id_on_crtc(crtc, plane_id) {
 		/*
 		 * We assume cursors are small enough
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Hanson Wang

The per-CRTC bandwidth helpers use cached active_planes and data_rate values without checking whether the CRTC is active. During hardware state readout an inactive CRTC may retain stale plane state, causing intel_bw_state to account phantom bandwidth.

This can leave bandwidth and an active plane accounted after an HDMI disconnect and make the QGV check reject otherwise valid atomic commits.

Shouldn't happen. If the CRTC gets disabled it no longer counts. Are you leaving the CRTC logically enabled but inactive (enable==true && active==false)? That we still want to count because 'enable==true && active==false -> enable==true && active==true' transition should never fail.

Quoted 35 lines

Return zero from both helpers for inactive CRTCs so hardware readout and atomic checks cannot propagate stale bandwidth.

---
 drivers/gpu/drm/i915/display/intel_bw.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/display/intel_bw.c +6 -0
index ac6da20d9..62d9ae416 100644
@@ -838,6 +838,9 @@ void intel_bw_init_hw(struct intel_display *display)
 
 static unsigned int intel_bw_crtc_num_active_planes(const struct intel_crtc_state *crtc_state)
 {
+	if (!crtc_state->hw.active)
+		return 0;
+
 	/*
 	 * We assume cursors are small enough
 	 * to not not cause bandwidth problems.
@@ -852,6 +855,9 @@ static unsigned int intel_bw_crtc_data_rate(const struct intel_crtc_state *crtc_
 	unsigned int data_rate = 0;
 	enum plane_id plane_id;
 
+	if (!crtc_state->hw.active)
+		return 0;
+
 	for_each_plane_id_on_crtc(crtc, plane_id) {
 		/*
 		 * We assume cursors are small enough
Signature · 1 line
2.34.1
Signature · 2 lines
Ville Syrjälä
Intel
#2 lore raw

✗ LGCI.VerificationFailed: failure for drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation

In reply to Hanson Wang
== Series Details ==

== Series Details ==

Series: drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation
URL : https://patchwork.freedesktop.org/series/176380/
State : failure

== Summary ==

Series author address '[email protected]' is not on the allowlist, which prevents CI from being automatically triggered. If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork. Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/190792/ (on built-in)

#3 lore raw
In reply to Hanson Wang

Please drop this patch. It does not fix the bug, and the approach is wrong.

I tested it on the affected systems. After firmware handoff, DBUF sanitization disables the inherited plane and clears the CRTC-local state, but the global BW entry remains. Zeroing bandwidth for every !hw.active CRTC does not remove that stale global state. It would also drop the legitimate reservation for a logically enabled but inactive CRTC.

The failure is phantom global bandwidth left by the non-atomic plane disable, not an enabled-but-inactive CRTC that should still be counted.

The replacement is a separate patch, not a new version of this one:

drm/i915/bw: sync global BW after non-atomic plane disable

Thanks,
Hanson