Skip to contentSkip to conversation

Report MMIO communication problems more clearly

PATCH Superseded Andi Shyti 3 participants 8 messages Mar 20, 2023 – Mar 21, 2023

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Andi Shyti

author
#0 lore raw

cover Report MMIO communication problems more clearly

Hi,

just copy pasting Matt's original cover letter:

We're periodically facing problems in CI where all registers read back as 0xFFFFFFFF. In general this is what happens when the CPU is unable to communicate with a PCI device, so the transaction autocompletes with all F's as a placeholder. Sometimes the device will recover on its own, sometimes it will never come back.

We already have some attempts to detect when this happens (e.g., when checking FPGA_DBG), but let's add a couple more checks with descriptive error messages to identify the problem in other cases:

- When the device is first probed, we'll do an initial check of the GT forcewake register. As a masked register, the upper bits should always come back as 0's if device access is behaving properly, so if we see all F's, we can conclude that the device is already in a bad state. We'll wait two seconds to see if it recovers on its own, then give up on the device.

- When we encounter a 'forcewake timed out while waiting for clear' error, we'll do one more read of the register to see if it's because we're just reading back all F's. If so, we'll print a more meaningful message clarifying that it isn't the forcewake itself that's the problem, but rather communication with the device.

Note that this only captures the failure case where accessing the device is problematic (resulting in registers giving all F's). There's a separate class of problems where the device is okay, but the GT inside the device is busted and all GT registers read back as 0's (other registers like sgunit registers are usually still readable). This series does not address that class of errors.

This is just a quick change to get some better CI error messages. Some ideas for future enhancements:

- Try something to reset the device if we detect a problem at driver load (e.g., PCI FLR, toggling the PCI power state, etc.)?

- Use something more standard like pci_read_config_dword() instead of a device register read to determine when we're not communicating properly? Generally the PCI config space is also giving all F's at this point.

- Also handle the "device OK, GT dead" case by finding some GT register(s) that should never be 0 on a functioning system. Maybe one of the fuse registers would work for this?

Matt Roper (2):
drm/i915: Sanitycheck MMIO access early in driver load drm/i915: Check for unreliable MMIO during forcewake

 drivers/gpu/drm/i915/intel_uncore.c | 46 +++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.2
author
#1 lore raw

PATCH 1/2 drm/i915: Sanitycheck MMIO access early in driver load

From: Matt Roper <[email protected]>

We occasionally see the PCI device in a non-accessible state at the point the driver is loaded. When this happens, all BAR accesses will read back as 0xFFFFFFFF. Rather than reading registers and misinterpreting their (invalid) values, let's specifically check for 0xFFFFFFFF in a register that cannot have that value to see if the device is accessible.

---
 drivers/gpu/drm/i915/intel_uncore.c | 34 +++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/gpu/drm/i915/intel_uncore.c +34 -0
index e1e1f34490c8e..14ec45e6facfa 100644
@@ -2602,11 +2602,45 @@ static int uncore_forcewake_init(struct intel_uncore *uncore)
 	return 0;
 }
 
