Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Marcin Bernatowicz" <marcin.bernatowicz@linux.intel.com>,
	"Adam Miszczak" <adam.miszczak@linux.intel.com>,
	"Jakub Kolakowski" <jakub1.kolakowski@intel.com>,
	"Lukasz Laguna" <lukasz.laguna@intel.com>,
	"Michał Wajdeczko" <michal.wajdeczko@intel.com>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"Narasimha C V" <narasimha.c.v@intel.com>,
	"Piotr Piórkowski" <piotr.piorkowski@intel.com>,
	"Satyanarayana K V P" <satyanarayana.k.v.p@intel.com>,
	"Tomasz Lis" <tomasz.lis@intel.com>
Subject: [PATCH v2 i-g-t 5/5] tests/xe_sriov_scheduling: Get job timeout from sysfs
Date: Wed, 12 Feb 2025 19:47:57 +0100	[thread overview]
Message-ID: <20250212184757.586071-6-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20250212184757.586071-1-marcin.bernatowicz@linux.intel.com>

Replace hardcoded JOB_TIMEOUT_MS with sysfs_get_job_timeout_ms() to
dynamically retrieve the value.

Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Narasimha C V <narasimha.c.v@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Tomasz Lis <tomasz.lis@intel.com>
---
 tests/intel/xe_sriov_scheduling.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/tests/intel/xe_sriov_scheduling.c b/tests/intel/xe_sriov_scheduling.c
index fe037c1dc..82c525fe3 100644
--- a/tests/intel/xe_sriov_scheduling.c
+++ b/tests/intel/xe_sriov_scheduling.c
@@ -5,6 +5,7 @@
 #include "igt.h"
 #include "igt_sriov_device.h"
 #include "igt_syncobj.h"
+#include "igt_sysfs.h"
 #include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_spin.h"
