diff mbox series

drm/i915/gt: prevent forcewake releases during BAR resize

Message ID 20230308112349.1882182-1-andrzej.hajda@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/gt: prevent forcewake releases during BAR resize | expand

Commit Message

Andrzej Hajda March 8, 2023, 11:23 a.m. UTC
Tests on DG2 machines show that releasing forcewakes during BAR resize
results later in forcewake ack timeouts. Since forcewakes can be realeased
asynchronously the simplest way to prevent it is to get all forcewakes
for duration of BAR resizing.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_region_lmem.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Rodrigo Vivi March 8, 2023, 1:16 p.m. UTC | #1
On Wed, Mar 08, 2023 at 12:23:49PM +0100, Andrzej Hajda wrote:
> Tests on DG2 machines show that releasing forcewakes during BAR resize
> results later in forcewake ack timeouts. Since forcewakes can be realeased
> asynchronously the simplest way to prevent it is to get all forcewakes
> for duration of BAR resizing.
> 
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_region_lmem.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> index 89fdfc67f8d1e0..5a01dc6ca08324 100644
> --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> @@ -54,6 +54,7 @@ static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t
>  	struct resource *root_res;
>  	resource_size_t rebar_size;
>  	resource_size_t current_size;
> +	intel_wakeref_t wakeref;
>  	u32 pci_cmd;
>  	int i;
>  
> @@ -102,6 +103,14 @@ static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t
>  		return;
>  	}
>  
> +	/*
> +	 * Releasing forcewake during BAR resizing results in later forcewake
> +	 * ack timeouts and former can happen any time - it is asynchronous.
> +	 * Grabbing all forcewakes prevents it.
> +	 */
> +	with_intel_runtime_pm(i915->uncore.rpm, wakeref)

I believe that instead of the with_rpm you should probably get the rpm ref here
and return after returning the forcewake put. So you also ensure that we are
not going to suspend and allowing D3 during the resize.

> +		intel_uncore_forcewake_get(&i915->uncore, FORCEWAKE_ALL);
> +
>  	/* First disable PCI memory decoding references */
>  	pci_read_config_dword(pdev, PCI_COMMAND, &pci_cmd);
>  	pci_write_config_dword(pdev, PCI_COMMAND,
> @@ -111,6 +120,9 @@ static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t
>  
>  	pci_assign_unassigned_bus_resources(pdev->bus);
>  	pci_write_config_dword(pdev, PCI_COMMAND, pci_cmd);
> +
> +	with_intel_runtime_pm(i915->uncore.rpm, wakeref)
> +		intel_uncore_forcewake_put(&i915->uncore, FORCEWAKE_ALL);
>  }
>  #else
>  static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t lmem_size) {}
> -- 
> 2.34.1
>
Andrzej Hajda March 8, 2023, 4:08 p.m. UTC | #2
On 08.03.2023 16:44, Patchwork wrote:
> *Patch Details*
> *Series:*	drm/i915/gt: prevent forcewake releases during BAR resize (rev3)
> *URL:*	https://patchwork.freedesktop.org/series/114836/ 
> <https://patchwork.freedesktop.org/series/114836/>
> *State:*	failure
> *Details:* 
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/index.html 
> <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/index.html>
> 
> 
>   CI Bug Log - changes from CI_DRM_12827 -> Patchwork_114836v3
> 
> 
>     Summary
> 
> *FAILURE*
> 
> Serious unknown changes coming with Patchwork_114836v3 absolutely need to be
> verified manually.
> 
> If you think the reported changes have nothing to do with the changes
> introduced in Patchwork_114836v3, 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_114836v3/index.html
> 
> 
>     Participating hosts (35 -> 34)
> 
> Additional (1): bat-dg1-6
> Missing (2): bat-kbl-2 fi-snb-2520m
> 
> 
>     Possible new issues
> 
> Here are the unknown changes that may have been introduced in 
> Patchwork_114836v3:
> 
> 
>       IGT changes
> 
> 
>         Possible regressions
> 
>   * igt@i915_selftest@live@execlists:
>       o fi-glk-j4005: PASS
>         <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12827/fi-glk-j4005/igt@i915_selftest@live@execlists.html> -> ABORT <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/fi-glk-j4005/igt@i915_selftest@live@execlists.html>
> 

Unrelated, and already observed [1].

