From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Riana Tauro <riana.tauro@intel.com>
Cc: anshuman.gupta@intel.com, intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] drm/xe/guc_pc: Reorder forcewake and xe_pm_runtime calls
Date: Wed, 19 Apr 2023 16:25:15 -0400 [thread overview]
Message-ID: <ZEBOK945SSdHDh4V@intel.com> (raw)
In-Reply-To: <20230419090933.289818-1-riana.tauro@intel.com>
On Wed, Apr 19, 2023 at 02:39:33PM +0530, Riana Tauro wrote:
> When the device is runtime suspended, reading some of the sysfs
> entries under device/gt#/ causes a resume error
> This is due to the ordering of pm_runtime and forcewake calls.
> Reorder to wake up using xe_pm_runtime_get and then forcewake
>
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_pc.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 5a8d827ba770..f71f6b3df38a 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -370,6 +370,7 @@ static ssize_t freq_act_show(struct device *dev,
> u32 freq;
> ssize_t ret;
>
> + xe_device_mem_access_get(gt_to_xe(gt));
> /*
> * When in RC6, actual frequency is 0. Let's block RC6 so we are able
> * to verify that our freq requests are really happening.
> @@ -378,8 +379,6 @@ static ssize_t freq_act_show(struct device *dev,
> if (ret)
> return ret;
you probably need to change these returns to some goto, no?!
(and others below as well...)
>
> - xe_device_mem_access_get(gt_to_xe(gt));
> -
> if (xe->info.platform == XE_METEORLAKE) {
> freq = xe_mmio_read32(gt, MTL_MIRROR_TARGET_WP1.reg);
> freq = REG_FIELD_GET(MTL_CAGF_MASK, freq);
> @@ -388,11 +387,10 @@ static ssize_t freq_act_show(struct device *dev,
> freq = REG_FIELD_GET(GEN12_CAGF_MASK, freq);
> }
>
> - xe_device_mem_access_put(gt_to_xe(gt));
> -
> ret = sysfs_emit(buf, "%d\n", decode_freq(freq));
>
> XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> + xe_device_mem_access_put(gt_to_xe(gt));
> return ret;
> }
> static DEVICE_ATTR_RO(freq_act);
> @@ -405,6 +403,7 @@ static ssize_t freq_cur_show(struct device *dev,
> u32 freq;
> ssize_t ret;
>
> + xe_device_mem_access_get(gt_to_xe(gt));
> /*
> * GuC SLPC plays with cur freq request when GuCRC is enabled
> * Block RC6 for a more reliable read.
> @@ -413,14 +412,13 @@ static ssize_t freq_cur_show(struct device *dev,
> if (ret)
> return ret;
>
> - xe_device_mem_access_get(gt_to_xe(gt));
> freq = xe_mmio_read32(gt, GEN6_RPNSWREQ.reg);
> - xe_device_mem_access_put(gt_to_xe(gt));
>
> freq = REG_FIELD_GET(REQ_RATIO_MASK, freq);
> ret = sysfs_emit(buf, "%d\n", decode_freq(freq));
>
> XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> + xe_device_mem_access_put(gt_to_xe(gt));
> return ret;
> }
> static DEVICE_ATTR_RO(freq_cur);
> @@ -610,17 +608,16 @@ static ssize_t rc6_residency_show(struct device *dev,
> u32 reg;
> ssize_t ret;
>
> + xe_device_mem_access_get(pc_to_xe(pc));
> ret = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> if (ret)
> return ret;
>
> - xe_device_mem_access_get(pc_to_xe(pc));
> reg = xe_mmio_read32(gt, GEN6_GT_GFX_RC6.reg);
> - xe_device_mem_access_put(pc_to_xe(pc));
> -
> ret = sysfs_emit(buff, "%u\n", reg);
>
> XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> + xe_device_mem_access_put(pc_to_xe(pc));
> return ret;
> }
> static DEVICE_ATTR_RO(rc6_residency);
> --
> 2.40.0
>
prev parent reply other threads:[~2023-04-19 20:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 9:09 [Intel-xe] [PATCH] drm/xe/guc_pc: Reorder forcewake and xe_pm_runtime calls Riana Tauro
2023-04-19 9:18 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-04-19 9:19 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-04-19 9:23 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-04-19 9:44 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-04-19 20:25 ` Rodrigo Vivi [this message]
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=ZEBOK945SSdHDh4V@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=riana.tauro@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.