Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Riana Tauro <riana.tauro@intel.com>
To: "Gupta, Anshuman" <anshuman.gupta@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Nilawar, Badal" <badal.nilawar@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 4/4] tests/xe: Add a test that validates residency during s2idle
Date: Thu, 3 Aug 2023 14:18:16 +0530	[thread overview]
Message-ID: <2f00dd9e-9a10-ebd6-88f8-5147a4346230@intel.com> (raw)
In-Reply-To: <CY5PR11MB6211F90C0EE12FFBEC92CFD79508A@CY5PR11MB6211.namprd11.prod.outlook.com>



On 8/3/2023 1:17 PM, Gupta, Anshuman wrote:
> 
> 
>> -----Original Message-----
>> From: Tauro, Riana <riana.tauro@intel.com>
>> Sent: Thursday, August 3, 2023 10:36 AM
>> To: igt-dev@lists.freedesktop.org
>> Cc: Tauro, Riana <riana.tauro@intel.com>; Gupta, Anshuman
>> <anshuman.gupta@intel.com>; Dixit, Ashutosh <ashutosh.dixit@intel.com>;
>> Belgaumkar, Vinay <vinay.belgaumkar@intel.com>; Nilawar, Badal
>> <badal.nilawar@intel.com>; Sundaresan, Sujaritha
>> <sujaritha.sundaresan@intel.com>
>> Subject: [PATCH i-g-t 4/4] tests/xe: Add a test that validates residency during
>> s2idle
>>
>> During s2idle, the device is powered up and GT C6 enabled so we expect the
>> residency to increase across suspend.
>> Add a test that validates the residency over a s2idle cycle is within the
>> threshold.
>>
>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>> ---
>>   tests/xe/xe_pm_residency.c | 54
>> ++++++++++++++++++++++++++++++++++----
>>   1 file changed, 49 insertions(+), 5 deletions(-)
>>
>> diff --git a/tests/xe/xe_pm_residency.c b/tests/xe/xe_pm_residency.c
>> index 4936de166..a2b56e78d 100644
>> --- a/tests/xe/xe_pm_residency.c
>> +++ b/tests/xe/xe_pm_residency.c
>> @@ -10,8 +10,10 @@
>>    * Functionality: GT C States
>>    * Test category: functionality test
>>    */
>> +#include <limits.h>
>>
>>   #include "igt.h"
>> +#include "igt_device.h"
>>   #include "igt_sysfs.h"
>>
>>   #include "xe/xe_query.h"
>> @@ -29,6 +31,11 @@ const double tolerance = 0.1;
>>   		     (tol) * 100.0, (tol) * 100.0, \
>>   		     (double)(ref))
>>
>> +enum test_type {
>> +	TEST_S2IDLE,
>> +	TEST_SLEEP,
>> +};
>> +
>>   /**
>>    * SUBTEST: gt-c6-on-idle
>>    * Description: Validate GT C6 state on idle @@ -38,9 +45,22 @@ const
>> double tolerance = 0.1;
>>    * Description: basic residency test to validate idle residency
>>    *		measured over a time interval is within the tolerance
>>    * Run type: FULL
>> + *
>> + * SUBTEST: gt-c6-freeze
>> + * Description: Validate idle residency measured over suspend(s2idle)
>> + *              is within the tolerance
>> + * Run type: FULL
>>    */
>>   IGT_TEST_DESCRIPTION("Tests for gtidle properties");
>>
>> +static unsigned long walltime_ms(void)
>> +{
>> +	struct timespec ts;
>> +
>> +	clock_gettime(CLOCK_REALTIME, &ts);
>> +	return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; }
>> +
>>   static unsigned int measured_usleep(unsigned int usec)  {
>>   	struct timespec ts = { };
>> @@ -69,15 +89,25 @@ static unsigned long read_idle_residency(int fd, int gt)
>>   	return residency;
>>   }
>>
>> -static void test_idle_residency(int fd, int gt)
>> +static void test_idle_residency(int fd, int gt, enum test_type flag)
>>   {
>>   	unsigned long elapsed_ms, residency_start, residency_end;
>>
>>   	igt_assert_f(igt_wait(xe_is_gt_in_c6(fd, gt), 1000, 1), "GT not in
>> C6\n");
>>
>> -	residency_start = read_idle_residency(fd, gt);
>> -	elapsed_ms = measured_usleep(SLEEP_DURATION * 1000) / 1000;
>> -	residency_end = read_idle_residency(fd, gt);
>> +	if (flag == TEST_S2IDLE) {
>> +		residency_start = read_idle_residency(fd, gt);
>> +		elapsed_ms -= walltime_ms();
>> +		igt_system_suspend_autoresume(SUSPEND_STATE_FREEZE,
>> SUSPEND_TEST_NONE);
>> +		elapsed_ms += walltime_ms();
>> +		residency_end = read_idle_residency(fd, gt);
>> +	}
>> +
>> +	if (flag == TEST_SLEEP) {
>> +		residency_start = read_idle_residency(fd, gt);
>> +		elapsed_ms = measured_usleep(SLEEP_DURATION * 1000) /
>> 1000;
>> +		residency_end = read_idle_residency(fd, gt);
>> +	}
>>
>>   	igt_info("Measured %lums of idle residency in %lums\n",
>>   		 residency_end - residency_start, elapsed_ms); @@ -88,6
>> +118,8 @@ static void test_idle_residency(int fd, int gt)  igt_main  {
>>   	int fd, gt;
>> +	char pci_slot_name[NAME_MAX];
>> +	uint32_t d3cold_allowed;
>>
>>   	igt_fixture {
>>   		fd = drm_open_driver(DRIVER_XE);
>> @@ -99,10 +131,22 @@ igt_main
>>   		xe_for_each_gt(fd, gt)
>>   			igt_assert_f(igt_wait(xe_is_gt_in_c6(fd, gt), 1000, 1),
>> "GT not in C6\n");
>>
>> +	igt_describe("Validate idle residency measured over suspend cycle is
>> within the tolerance");
>> +	igt_subtest("gt-c6-freeze") {
>> +		igt_device_get_pci_slot_name(fd, pci_slot_name);
>> +		igt_pm_get_d3cold_allowed(pci_slot_name,
>> &d3cold_allowed);
>> +		igt_pm_set_d3cold_allowed(pci_slot_name, 0);
> We need to disallow d3cold only for discrete cards, rc6 residency should not get reset on integrated gfx.
> This can save some execution time on CI.

Sure Will fix this.

Thanks
Riana
> Thanks,
> Anshuman.
>> +
>> +		xe_for_each_gt(fd, gt)
>> +			test_idle_residency(fd, gt, TEST_S2IDLE);
>> +
>> +		igt_pm_set_d3cold_allowed(pci_slot_name,
>> d3cold_allowed);
>> +	}
>> +
>>   	igt_describe("Validate idle residency measured over a time interval is
>> within the tolerance");
>>   	igt_subtest("idle-residency")
>>   		xe_for_each_gt(fd, gt)
>> -			test_idle_residency(fd, gt);
>> +			test_idle_residency(fd, gt, TEST_SLEEP);
>>
>>   	igt_fixture {
>>   		close(fd);
>> --
>> 2.40.0
> 

  reply	other threads:[~2023-08-03  8:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03  5:06 [igt-dev] [PATCH i-g-t 0/4] RFC Modify igt_pm functions and add GT C6 freeze test Riana Tauro
2023-08-03  5:06 ` [igt-dev] [PATCH i-g-t 1/4] lib/igt_device: Add a function to get the pci slot name Riana Tauro
2023-08-03  6:44   ` Gupta, Anshuman
2023-08-03  5:06 ` [igt-dev] [PATCH i-g-t 2/4] lib/igt_pm: change d3cold_allowed function parameters Riana Tauro
2023-08-03  7:07   ` Gupta, Anshuman
2023-08-03  8:46     ` Riana Tauro
2023-08-03  8:48       ` Gupta, Anshuman
2023-08-03  5:06 ` [igt-dev] [PATCH i-g-t 3/4] tests/xe: use igt_pm library functions Riana Tauro
2023-08-03  5:06 ` [igt-dev] [PATCH i-g-t 4/4] tests/xe: Add a test that validates residency during s2idle Riana Tauro
2023-08-03  7:47   ` Gupta, Anshuman
2023-08-03  8:48     ` Riana Tauro [this message]
2023-08-03  6:05 ` [igt-dev] ○ CI.xeBAT: info for RFC Modify igt_pm functions and add GT C6 freeze test Patchwork
2023-08-03  6:09 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-08-03  7:50 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=2f00dd9e-9a10-ebd6-88f8-5147a4346230@intel.com \
    --to=riana.tauro@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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