From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 07 Jun 2023 16:49:46 -0700 Message-ID: <877csen885.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Belgaumkar, Vinay" In-Reply-To: <6c9e4193-f569-b65d-09ed-9a959ef82274@intel.com> References: <20230606203535.292739-1-vinay.belgaumkar@intel.com> <87bkhrm0xk.wl-ashutosh.dixit@intel.com> <87a5xanaoq.wl-ashutosh.dixit@intel.com> <408f6bd2-66bb-5fc6-345b-f7ed34715a5f@intel.com> <6c9e4193-f569-b65d-09ed-9a959ef82274@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] tests/i915_pm_freq_api: Add a suspend subtest List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Wed, 07 Jun 2023 16:40:53 -0700, Belgaumkar, Vinay wrote: > > > On 6/7/2023 4:11 PM, Belgaumkar, Vinay wrote: > > > > On 6/7/2023 3:56 PM, Dixit, Ashutosh wrote: > >> On Wed, 07 Jun 2023 15:31:33 -0700, Belgaumkar, Vinay wrote: > >>> On 6/7/2023 2:12 PM, Dixit, Ashutosh wrote: > >>>> On Tue, 06 Jun 2023 13:35:35 -0700, Vinay Belgaumkar wrote: > >>>> Hi Vinay, > >>>> > >>>>> Verify that SLPC API works as expected after a suspend. > >>>>> > >>>>> Signed-off-by: Vinay Belgaumkar > >>>>> --- > >>>>> =A0=A0 tests/i915/i915_pm_freq_api.c | 30 +++++++++++++++++++++++++= +++++ > >>>>> =A0=A0 1 file changed, 30 insertions(+) > >>>>> > >>>>> diff --git a/tests/i915/i915_pm_freq_api.c > >>>>> b/tests/i915/i915_pm_freq_api.c > >>>>> index 9005cd220..f35f1f8e0 100644 > >>>>> --- a/tests/i915/i915_pm_freq_api.c > >>>>> +++ b/tests/i915/i915_pm_freq_api.c > >>>>> @@ -18,6 +18,9 @@ > >>>>> =A0=A0=A0 * > >>>>> =A0=A0=A0 * SUBTEST: freq-reset > >>>>> =A0=A0=A0 * Description: Test basic freq API works after a reset > >>>>> + * > >>>>> + * SUBTEST: freq-suspend > >>>>> + * Description: Test basic freq API works after a runtime suspend > >>>>> =A0=A0=A0 */ > >>>>> > >>>>> =A0=A0 IGT_TEST_DESCRIPTION("Test SLPC freq API"); > >>>>> @@ -99,6 +102,24 @@ static void test_reset(int i915, int dirfd, int > >>>>> gt) > >>>>> =A0=A0=A0=A0igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) =3D=3D rpn= ); > >>>>> =A0=A0 } > >>>>> > >>>>> +static void test_suspend(int i915, int dirfd, int gt) > >>>>> +{ > >>>>> +=A0=A0=A0 uint32_t rpn =3D get_freq(dirfd, RPS_RPn_FREQ_MHZ); > >>>>> + > >>>>> +=A0=A0=A0 igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0); > >>>>> +=A0=A0=A0 igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0); > >>>>> +=A0=A0=A0 usleep(ACT_FREQ_LATENCY_US); > >>>>> +=A0=A0=A0 igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) =3D=3D rpn); > >>>>> +=A0=A0=A0 igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) =3D=3D rpn); > >>>>> + > >>>>> +=A0=A0=A0 /* Manually trigger a suspend */ > >>>>> +=A0=A0=A0 igt_system_suspend_autoresume(SUSPEND_STATE_S3, > >>>>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 SU= SPEND_TEST_NONE); > >>>>> + > >>>>> +=A0=A0=A0 igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) =3D=3D rpn); > >>>>> +=A0=A0=A0 igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) =3D=3D rpn); > >>>> I am wondering what the purpose/value of this test (and also > >>>> "freq-reset") > >>>> is?=A0 How can the "set" min/max set freq (which are just input > >>>> settings) > >>>> change whether or not there is a suspend/resume or a reset? Especial= ly > >>>> when > >>>> we just return cached min/max values from i915? > >>> It is mainly checking that we don't smother the softlimit during a > >>> reset or > >>> suspend flow. > >> How can softlimit which is a ordinary variable in memory get clobbered > >> by > >> suspend resume? > > It shouldn't, but funnier things have happened. Anyways, I can add a check > for cur_freq and ensure that is at min. That will prove we applied the so= ft > limit after suspend. > > Thanks, > > Vinay. > > >> > >>> In addition, it also tests the read/write interface works as expected > >>> after those events. > >> There's no write. Sorry, but I'm not convinced. There should be some > >> more > >> meat to the test. > > There are writes in the IGT fixture after the test completes. This should also be in an exit handler, not in the fixture? See gem_ctx_freq e.g. Thanks. -- Ashutosh > >> > >> Maybe we can write a test which will check /all/ sysfs values are the > >> same > >> after a suspend resume cycle? Why do only these specific ones have to = be > >> checked? > > > > This test is specific to the freq api, hence just min/max entries. > > > > Thanks, > > > > Vinay. > > > >> > >> Thanks. > >> -- > >> Ashutosh > >> > >> > >>> Thanks, > >>> > >>> Vinay. > >>> > >>>> Thanks. > >>>> -- > >>>> Ashutosh > >>>> > >>>> > >>>>> +} > >>>>> + > >>>>> =A0=A0 igt_main > >>>>> =A0=A0 { > >>>>> =A0=A0=A0=A0int i915 =3D -1; > >>>>> @@ -143,6 +164,15 @@ igt_main > >>>>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 test_reset(i915, dirf= d, gt); > >>>>> =A0=A0=A0=A0} > >>>>> > >>>>> +=A0=A0=A0 igt_describe("Test basic freq API works after suspend"); > >>>>> +=A0=A0=A0 igt_subtest_with_dynamic_f("freq-suspend") { > >>>>> +=A0=A0=A0=A0=A0=A0=A0 int dirfd, gt; > >>>>> + > >>>>> +=A0=A0=A0=A0=A0=A0=A0 for_each_sysfs_gt_dirfd(i915, dirfd, gt) > >>>>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 igt_dynamic_f("gt%u", gt) > >>>>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 test_suspend(i915, d= irfd, gt); > >>>>> +=A0=A0=A0 } > >>>>> + > >>>>> =A0=A0=A0=A0igt_fixture { > >>>>> =A0=A0=A0=A0=A0=A0=A0 int dirfd, gt; > >>>>> =A0=A0=A0=A0=A0=A0=A0 /* Restore frequencies */ > >>>>> -- > >>>>> 2.38.1 > >>>>>