public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
	Matthew Auld <matthew.auld@intel.com>,
	chris.p.wilson@linux.intel.com, Nirmoy Das <nirmoy.das@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: prevent forcewake releases during BAR resize
Date: Wed, 8 Mar 2023 08:16:42 -0500	[thread overview]
Message-ID: <ZAiKuulQBp0569s/@intel.com> (raw)
In-Reply-To: <20230308112349.1882182-1-andrzej.hajda@intel.com>

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
> 

  reply	other threads:[~2023-03-08 13:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 11:23 [Intel-gfx] [PATCH] drm/i915/gt: prevent forcewake releases during BAR resize Andrzej Hajda
2023-03-08 13:16 ` Rodrigo Vivi [this message]
2023-03-08 13:34   ` Andrzej Hajda
2023-03-08 13:36   ` [Intel-gfx] [PATCH v2] " Andrzej Hajda
2023-03-08 17:29     ` Das, Nirmoy
2023-03-09  7:54       ` Andrzej Hajda
2023-03-09  8:31         ` Das, Nirmoy
2023-03-08 17:31     ` Rodrigo Vivi
2023-03-09  0:11     ` Andi Shyti
2023-03-16 18:20     ` Andrzej Hajda
2023-03-08 15:44 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: prevent forcewake releases during BAR resize (rev3) Patchwork
2023-03-08 16:08   ` Andrzej Hajda
2023-03-09 20:15 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gt: prevent forcewake releases during BAR resize (rev5) Patchwork
2023-03-11 19:06 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZAiKuulQBp0569s/@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=chris.p.wilson@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=nirmoy.das@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox