From: Jani Nikula <jani.nikula@linux.intel.com>
To: Tilak Tangudu <tilak.tangudu@intel.com>,
intel-gfx@lists.freedesktop.org, jon.ewins@intel.com,
rodrigo.vivi@intel.com, vinay.belgaumkar@intel.com,
chris.p.wilson@intel.com, ashutosh.dixit@intel.com,
badal.nilawar@intel.com, anshuman.gupta@intel.com,
tilak.tangudu@intel.com, matthew.d.roper@intel.com,
saurabhg.gupta@intel.com, Aravind.Iddamsetty@intel.com,
Sujaritha.Sundaresan@intel.com
Subject: Re: [Intel-gfx] [PATCH 05/11] drm/i915: Guard rpm helpers in gt helpers functions
Date: Wed, 22 Jun 2022 15:52:59 +0300 [thread overview]
Message-ID: <8735fwsvv8.fsf@intel.com> (raw)
In-Reply-To: <20220621123516.370479-6-tilak.tangudu@intel.com>
On Tue, 21 Jun 2022, Tilak Tangudu <tilak.tangudu@intel.com> wrote:
> Guard rpm helpers in gt_sanitize and intel_gt_set_wedged
> with is_intel_rpm_allowed
>
> Acquire rpm wakeref for higherlevel function i915_gem_resume
>
> Signed-off-by: Tilak Tangudu <tilak.tangudu@intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_gt_pm.c | 12 ++++++------
> drivers/gpu/drm/i915/gt/intel_reset.c | 10 +++++++---
> drivers/gpu/drm/i915/i915_driver.c | 4 +++-
> 3 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> index be99b01a0984..9857b91194b7 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> @@ -163,12 +163,14 @@ static void gt_sanitize(struct intel_gt *gt, bool force)
> {
> struct intel_engine_cs *engine;
> enum intel_engine_id id;
> - intel_wakeref_t wakeref;
> + intel_wakeref_t wakeref = 0;
We've got intel_wakeref_t to hide what it actually is. You shouldn't
assume you can assign 0 to it or use wakeref in an if condition. You
should treat it as opaque. You should assume the typedef could be
switched to a struct and you shouldn't have to change the code using it.
BR,
Jani.
>
> GT_TRACE(gt, "force:%s", str_yes_no(force));
>
> /* Use a raw wakeref to avoid calling intel_display_power_get early */
> - wakeref = intel_runtime_pm_get(gt->uncore->rpm);
> + if (is_intel_rpm_allowed(gt->uncore->rpm))
> + wakeref = intel_runtime_pm_get(gt->uncore->rpm);
> +
> intel_uncore_forcewake_get(gt->uncore, FORCEWAKE_ALL);
>
> intel_gt_check_clock_frequency(gt);
> @@ -207,7 +209,8 @@ static void gt_sanitize(struct intel_gt *gt, bool force)
> intel_rps_sanitize(>->rps);
>
> intel_uncore_forcewake_put(gt->uncore, FORCEWAKE_ALL);
> - intel_runtime_pm_put(gt->uncore->rpm, wakeref);
> + if (wakeref)
> + intel_runtime_pm_put(gt->uncore->rpm, wakeref);
> }
>
> void intel_gt_pm_fini(struct intel_gt *gt)
> @@ -226,7 +229,6 @@ int intel_gt_resume(struct intel_gt *gt)
> return err;
>
> GT_TRACE(gt, "\n");
> -
> /*
> * After resume, we may need to poke into the pinned kernel
> * contexts to paper over any damage caused by the sudden suspend.
> @@ -259,10 +261,8 @@ int intel_gt_resume(struct intel_gt *gt)
>
> for_each_engine(engine, gt, id) {
> intel_engine_pm_get(engine);
> -
> engine->serial++; /* kernel context lost */
> err = intel_engine_resume(engine);
> -
> intel_engine_pm_put(engine);
> if (err) {
> drm_err(>->i915->drm,
> diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
> index c8e05b48c14f..55a1fd38c7c4 100644
> --- a/drivers/gpu/drm/i915/gt/intel_reset.c
> +++ b/drivers/gpu/drm/i915/gt/intel_reset.c
> @@ -901,12 +901,14 @@ static void __intel_gt_set_wedged(struct intel_gt *gt)
>
> void intel_gt_set_wedged(struct intel_gt *gt)
> {
> - intel_wakeref_t wakeref;
> + intel_wakeref_t wakeref = 0;
>
> if (test_bit(I915_WEDGED, >->reset.flags))
> return;
>
> - wakeref = intel_runtime_pm_get(gt->uncore->rpm);
> + if (is_intel_rpm_allowed(gt->uncore->rpm))
> + wakeref = intel_runtime_pm_get(gt->uncore->rpm);
> +
> mutex_lock(>->reset.mutex);
>
> if (GEM_SHOW_DEBUG()) {
> @@ -926,7 +928,9 @@ void intel_gt_set_wedged(struct intel_gt *gt)
> __intel_gt_set_wedged(gt);
>
> mutex_unlock(>->reset.mutex);
> - intel_runtime_pm_put(gt->uncore->rpm, wakeref);
> +
> + if (wakeref)
> + intel_runtime_pm_put(gt->uncore->rpm, wakeref);
> }
>
> static bool __intel_gt_unset_wedged(struct intel_gt *gt)
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index d26dcca7e654..60f6fcc6b71d 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1263,6 +1263,7 @@ int i915_driver_suspend_switcheroo(struct drm_i915_private *i915,
> static int i915_drm_resume(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = to_i915(dev);
> + intel_wakeref_t wakeref;
> int ret;
>
> disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
> @@ -1303,7 +1304,8 @@ static int i915_drm_resume(struct drm_device *dev)
> if (HAS_DISPLAY(dev_priv))
> drm_mode_config_reset(dev);
>
> - i915_gem_resume(dev_priv);
> + with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref)
> + i915_gem_resume(dev_priv);
>
> intel_modeset_init_hw(dev_priv);
> intel_init_clock_gating(dev_priv);
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2022-06-22 12:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 12:35 [Intel-gfx] [PATCH 00/11] drm/i915: Add D3Cold-Off support for runtime-pm Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 01/11] drm/i915: Avoid rpm helpers in intel_guc_global_policies_update Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 02/11] drm/i915: Avoid rpm helpers in intel_guc_slpc_set_media_ratio_mode Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 03/11] drm/i915: Avoid rpm helpers in intel_gt_suspend_late Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 04/11] drm/i915: Added is_intel_rpm_allowed helper Tilak Tangudu
2022-06-21 14:16 ` Gupta, Anshuman
2022-06-21 14:22 ` Tangudu, Tilak
2022-06-22 12:55 ` Jani Nikula
2022-06-22 20:40 ` Rodrigo Vivi
2022-06-23 17:21 ` Tangudu, Tilak
2022-06-23 17:49 ` Jani Nikula
2022-06-21 12:35 ` [Intel-gfx] [PATCH 05/11] drm/i915: Guard rpm helpers in gt helpers functions Tilak Tangudu
2022-06-22 12:52 ` Jani Nikula [this message]
2022-06-21 12:35 ` [Intel-gfx] [PATCH 06/11] drm/i915: Avoid rpm helpers in try_context_registration Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 07/11] drm/i915: Guard rc6 helpers with is_intel_rpm_allowed Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 08/11] drm/i915: Guard rpm helpers in rpm_get/put Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 09/11] drm/i915: Add i915_save/load_pci_state helpers Tilak Tangudu
2022-06-21 16:30 ` kernel test robot
2022-06-21 19:44 ` kernel test robot
2022-06-21 22:57 ` kernel test robot
2022-06-22 8:35 ` kernel test robot
2022-06-21 12:35 ` [Intel-gfx] [PATCH 10/11] drm/i915: Guard rpm helpers at gt_park/unpark Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 11/11] drm/i915 : Add D3COLD OFF support Tilak Tangudu
2022-06-21 13:15 ` Gupta, Anshuman
2022-06-21 13:24 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Add D3Cold-Off support for runtime-pm Patchwork
2022-06-23 17:35 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Add D3Cold-Off support for runtime-pm (rev2) 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=8735fwsvv8.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=Aravind.Iddamsetty@intel.com \
--cc=Sujaritha.Sundaresan@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=badal.nilawar@intel.com \
--cc=chris.p.wilson@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jon.ewins@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=saurabhg.gupta@intel.com \
--cc=tilak.tangudu@intel.com \
--cc=vinay.belgaumkar@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