From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id A63DC10E5FF for ; Thu, 8 Jun 2023 17:45:40 +0000 (UTC) Message-ID: <044cb5a8-808f-6973-863f-a154afb5ce9d@intel.com> Date: Thu, 8 Jun 2023 10:45:28 -0700 Content-Language: en-US To: Ashutosh Dixit , References: <20230608154756.2866519-1-ashutosh.dixit@intel.com> <20230608154756.2866519-4-ashutosh.dixit@intel.com> From: "Belgaumkar, Vinay" In-Reply-To: <20230608154756.2866519-4-ashutosh.dixit@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Subject: Re: [igt-dev] [PATCH v2 i-g-t 3/4] tests/gem_ctx_freq: Disable SLPC efficient freq for the test List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On 6/8/2023 8:47 AM, Ashutosh Dixit wrote: > When SLPC efficient freq is enabled, GPU frequencies can be outside the > min/max range set from sysfs. Any test which compares actual GPU frequency > against set frequencies is therefore meaningful only when SLPC efficient > freq is disabled. > > v2: Move ignore_slpc_efficient_freq to lib/igt_pm.c (Vinay) LGTM, Reviewed-by: Vinay Belgaumkar > > Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6786 > Signed-off-by: Ashutosh Dixit > --- > lib/igt_pm.c | 17 +++++++++++++++++ > lib/igt_pm.h | 1 + > tests/i915/gem_ctx_freq.c | 6 +++++- > 3 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/lib/igt_pm.c b/lib/igt_pm.c > index e60b09a73140..18c84bf3a021 100644 > --- a/lib/igt_pm.c > +++ b/lib/igt_pm.c > @@ -1400,3 +1400,20 @@ int igt_pm_get_runtime_usage(struct pci_device *pci_dev) > > return usage; > } > + > +/** > + * igt_pm_ignore_slpc_efficient_freq > + * @i915: open i915 drm file descriptor > + * @gtfd: open gt sysfs fd > + * @val: value to set > + * > + * Ignores/un-ignores SLPC efficient frequency > + */ > +void igt_pm_ignore_slpc_efficient_freq(int i915, int gtfd, bool val) > +{ > + if (!(gem_using_guc_submission(i915) && i915_is_slpc_enabled(i915))) > + return; > + > + igt_require(igt_sysfs_has_attr(gtfd, "slpc_ignore_eff_freq")); > + igt_assert(igt_sysfs_set_u32(gtfd, "slpc_ignore_eff_freq", val)); > +} > diff --git a/lib/igt_pm.h b/lib/igt_pm.h > index 448cf42de7f1..71ec2f239993 100644 > --- a/lib/igt_pm.h > +++ b/lib/igt_pm.h > @@ -88,5 +88,6 @@ bool i915_is_slpc_enabled_gt(int drm_fd, int gt); > bool i915_is_slpc_enabled(int drm_fd); > int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev); > int igt_pm_get_runtime_usage(struct pci_device *pci_dev); > +void igt_pm_ignore_slpc_efficient_freq(int i915, int gtfd, bool val); > > #endif /* IGT_PM_H */ > diff --git a/tests/i915/gem_ctx_freq.c b/tests/i915/gem_ctx_freq.c > index b2f6c2af55e1..d15f83600480 100644 > --- a/tests/i915/gem_ctx_freq.c > +++ b/tests/i915/gem_ctx_freq.c > @@ -147,9 +147,11 @@ static void sysfs_range(int dirfd, int gt) > * The sysfs interface sets the global limits and overrides the > * user's request. So we can to check that if the user requests > * a range outside of the sysfs, the requests are only run at the > - * constriained sysfs range. > + * constrained sysfs range. With GuC SLPC this requires disabling > + * efficient freq. > */ > > + igt_pm_ignore_slpc_efficient_freq(i915, dirfd, true); > igt_require(get_sysfs_freq(dirfd, &sys_min, &sys_max)); > igt_info("System min freq: %dMHz; max freq: %dMHz\n", sys_min, sys_max); > > @@ -199,6 +201,8 @@ static void __restore_sysfs_freq(int dirfd) > { > char buf[256]; > > + igt_pm_ignore_slpc_efficient_freq(i915, dirfd, false); > + > if (igt_sysfs_read(sysfs, "gt_RPn_freq_mhz", buf, sizeof(buf)) > 0) > igt_sysfs_rps_set(dirfd, RPS_MIN_FREQ_MHZ, buf); >