vram d3cold threshold test
cover vram d3cold threshold test
Adding vram_d3cold_threshold subtest
Anshuman Gupta (2):
tests/xe_pm : Add support to disable all crtc
test/xe_pm: Add vram_d3cold_threshold subtest
tests/xe/xe_pm.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)
Signature · 1 line
2.25.1
PATCH 1/2 tests/xe_pm : Add support to disable all crtc
xe_pm d3 test requires to disable all crtc in order to enter to d3 state therefore, adding the support to disable all crtc.
--- tests/xe/xe_pm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
tests/xe/xe_pm.c +20 -0
@@ -34,6 +34,7 @@ typedef struct {int fd_xe;struct pci_device *pci_xe;struct pci_device *pci_root; +igt_display_t display; } device_t;/* runtime_usage is only available if kernel build CONFIG_PM_ADVANCED_DEBUG */
@@ -150,6 +151,23 @@ static bool out_of_d3(device_t device, enum igt_acpi_d_state state)return true; } +static void disable_all_crtc (device_t *device) +{ +if (!drmModeGetResources (device->fd_xe)) +return ; + +igt_display_require (&device->display, device->fd_xe); +igt_modeset_disable_all_outputs (&device->display); +} + +static void display_fini (device_t *device) +{ +if (!drmModeGetResources (device->fd_xe)) +return ; + +igt_display_fini (&device->display); +} +/** * SUBTEST: %s-basic * Description: set GPU state to %arg[1] and test suspend/autoresume
@@ -378,6 +396,7 @@ igt_mainget_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_assert (igt_setup_runtime_pm (device.fd_xe)); +disable_all_crtc (&device); }for (const struct s_state *s = s_states; s->name; s++) {
@@ -438,6 +457,7 @@ igt_main } igt_fixture { +display_fini (&device);set_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_restore_runtime_pm ();xe_device_put (device.fd_xe);
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 1/2] tests/xe_pm : Add support to disable all crtc
Hi Anshuman
Quoted 45 lines · Anshuman Gupta
xe_pmd3 test requires to disable all crtc in order to enter to d3 state therefore, adding the support to disable all crtc.Signed-off-by Anshuman Gupta <[email protected]>--- tests/xe/xe_pm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)tests/xe/xe_pm.c +18
-0@@ -34,6 +34,7 @@ typedef struct {int fd_xe;struct pci_device *pci_xe;struct pci_device *pci_root; +igt_display_t display; } device_t;/* runtime_usage is only available if kernel build CONFIG_PM_ADVANCED_DEBUG */ @@ -150,6 +151,23 @@ static bool out_of_d3(device_t device, enum igt_acpi_d_state state)return true; } +static void disable_all_crtc (device_t *device) +{ +if (!drmModeGetResources (device->fd_xe)) +return ; + +igt_display_require (&device->display, device->fd_xe); +igt_modeset_disable_all_outputs (&device->display); +} + +static void display_fini (device_t *device) +{ +if (!drmModeGetResources (device->fd_xe)) +return ; + +igt_display_fini (&device->display); +} +/** * SUBTEST: %s-basic * Description: set GPU state to %arg[1] and test suspend/autoresume
tests/xe/xe_pm.c igt_main · line 399
Quoted 4 lines
tests/xe/xe_pm.c +1
-0@@ -378,6 +396,7 @@ igt_mainget_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_assert (igt_setup_runtime_pm (device.fd_xe)); +disable_all_crtc (&device);
Should this be added in setup_d3 instead of fixture? The suspend tests will also be executed with crtc disabled otherwise
Thanks
Riana
Quoted 11 lines
tests/xe/xe_pm.c +1
-0}for (const struct s_state *s = s_states; s->name; s++) {@@ -438,6 +457,7 @@ igt_main } igt_fixture { +display_fini (&device);set_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_restore_runtime_pm ();xe_device_put (device.fd_xe);
Re: [igt-dev] [PATCH i-g-t 1/2] tests/xe_pm : Add support to disable all crtc
Quoted 60 lines
-----Original Message-----
From: Tauro, Riana <[email protected]>
Sent: Wednesday, June 28, 2023 4:48 PM
To: Gupta, Anshuman <[email protected]>; igt- [email protected]
Cc: Dixit, Ashutosh <[email protected]>; [email protected]; Nilawar, Badal <[email protected]>
Subject: Re: [PATCH i-g-t 1/2] tests/xe_pm : Add support to disable all crtcHi Anshuman
Quoted 20 lines · Anshuman Gupta
xe_pmd3 test requires to disable all crtc in order to enter to d3 state therefore, adding the support to disable all crtc.Signed-off-by Anshuman Gupta <[email protected]>--- tests/xe/xe_pm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)tests/xe/xe_pm.c index renamed from tests/xe/xe_pm.c +0
-0
23b8246ed..c71fce892100644tests/xe/xe_pm.c +1
-0@@ -34,6 +34,7 @@ typedef struct {int fd_xe;struct pci_device *pci_xe;struct pci_device *pci_root; +igt_display_t display; } device_t;/* runtime_usage is only available if kernel build Quoted 1 line
CONFIG_PM_ADVANCED_DEBUG*/ @@ -150,6 +151,23 @@ static bool
out_of_d3(device_t device, enum igt_acpi_d_state state)Quoted 23 lines
return true; }tests/xe/xe_pm.c +15
-0+static void disable_all_crtc (device_t *device) { +if (!drmModeGetResources (device->fd_xe)) +return ; + +igt_display_require (&device->display, device->fd_xe); +igt_modeset_disable_all_outputs (&device->display); +} + +static void display_fini (device_t *device) { +if (!drmModeGetResources (device->fd_xe)) +return ; + +igt_display_fini (&device->display); +} +/** * SUBTEST: %s-basic * Description: set GPU state to %arg[1] and test suspend/autoresume @@ -378,6 +396,7 @@ igt_main
Quoted 5 lines
tests/xe/xe_pm.c igt_main · line 399
Quoted 3 lines
tests/xe/xe_pm.c +1
-0get_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_assert (igt_setup_runtime_pm (device.fd_xe)); +disable_all_crtc (&device);Should this be added in
setup_d3instead of fixture? The suspend tests will also be executed with crtc disabled otherwise
Yes that is intentional to keep as separate patch to pass other test as well.
Quoted 16 lines
Thanks
RianaQuoted 11 lines
tests/xe/xe_pm.c +2
-0} for (const struct s_state *s = s_states; s->name; s++) { @@ -438,6 +457,7 @@ igt_main } igt_fixture { +display_fini (&device);set_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_restore_runtime_pm ();xe_device_put (device.fd_xe);
PATCH 2/2 test/xe_pm: Add vram_d3cold_threshold subtest
In reply to Anshuman GuptaAdding a vram_d3cold_threshold subtest, which creates a Xe bo and set the vram_d3cold_threshold according to vram used and bo size. Test setups the d3cold and expect card to be limited to d3hot.
--- tests/xe/xe_pm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
tests/xe/xe_pm.c +73 -0
@@ -19,6 +19,7 @@#include "igt.h" #include "lib/igt_device.h" #include "lib/igt_pm.h" +#include "lib/igt_sysfs.h" #include "lib/igt_syncobj.h" #include "lib/intel_reg.h"
@@ -30,6 +31,8 @@#define NO_SUSPEND -1#define NO_RPM -1 +#define SIZE (4096 * 1024) + typedef struct { int fd_xe; struct pci_device *pci_xe;
@@ -77,6 +80,22 @@ static void set_d3cold_allowed(struct pci_device *pci,close (fd); } +static void set_vram_d3cold_threshold (int sysfs,uint64_t threshold) +{ +char path[64 ]; +int ret; + +sprintf (path,"device/vram_d3cold_threshold" ); + +if (!faccessat (sysfs, path,R_OK |W_OK ,0 )) + ret =igt_sysfs_printf (sysfs, path,"%lu" , threshold); +else +igt_warn ("vram_d3cold_threshold is not present\n" ); + +igt_info ("ret value %d" , ret); +igt_assert (ret >0 ); +} +static bool setup_d3 (device_t device,enum igt_acpi_d_state state) {switch (state) {
@@ -359,6 +378,55 @@ NULL));igt_assert (in_d3 (device, d_state)); } +static void test_vram_d3cold_threshold (device_t device) +{ +struct drm_xe_query_mem_usage *mem_usage; +struct drm_xe_device_query query = { + .extensions =0 , + .query =DRM_XE_DEVICE_QUERY_MEM_USAGE , + .size =0 , + .data =0 , + }; +uint64_t vram_used_mb =0 , vram_total_mb =0 , threshold, mmo; +uint32_t bo; +void *map; +int i, sysfs_fd; + +igt_assert_eq (igt_ioctl (device.fd_xe,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); +igt_assert_neq (query.size,0 ); + + mem_usage =malloc (query.size); +igt_assert (mem_usage); + + query.data =to_user_pointer (mem_usage); +igt_assert_eq (igt_ioctl (device.fd_xe,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); + +for (i =0 ; i < mem_usage->num_regions; i++) { +if (mem_usage->regions[i].mem_class ==XE_MEM_REGION_CLASS_VRAM ) { + vram_used_mb += (mem_usage->regions[i].used / (1024 *1024 )); + vram_total_mb += (mem_usage->regions[i].total_size / (1024 *1024 )); + } + } + + bo =xe_bo_create_flags (device.fd_xe,0 ,SIZE ,vram_memory (device.fd_xe,0 )); + mmo =xe_bo_mmap_offset (device.fd_xe, bo); + map =mmap (NULL ,SIZE ,PROT_WRITE ,MAP_SHARED , device.fd_xe, mmo); +igt_assert (map !=MAP_FAILED ); + +memset (map,0 ,SIZE ); +munmap (map,SIZE ); + threshold = vram_used_mb + (SIZE / (1024 *1024 )); +igt_require (threshold < vram_total_mb); + sysfs_fd =igt_sysfs_open (device.fd_xe); +set_vram_d3cold_threshold (sysfs_fd, threshold); +close (sysfs_fd); + +/* Setup D3Cold but card should be in D0 */ +igt_assert (setup_d3 (device, IGT_ACPI_D3Cold)); +igt_assert (in_d3 (device, IGT_ACPI_D3Hot)); +igt_assert (out_of_d3 (device, IGT_ACPI_D3Cold)); +} + igt_main {struct drm_xe_engine_class_instance *hwe;
@@ -456,6 +524,11 @@ igt_main } } +igt_describe ("Validate whether card is limited to d3hot, if vram used > vram threshold" ); + igt_subtest("vram-d3cold-threshold") { +test_vram_d3cold_threshold (device); + } + igt_fixture {display_fini (&device);set_d3cold_allowed (device.pci_xe, d3cold_allowed);
Signature · 1 line
2.25.1
Patchwork
CI[igt-dev] ✗ Fi.CI.BUILD: failure for vram d3cold threshold test
In reply to Anshuman Gupta== Series Details ==
== Series Details ==
Series: vram d3cold threshold test
URL : https://patchwork.freedesktop.org/series/119914/
State : failure
== Summary ==
IGT patchset build failed on latest successful build d8dc96b95c60e4737fdfa1664ce9b1dcebfdef60 tests/i915_pm_freq_api: Add a suspend subtest
ninja: Entering directory `/opt/igt/build'
[1/443] Generating version.h with a custom command.
[2/5] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst/usr/src/igt-gpu-tools/scripts/igt_doc.py --config /usr/src/igt-gpu-tools/tests/xe/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --igt-build-path /opt/igt/build
Warning: Missing documentation for igt@xe_pm@vram-d3cold-threshold
ninja: build stopped: subcommand failed.