@@ -423,7 +424,6 @@ static void log_sample_values(char *id, struct subm_stats *stats,
 #define MIN_EXEC_QUANTUM_MS 8
 #define MAX_EXEC_QUANTUM_MS 32
 #define MIN_JOB_DURATION_MS 16
-#define JOB_TIMEOUT_MS 5000
 #define MAX_TOTAL_DURATION_MS 15000
 #define PREFERRED_TOTAL_DURATION_MS 10000
 #define MAX_PREFERRED_REPEATS 100
@@ -434,6 +434,18 @@ struct job_sched_params {
 	struct vf_sched_params sched_params;
 };
 
+static uint32_t sysfs_get_job_timeout_ms(int fd, struct drm_xe_engine_class_instance *eci)
+{
+	int engine_dir;
+	uint32_t ret;
+
+	engine_dir = xe_sysfs_engine_open(fd, eci->gt_id, eci->engine_class);
+	ret = igt_sysfs_get_u32(engine_dir, "job_timeout_ms");
+	close(engine_dir);
+
+	return ret;
+}
+
 static uint32_t derive_preempt_timeout_us(const uint32_t exec_quantum_ms)
 {
 	return exec_quantum_ms * 2 * USEC_PER_MSEC;
@@ -539,15 +551,16 @@ static void throughput_ratio(int pf_fd, int num_vfs, const struct subm_opts *opt
 {
 	struct subm_set set_ = {}, *set = &set_;
 	uint8_t vf_ids[num_vfs + 1 /*PF*/];
+	uint32_t job_timeout_ms = sysfs_get_job_timeout_ms(pf_fd, &xe_engine(pf_fd, 0)->instance);
 	struct job_sched_params job_sched_params = prepare_job_sched_params(num_vfs + 1,
-									    JOB_TIMEOUT_MS,
+									    job_timeout_ms,
 									    opts);
 
-	igt_info("eq=%ums pt=%uus duration=%ums repeats=%d num_vfs=%d\n",
+	igt_info("eq=%ums pt=%uus duration=%ums repeats=%d num_vfs=%d job_timeout=%ums\n",
 		 job_sched_params.sched_params.exec_quantum_ms,
 		 job_sched_params.sched_params.preempt_timeout_us,
 		 job_sched_params.duration_ms, job_sched_params.num_repeats,
-		 num_vfs + 1);
+		 num_vfs + 1, job_timeout_ms);
 
 	init_vf_ids(vf_ids, ARRAY_SIZE(vf_ids),
 		    &(struct init_vf_ids_opts){ .shuffle = true,
@@ -631,16 +644,17 @@ static void nonpreempt_engine_resets(int pf_fd, int num_vfs,
 				     const struct subm_opts *opts)
 {
 	struct subm_set set_ = {}, *set = &set_;
+	uint32_t job_timeout_ms = sysfs_get_job_timeout_ms(pf_fd, &xe_engine(pf_fd, 0)->instance);
 	struct vf_sched_params vf_sched_params = prepare_vf_sched_params(num_vfs, 1,
-									 JOB_TIMEOUT_MS, opts);
+									 job_timeout_ms, opts);
 	uint64_t duration_ms = 2 * vf_sched_params.exec_quantum_ms +
 			       vf_sched_params.preempt_timeout_us / USEC_PER_MSEC;
 	int preemptible_end = 1;
 	uint8_t vf_ids[num_vfs + 1 /*PF*/];
 
-	igt_info("eq=%ums pt=%uus duration=%lums num_vfs=%d\n",
-		 vf_sched_params.exec_quantum_ms,
-		 vf_sched_params.preempt_timeout_us, duration_ms, num_vfs);
+	igt_info("eq=%ums pt=%uus duration=%lums num_vfs=%d job_timeout=%ums\n",
+		 vf_sched_params.exec_quantum_ms, vf_sched_params.preempt_timeout_us,
+		 duration_ms, num_vfs, job_timeout_ms);
 
 	init_vf_ids(vf_ids, ARRAY_SIZE(vf_ids),
 		    &(struct init_vf_ids_opts){ .shuffle = true,
-- 
2.31.1


  parent reply	other threads:[~2025-02-12 18:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 18:47 [PATCH v2 i-g-t 0/5] Add SR-IOV provisioning scheduling attributes and tests Marcin Bernatowicz
2025-02-12 18:47 ` [PATCH v2 i-g-t 1/5] lib/xe/xe_sriov_provisioning: Add scheduling attributes accessors Marcin Bernatowicz
2025-02-12 18:47 ` [PATCH v2 i-g-t 2/5] lib/xe/xe_sriov_provisioning: Add helper to check default scheduling attributes Marcin Bernatowicz
2025-02-12 18:47 ` [PATCH v2 i-g-t 3/5] tests/xe_sriov_scheduling: VF equal-throughput validation Marcin Bernatowicz
2025-02-14 14:32   ` Laguna, Lukasz
2025-02-12 18:47 ` [PATCH v2 i-g-t 4/5] tests/xe_sriov_scheduling: nonpreempt-engine-resets subtest Marcin Bernatowicz
2025-02-14 14:32   ` Laguna, Lukasz
2025-02-12 18:47 ` Marcin Bernatowicz [this message]
2025-02-14 10:21   ` [PATCH v2 i-g-t 5/5] tests/xe_sriov_scheduling: Get job timeout from sysfs K V P, Satyanarayana
2025-02-14 14:33   ` Laguna, Lukasz
2025-02-13  3:01 ` ✓ i915.CI.BAT: success for Add SR-IOV provisioning scheduling attributes and tests (rev2) Patchwork
2025-02-13  3:38 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-13 12:46 ` ✗ i915.CI.Full: failure " Patchwork
2025-02-13 15:02   ` Bernatowicz, Marcin
2025-02-13 16:51 ` ✗ Xe.CI.Full: " 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=20250212184757.586071-6-marcin.bernatowicz@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=michal.winiarski@intel.com \
    --cc=narasimha.c.v@intel.com \
    --cc=piotr.piorkowski@intel.com \
    --cc=satyanarayana.k.v.p@intel.com \
    --cc=tomasz.lis@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