+static int sanity_check_mmio_access(struct intel_uncore *uncore)
+{
+	struct drm_i915_private *i915 = uncore->i915;
+
+	if (GRAPHICS_VER(i915) < 8)
+		return 0;
+
+	/*
+	 * Sanitycheck that MMIO access to the device is working properly.  If
+	 * the CPU is unable to communcate with a PCI device, BAR reads will
+	 * return 0xFFFFFFFF.  Let's make sure the device isn't in this state
+	 * before we start trying to access registers.
+	 *
+	 * We use the primary GT's forcewake register as our guinea pig since
+	 * it's been around since HSW and it's a masked register so the upper
+	 * 16 bits can never read back as 1's if device access is operating
+	 * properly.
+	 *
+	 * If MMIO isn't working, we'll wait up to 2 seconds to see if it
+	 * recovers, then give up.
+	 */
+#define COND (__raw_uncore_read32(uncore, FORCEWAKE_MT) != ~0)
+	if (wait_for(COND, 2000) == -ETIMEDOUT) {
+		drm_err(&i915->drm, "Device is non-operational; MMIO access returns 0xFFFFFFFF!\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
 int intel_uncore_init_mmio(struct intel_uncore *uncore)
 {
 	struct drm_i915_private *i915 = uncore->i915;
 	int ret;
 
+	ret = sanity_check_mmio_access(uncore);
+	if (ret)
+		return ret;
+
 	/*
 	 * The boot firmware initializes local memory and assesses its health.
 	 * If memory training fails, the punit will have been instructed to
Signature · 1 line
2.39.2
maintainer
#2 lore raw

Re: [Intel-gfx] [PATCH 1/2] drm/i915: Sanitycheck MMIO access early in driver load

Quoted 37 lines · Andi Shyti

From: Matt Roper <[email protected]>

We occasionally see the PCI device in a non-accessible state at the point the driver is loaded. When this happens, all BAR accesses will read back as 0xFFFFFFFF. Rather than reading registers and misinterpreting their (invalid) values, let's specifically check for 0xFFFFFFFF in a register that cannot have that value to see if the device is accessible.

---
 drivers/gpu/drm/i915/intel_uncore.c | 34 +++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/gpu/drm/i915/intel_uncore.c +13 -0
index e1e1f34490c8e..14ec45e6facfa 100644
@@ -2602,11 +2602,45 @@ static int uncore_forcewake_init(struct intel_uncore *uncore)
 	return 0;
 }
 
+static int sanity_check_mmio_access(struct intel_uncore *uncore)
+{
+	struct drm_i915_private *i915 = uncore->i915;
+
+	if (GRAPHICS_VER(i915) < 8)
+		return 0;
+
+	/*
+	 * Sanitycheck that MMIO access to the device is working properly.  If
+	 * the CPU is unable to communcate with a PCI device, BAR reads will
+	 * return 0xFFFFFFFF.  Let's make sure the device isn't in this state
+	 * before we start trying to access registers.
+	 *

drivers/gpu/drm/i915/intel_uncore.c static int uncore_forcewake_init(struct intel_uncore *uncore) · line 2627

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +10 -0
+	 * We use the primary GT's forcewake register as our guinea pig since
+	 * it's been around since HSW and it's a masked register so the upper
+	 * 16 bits can never read back as 1's if device access is operating
+	 * properly.
+	 *
+	 * If MMIO isn't working, we'll wait up to 2 seconds to see if it
+	 * recovers, then give up.
+	 */
+#define COND (__raw_uncore_read32(uncore, FORCEWAKE_MT) != ~0)
+	if (wait_for(COND, 2000) == -ETIMEDOUT) {

I guess this somewhat reimplements intel_wait_for_register_fw()?

Quoted 19 lines
drivers/gpu/drm/i915/intel_uncore.c +11 -0
+		drm_err(&i915->drm, "Device is non-operational; MMIO access returns 0xFFFFFFFF!\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
 int intel_uncore_init_mmio(struct intel_uncore *uncore)
 {
 	struct drm_i915_private *i915 = uncore->i915;
 	int ret;
 
+	ret = sanity_check_mmio_access(uncore);
+	if (ret)
+		return ret;
+
 	/*
 	 * The boot firmware initializes local memory and assesses its health.
 	 * If memory training fails, the punit will have been instructed to
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
author
#3 lore raw

Re: [Intel-gfx] [PATCH 1/2] drm/i915: Sanitycheck MMIO access early in driver load

Hi Jani,

Thanks for looking into this,

[...]

Quoted 4 lines

drivers/gpu/drm/i915/intel_uncore.c static int uncore_forcewake_init(struct intel_uncore *uncore) · line 2627

Quoted 2 lines
drivers/gpu/drm/i915/intel_uncore.c +2 -0
+#define COND (__raw_uncore_read32(uncore, FORCEWAKE_MT) != ~0)
+	if (wait_for(COND, 2000) == -ETIMEDOUT) {

I guess this somewhat reimplements intel_wait_for_register_fw()?

Thanks!

Andi

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +3 -0
+		drm_err(&i915->drm, "Device is non-operational; MMIO access returns 0xFFFFFFFF!\n");
+		return -EIO;
+	}
author
#4 lore raw

PATCH 2/2 drm/i915: Check for unreliable MMIO during forcewake

In reply to Andi Shyti

From: Matt Roper <[email protected]>

Although we now sanitycheck MMIO access during driver load to make sure the MMIO BAR isn't returning all 0xFFFFFFFF, there have been a few cases where (temporarily?) unreliable MMIO access has happened after GPU resets or power events. We'll often notice this on our next GT register access since forcewake handling will fail; let's change our handling slightly so that when this happens we print a more meaningful message clarifying that the problem is the MMIO access, not forcewake specifically.

---
 drivers/gpu/drm/i915/intel_uncore.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +9 -3
index 14ec45e6facfa..8b40a9772df5f 100644
@@ -178,9 +178,15 @@ static inline void
 fw_domain_wait_ack_clear(const struct intel_uncore_forcewake_domain *d)
 {
 	if (wait_ack_clear(d, FORCEWAKE_KERNEL)) {
-		drm_err(&d->uncore->i915->drm,
-			"%s: timed out waiting for forcewake ack to clear.\n",
-			intel_uncore_forcewake_domain_to_str(d->id));
+		if (fw_ack(d) == ~0)
+			drm_err(&d->uncore->i915->drm,
+				"%s: MMIO unreliable (forcewake register returns 0xFFFFFFFF)!\n",
+				intel_uncore_forcewake_domain_to_str(d->id));
+		else
+			drm_err(&d->uncore->i915->drm,
+				"%s: timed out waiting for forcewake ack to clear.\n",
+				intel_uncore_forcewake_domain_to_str(d->id));
+
 		add_taint_for_CI(d->uncore->i915, TAINT_WARN); /* CI now unreliable */
 	}
 }
Signature · 1 line
2.39.2
#7 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for Report MMIO communication problems more clearly

In reply to Andi Shyti
== Series Details ==

== Series Details ==

Series: Report MMIO communication problems more clearly
URL : https://patchwork.freedesktop.org/series/115421/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12884 -> Patchwork_115421v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_115421v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_115421v1, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/index.html

Participating hosts (35 -> 36)
------------------------------

Additional (1): bat-rpls-2

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_115421v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@hugepages:
- bat-atsm-1: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/bat-atsm-1/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-atsm-1/igt@i915_selftest@[email protected]

Known issues
------------

Here are the changes found in Patchwork_115421v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- bat-rpls-2: NOTRUN -> [SKIP][3] ([i915#7456])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@fbdev@read:
- bat-rpls-2: NOTRUN -> [SKIP][4] ([i915#2582]) +4 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@gem_lmem_swapping@verify-random:
- bat-rpls-2: NOTRUN -> [SKIP][5] ([i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-rpls-2: NOTRUN -> [SKIP][6] ([i915#3282])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@gem_tiled_pread_basic.html

* igt@i915_pm_backlight@basic-brightness:
- bat-rpls-2: NOTRUN -> [SKIP][7] ([i915#7561])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-rpls-2: NOTRUN -> [SKIP][8] ([i915#6621])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][9] ([i915#4258])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][10] ([i915#6997] / [i915#7913])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@i915_selftest@[email protected]
- bat-rpls-1: NOTRUN -> [DMESG-FAIL][11] ([i915#6367])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@kms_busy@basic:
- bat-rpls-2: NOTRUN -> [SKIP][12] ([i915#1845]) +15 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-rpls-2: NOTRUN -> [SKIP][13] ([i915#7828]) +8 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]
- bat-dg1-6: NOTRUN -> [SKIP][14] ([i915#7828])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-dg1-6/igt@[email protected]
- bat-rpls-1: NOTRUN -> [SKIP][15] ([i915#7828])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-1/igt@[email protected]

* igt@kms_flip@basic-flip-vs-dpms:
- bat-rpls-2: NOTRUN -> [SKIP][16] ([i915#3637]) +3 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-rpls-2: NOTRUN -> [SKIP][17] ([fdo#109285])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- bat-rpls-2: NOTRUN -> [SKIP][18] ([i915#1849])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-rpls-1: NOTRUN -> [SKIP][19] ([i915#1845])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-1/igt@[email protected]

* igt@kms_psr@sprite_plane_onoff:
- bat-rpls-2: NOTRUN -> [SKIP][20] ([i915#1072]) +3 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-rpls-2: NOTRUN -> [SKIP][21] ([i915#3555])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@prime_vgem@basic-fence-flip:
- bat-rpls-2: NOTRUN -> [SKIP][22] ([fdo#109295] / [i915#1845] / [i915#3708])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

* igt@prime_vgem@basic-fence-read:
- bat-rpls-2: NOTRUN -> [SKIP][23] ([fdo#109295] / [i915#3708]) +3 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-2/igt@[email protected]

#### Possible fixes ####

* igt@i915_pm_rpm@module-reload:
- bat-dg1-6: [ABORT][24] ([i915#7883]) -> [PASS][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/bat-dg1-6/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-dg1-6/igt@[email protected]

* igt@i915_selftest@live@reset:
- bat-rpls-1: [ABORT][26] ([i915#4983]) -> [PASS][27]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/bat-rpls-1/igt@i915_selftest@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-rpls-1/igt@i915_selftest@[email protected]

#### Warnings ####

* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg1-6: [SKIP][28] ([i915#3555]) -> [SKIP][29] ([i915#3555] / [i915#4579])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/bat-dg1-6/igt@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-dg1-6/igt@[email protected]
- fi-rkl-11600: [SKIP][30] ([i915#3555] / [i915#4098]) -> [SKIP][31] ([i915#3555] / [i915#4098] / [i915#4579])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/fi-rkl-11600/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/fi-rkl-11600/igt@[email protected]
- bat-dg1-5: [SKIP][32] ([i915#3555]) -> [SKIP][33] ([i915#3555] / [i915#4579])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/bat-dg1-5/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-dg1-5/igt@[email protected]
- fi-tgl-1115g4: [SKIP][34] ([i915#3555]) -> [SKIP][35] ([i915#3555] / [i915#4579])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/fi-tgl-1115g4/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/fi-tgl-1115g4/igt@[email protected]
- bat-dg1-7: [SKIP][36] ([i915#3555]) -> [SKIP][37] ([i915#3555] / [i915#4579])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12884/bat-dg1-7/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/bat-dg1-7/igt@[email protected]

[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7883]: https://gitlab.freedesktop.org/drm/intel/issues/7883
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913

Build changes
-------------

* Linux: CI_DRM_12884 -> Patchwork_115421v1

CI-20190529: 20190529
CI_DRM_12884: 1d4054731cfcb1cb9810d309b70535ae0b90ecf0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7208: f327c5d77b6ea6adff1ef6d08f21f232dfe093e3 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_115421v1: 1d4054731cfcb1cb9810d309b70535ae0b90ecf0 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

24aae8b0a1c5 drm/i915: Check for unreliable MMIO during forcewake f11928ce8dc9 drm/i915: Sanitycheck MMIO access early in driver load

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115421v1/index.html