[1]: 
http://gfx-ci.igk.intel.com/tree/drm-tip/IGT_7184/fi-bsw-nick/igt@i915_selftest@live@execlists.html

Regards
Andrzej

> 
>     Known issues
> 
> Here are the changes found in Patchwork_114836v3 that come from known 
> issues:
> 
> 
>       IGT changes
> 
> 
>         Issues hit
> 
>   *
> 
>     igt@gem_mmap@basic:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@gem_mmap@basic.html> (i915#4083 <https://gitlab.freedesktop.org/drm/intel/issues/4083>)
>   *
> 
>     igt@gem_render_tiled_blits@basic:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@gem_render_tiled_blits@basic.html> (i915#4079 <https://gitlab.freedesktop.org/drm/intel/issues/4079>) +1 similar issue
>   *
> 
>     igt@gem_tiled_fence_blits@basic:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@gem_tiled_fence_blits@basic.html> (i915#4077 <https://gitlab.freedesktop.org/drm/intel/issues/4077>) +2 similar issues
>   *
> 
>     igt@i915_pm_backlight@basic-brightness:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@i915_pm_backlight@basic-brightness.html> (i915#7561 <https://gitlab.freedesktop.org/drm/intel/issues/7561>)
>   *
> 
>     igt@i915_pm_rps@basic-api:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@i915_pm_rps@basic-api.html> (i915#6621 <https://gitlab.freedesktop.org/drm/intel/issues/6621>)
>   *
> 
>     igt@i915_selftest@live@slpc:
> 
>       o bat-rpls-1: NOTRUN -> DMESG-FAIL
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-rpls-1/igt@i915_selftest@live@slpc.html> (i915#6367 <https://gitlab.freedesktop.org/drm/intel/issues/6367>)
>   *
> 
>     igt@kms_addfb_basic@basic-y-tiled-legacy:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@kms_addfb_basic@basic-y-tiled-legacy.html> (i915#4215 <https://gitlab.freedesktop.org/drm/intel/issues/4215>)
>   *
> 
>     igt@kms_addfb_basic@tile-pitch-mismatch:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@kms_addfb_basic@tile-pitch-mismatch.html> (i915#4212 <https://gitlab.freedesktop.org/drm/intel/issues/4212>) +7 similar issues
>   *
> 
>     igt@kms_chamelium_hpd@common-hpd-after-suspend:
> 
>       o
> 
>         bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@kms_chamelium_hpd@common-hpd-after-suspend.html> (i915#7828 <https://gitlab.freedesktop.org/drm/intel/issues/7828>) +8 similar issues
> 
>       o
> 
>         bat-rpls-1: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-rpls-1/igt@kms_chamelium_hpd@common-hpd-after-suspend.html> (i915#7828 <https://gitlab.freedesktop.org/drm/intel/issues/7828>)
> 
>   *
> 
>     igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html> (i915#4103 <https://gitlab.freedesktop.org/drm/intel/issues/4103> / i915#4213 <https://gitlab.freedesktop.org/drm/intel/issues/4213>) +1 similar issue
>   *
> 
>     igt@kms_force_connector_basic@force-load-detect:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@kms_force_connector_basic@force-load-detect.html> (fdo#109285 <https://bugs.freedesktop.org/show_bug.cgi?id=109285>)
>   *
> 
>     igt@kms_pipe_crc_basic@suspend-read-crc:
> 
>       o bat-rpls-1: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-rpls-1/igt@kms_pipe_crc_basic@suspend-read-crc.html> (i915#1845 <https://gitlab.freedesktop.org/drm/intel/issues/1845>)
>   *
> 
>     igt@kms_psr@sprite_plane_onoff:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@kms_psr@sprite_plane_onoff.html> (i915#1072 <https://gitlab.freedesktop.org/drm/intel/issues/1072> / i915#4078 <https://gitlab.freedesktop.org/drm/intel/issues/4078>) +3 similar issues
>   *
> 
>     igt@kms_setmode@basic-clone-single-crtc:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@kms_setmode@basic-clone-single-crtc.html> (i915#3555 <https://gitlab.freedesktop.org/drm/intel/issues/3555>)
>   *
> 
>     igt@prime_vgem@basic-gtt:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@prime_vgem@basic-gtt.html> (i915#3708 <https://gitlab.freedesktop.org/drm/intel/issues/3708> / i915#4077 <https://gitlab.freedesktop.org/drm/intel/issues/4077>) +1 similar issue
>   *
> 
>     igt@prime_vgem@basic-read:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@prime_vgem@basic-read.html> (i915#3708 <https://gitlab.freedesktop.org/drm/intel/issues/3708>) +3 similar issues
>   *
> 
>     igt@prime_vgem@basic-userptr:
> 
>       o bat-dg1-6: NOTRUN -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-6/igt@prime_vgem@basic-userptr.html> (i915#3708 <https://gitlab.freedesktop.org/drm/intel/issues/3708> / i915#4873 <https://gitlab.freedesktop.org/drm/intel/issues/4873>)
> 
> 
>         Possible fixes
> 
>   *
> 
>     igt@i915_selftest@live@hangcheck:
> 
>       o fi-skl-guc: DMESG-WARN
>         <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12827/fi-skl-guc/igt@i915_selftest@live@hangcheck.html> (i915#8073 <https://gitlab.freedesktop.org/drm/intel/issues/8073>) -> PASS <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/fi-skl-guc/igt@i915_selftest@live@hangcheck.html>
>   *
> 
>     igt@i915_selftest@live@requests:
> 
>       o bat-rpls-1: ABORT
>         <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12827/bat-rpls-1/igt@i915_selftest@live@requests.html> (i915#4983 <https://gitlab.freedesktop.org/drm/intel/issues/4983> / i915#7694 <https://gitlab.freedesktop.org/drm/intel/issues/7694> / i915#7911 <https://gitlab.freedesktop.org/drm/intel/issues/7911> / i915#7981 <https://gitlab.freedesktop.org/drm/intel/issues/7981>) -> PASS <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-rpls-1/igt@i915_selftest@live@requests.html>
>   *
> 
>     igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-hdmi-a-2:
> 
>       o bat-dg1-5: FAIL
>         <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12827/bat-dg1-5/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-hdmi-a-2.html> (fdo#103375 <https://bugs.freedesktop.org/show_bug.cgi?id=103375>) -> PASS <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114836v3/bat-dg1-5/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-hdmi-a-2.html> +3 similar issues
> 
> 
>     Build changes
> 
>   * Linux: CI_DRM_12827 -> Patchwork_114836v3
> 
> CI-20190529: 20190529
> CI_DRM_12827: b794b8d84dc0470ee58467386f41870e81a86580 @ 
> git://anongit.freedesktop.org/gfx-ci/linux
> IGT_7183: 3434cef8be4e487644a740039ad15123cd094526 @ 
> https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
> Patchwork_114836v3: b794b8d84dc0470ee58467386f41870e81a86580 @ 
> git://anongit.freedesktop.org/gfx-ci/linux
> 
> 
>       Linux commits
> 
> 6eed413c855f drm/i915/gt: prevent forcewake releases during BAR resize
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
index 89fdfc67f8d1e0..5a01dc6ca08324 100644
--- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
+++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
@@ -54,6 +54,7 @@  static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t
 	struct resource *root_res;
 	resource_size_t rebar_size;
 	resource_size_t current_size;
+	intel_wakeref_t wakeref;
 	u32 pci_cmd;
 	int i;
 
@@ -102,6 +103,14 @@  static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t
 		return;
 	}
 
+	/*
+	 * Releasing forcewake during BAR resizing results in later forcewake
+	 * ack timeouts and former can happen any time - it is asynchronous.
+	 * Grabbing all forcewakes prevents it.
+	 */
+	with_intel_runtime_pm(i915->uncore.rpm, wakeref)
+		intel_uncore_forcewake_get(&i915->uncore, FORCEWAKE_ALL);
+
 	/* First disable PCI memory decoding references */
 	pci_read_config_dword(pdev, PCI_COMMAND, &pci_cmd);
 	pci_write_config_dword(pdev, PCI_COMMAND,
@@ -111,6 +120,9 @@  static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t
 
 	pci_assign_unassigned_bus_resources(pdev->bus);
 	pci_write_config_dword(pdev, PCI_COMMAND, pci_cmd);
+
+	with_intel_runtime_pm(i915->uncore.rpm, wakeref)
+		intel_uncore_forcewake_put(&i915->uncore, FORCEWAKE_ALL);
 }
 #else
 static void i915_resize_lmem_bar(struct drm_i915_private *i915, resource_size_t lmem_size) {}