All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sobin Thomas <sobin.thomas@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@intel.com, zbigniew.kempczynski@intel.com,
	Sobin Thomas <sobin.thomas@intel.com>
Subject: [PATCH i-g-t] tests/intel/xe_evict_ccs: This patch adjust object size as per VRAM
Date: Fri, 29 Aug 2025 03:56:09 +0000	[thread overview]
Message-ID: <20250829035609.858784-2-sobin.thomas@intel.com> (raw)
In-Reply-To: <20250829035609.858784-1-sobin.thomas@intel.com>

Some BIOS configurations do not support or enable resizable BAR,
resulting in a maximum BAR size of 256MB. This patch adjusts the
maximum object size used in test conditions based on the available
VRAM.

v2: Adjusted the subject name

v3: Inco-operated review comments [kamil]

v4: Fixed typo.

v5: Fixed review comment for igt warnings and commit subject. [kamil]
    Fixed the condition for user provided max size value. [kamil]

Signed-off-by: Sobin Thomas <sobin.thomas@intel.com>
---
 tests/intel/xe_evict_ccs.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/intel/xe_evict_ccs.c b/tests/intel/xe_evict_ccs.c
index 281d27015..16abba4ec 100644
--- a/tests/intel/xe_evict_ccs.c
+++ b/tests/intel/xe_evict_ccs.c
@@ -39,12 +39,14 @@ static struct param {
 	int vram_percent;
 	int min_size_kb;
 	int max_size_kb;
+	bool user_set_max_size;
 	bool verify;
 } params = {
 	.num_objs = 0,
 	.vram_percent = OVERCOMMIT_VRAM_PERCENT,
 	.min_size_kb = MIN_OBJ_KB,
 	.max_size_kb = MAX_OBJ_KB,
+	.user_set_max_size = false,
 };
 
 struct object {
@@ -343,6 +345,34 @@ static void set_config(int fd, uint32_t flags, const struct param *param,
 	igt_debug("nproc: %d, mem per proc: %dMB\n", nproc, config->mb_per_proc);
 }
 
+static void adjust_params_for_vram_size(uint64_t vram_size)
+{
+	uint64_t vram_mb = vram_size / (1024 * 1024);
+	int recommended_max_size_kb = 0;
+	int max_object_mb = vram_mb / MIN_OBJ_KB;
+
+	/* max_object_mb clamped between 2MB and 256MB */
+	max_object_mb = max_t(int, 2, min_t(int, max_object_mb, 256));
+	recommended_max_size_kb = max_object_mb * 1024;
+
+	igt_info("VRAM (%"PRIu64"MB): Calculated %d%% usage, %dMB max objects\n",
+		 vram_mb, params.vram_percent, max_object_mb);
+
+	if (params.user_set_max_size &&
+		params.max_size_kb > recommended_max_size_kb) {
+		igt_warn("User specified size (%dMB) may not be optimal for %"PRIu64"MB VRAM\n"
+				"(recommended size: %dMB)\n",
+				params.max_size_kb / 1024, vram_mb,
+				recommended_max_size_kb / 1024);
+
+	} else {
+		params.max_size_kb = recommended_max_size_kb;
+	}
+
+	igt_info("Final settings: %d%% VRAM, %dMB max object\n",
+		 params.vram_percent, params.max_size_kb / 1024);
+}
+
 static void evict_ccs(int fd, uint32_t flags, const struct param *param)
 {
 	struct config config;
@@ -440,6 +470,7 @@ static int opt_handler(int opt, int opt_index, void *data)
 		break;
 	case 'S':
 		params.max_size_kb = atoi(optarg);
+		params.user_set_max_size = true;
 		igt_debug("Max size kb: %d\n", params.max_size_kb);
 		break;
 	case 'V':
@@ -500,6 +531,7 @@ igt_main_args("bdDn:p:s:S:V", NULL, help_str, opt_handler, NULL)
 		igt_require(xe_has_vram(fd));
 		vram_size = xe_visible_vram_size(fd, 0);
 		igt_assert(vram_size);
+		adjust_params_for_vram_size(vram_size);
 		has_flatccs = HAS_FLATCCS(intel_get_drm_devid(fd));
 	}
 
-- 
2.34.1


  reply	other threads:[~2025-08-29  3:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  3:56 [PATCH i-g-t v5 0/1] tests/intel/xe_evict_ccs: This patch adjust object size as per VRAM Sobin Thomas
2025-08-29  3:56 ` Sobin Thomas [this message]
2025-08-29 10:13   ` [PATCH i-g-t] " Kamil Konieczny
2025-08-29  5:15 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-08-29  5:16 ` ✓ i915.CI.BAT: " Patchwork
2025-08-29 15:17 ` ✗ i915.CI.Full: failure " Patchwork
2025-08-29 15:43 ` ✗ 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=20250829035609.858784-2-sobin.thomas@intel.com \
    --to=sobin.thomas@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@intel.com \
    --cc=zbigniew.kempczynski@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.