From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: <igt-dev@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>, <badal.nilawar@intel.com>,
<riana.tauro@intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH i-g-t 4/5] tests/intel/xe_pm: Only check the rpm resume after the first mmap operation
Date: Wed, 15 May 2024 13:13:16 -0400 [thread overview]
Message-ID: <20240515171317.84811-4-rodrigo.vivi@intel.com> (raw)
In-Reply-To: <20240515171317.84811-1-rodrigo.vivi@intel.com>
The very first memory operation on a mmaped region after runtime suspend,
the device will be resumed if the memory used is vram.
However, after this first operation with page fault, the memory
will be migrated to the system memory if resuming from d3cold.
During this migration, Xe kernel will get a notification at
xe_bo_move_notify, and the bo will be removed from the
vram_userfault list. Then, on the next suspend, we won't mark
bo for page fault and resume won't happen and the active count
won't increase. This is okay, since the bo is now in the system
memory we don't need to wake up the device. But the current
test is wrong, because it assumes that the bo keeps forever
in vram, what is the issue here.
Only checking the resume after the first operation is the
enough. But also, ensure that both read and write operations
are actually validated, so we can use the same approach on
both d3hot and d3cold without differentiation.
v2: Improve commit message to ensure that it is clear that
this migration will only happen in d3cold, but that we are
checking both opperations so same flow can be used regardless
of the suspended D3 state.
Cc: Badal Nilawar <badal.nilawar@intel.com>
Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
tests/intel/xe_pm.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index a80964d1f..2770ce83d 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -38,6 +38,11 @@
#define PREFETCH (0x1 << 1)
#define UNBIND_ALL (0x1 << 2)
+enum mem_op {
+ READ,
+ WRITE,
+};
+
typedef struct {
int fd_xe;
struct pci_device *pci_xe;
@@ -522,7 +527,8 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
*
* Functionality: pm-d3
*/
-static void test_mmap(device_t device, uint32_t placement, uint32_t flags)
+static void test_mmap(device_t device, uint32_t placement, uint32_t flags,
+ enum mem_op first_op)
{
size_t bo_size = 8192;
uint32_t *map = NULL;
@@ -560,8 +566,12 @@ static void test_mmap(device_t device, uint32_t placement, uint32_t flags)
igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
active_time = igt_pm_get_runtime_active_time(device.pci_xe);
- for (i = 0; i < bo_size / sizeof(*map); i++)
- igt_assert(map[i] == MAGIC_1);
+ for (i = 0; i < bo_size / sizeof(*map); i++) {
+ if (first_op == READ)
+ igt_assert(map[i] == MAGIC_1);
+ else
+ map[i] = MAGIC_2;
+ }
/* dgfx page-fault on mmaping should wake the gpu */
if (xe_has_vram(device.fd_xe) && flags & DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM)
@@ -571,12 +581,12 @@ static void test_mmap(device_t device, uint32_t placement, uint32_t flags)
igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
active_time = igt_pm_get_runtime_active_time(device.pci_xe);
- for (i = 0; i < bo_size / sizeof(*map); i++)
- map[i] = MAGIC_2;
-
- if (xe_has_vram(device.fd_xe) && flags & DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM)
- igt_assert(igt_pm_get_runtime_active_time(device.pci_xe) >
- active_time);
+ for (i = 0; i < bo_size / sizeof(*map); i++) {
+ if (first_op == READ)
+ map[i] = MAGIC_2;
+ else
+ igt_assert(map[i] == MAGIC_2);
+ }
igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
@@ -792,7 +802,8 @@ igt_main
"when device along with parent bridge in d3");
igt_subtest("d3-mmap-system") {
dpms_on_off(device, DRM_MODE_DPMS_OFF);
- test_mmap(device, system_memory(device.fd_xe), 0);
+ test_mmap(device, system_memory(device.fd_xe), 0, READ);
+ test_mmap(device, system_memory(device.fd_xe), 0, WRITE);
dpms_on_off(device, DRM_MODE_DPMS_ON);
}
@@ -811,7 +822,10 @@ igt_main
/* Give some auto suspend delay to validate rpm active during page fault */
igt_pm_set_autosuspend_delay(device.pci_xe, 1000);
dpms_on_off(device, DRM_MODE_DPMS_OFF);
- test_mmap(device, vram_memory(device.fd_xe, 0), DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
+ test_mmap(device, vram_memory(device.fd_xe, 0),
+ DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM, READ);
+ test_mmap(device, vram_memory(device.fd_xe, 0),
+ DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM, WRITE);
dpms_on_off(device, DRM_MODE_DPMS_ON);
igt_pm_set_autosuspend_delay(device.pci_xe, delay_ms);
}
--
2.44.0
next prev parent reply other threads:[~2024-05-15 17:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 17:13 [PATCH i-g-t 1/5] tests/intel/xe_pm: Update runtime pm conditions Rodrigo Vivi
2024-05-15 17:13 ` [PATCH i-g-t 2/5] lib/igt_pm: Fix and standardize IGT PM library documentation Rodrigo Vivi
2024-05-15 17:13 ` [PATCH i-g-t 3/5] tests/intel/xe_pm: Also disable display for mmap_system test Rodrigo Vivi
2024-05-15 17:13 ` Rodrigo Vivi [this message]
2024-05-15 17:13 ` [PATCH i-g-t 5/5] tests/intel/xe_pm: Convert mmap tests to use existing d3 helpers Rodrigo Vivi
2024-05-15 18:58 ` ✓ CI.xeBAT: success for series starting with [i-g-t,1/5] tests/intel/xe_pm: Update runtime pm conditions Patchwork
2024-05-15 19:13 ` ✓ Fi.CI.BAT: " Patchwork
2024-05-15 21:08 ` ✓ CI.xeFULL: " Patchwork
2024-05-16 5:53 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-16 9:25 ` Kamil Konieczny
-- strict thread matches above, loose matches on Subject: below --
2024-05-20 18:35 [PATCH i-g-t 1/5] " Rodrigo Vivi
2024-05-20 18:35 ` [PATCH i-g-t 4/5] tests/intel/xe_pm: Only check the rpm resume after the first mmap operation Rodrigo Vivi
2024-05-16 18:10 [PATCH i-g-t 1/5] tests/intel/xe_pm: Update runtime pm conditions Rodrigo Vivi
2024-05-16 18:10 ` [PATCH i-g-t 4/5] tests/intel/xe_pm: Only check the rpm resume after the first mmap operation Rodrigo Vivi
2024-05-13 18:55 [PATCH i-g-t 1/5] tests/intel/xe_pm: Update runtime pm conditions Rodrigo Vivi
2024-05-13 18:55 ` [PATCH i-g-t 4/5] tests/intel/xe_pm: Only check the rpm resume after the first mmap operation Rodrigo Vivi
2024-05-14 15:19 ` Nilawar, Badal
2024-05-14 16:39 ` Nilawar, Badal
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=20240515171317.84811-4-rodrigo.vivi@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=igt-dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox