Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 12/13] tests/intel/xe_oa: Drop "xe-ref-count" subtest
Date: Sun, 30 Jun 2024 15:56:33 -0700	[thread overview]
Message-ID: <20240630225634.2404840-13-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20240630225634.2404840-1-ashutosh.dixit@intel.com>

Sometime other modules (such as those for child devices) take or drop
references on the xe module. This results in "xe-ref-count" subtest unable
to accurately predict what the module refcount should be, resulting in
frequent false positives in the test.

Drop the test till we are able to devise a robust method to predict xe
module refcount.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 tests/intel/xe_oa.c | 107 --------------------------------------------
 1 file changed, 107 deletions(-)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 965ea05d9a..9d4402d9bf 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -3371,36 +3371,6 @@ test_single_ctx_render_target_writes_a_counter(struct drm_xe_engine_class_instan
 	} while (WEXITSTATUS(child_ret) == EAGAIN);
 }
 
-static unsigned read_xe_module_ref(void)
-{
-	FILE *fp = fopen("/proc/modules", "r");
-	char *line = NULL;
-	size_t line_buf_size = 0;
-	int len = 0;
-	unsigned ref_count;
-	char mod[8];
-	int modn = 3;
-
-	igt_assert(fp);
-
-	strcpy(mod, "xe ");
-	while ((len = getline(&line, &line_buf_size, fp)) > 0) {
-		if (strncmp(line, mod, modn) == 0) {
-			unsigned long mem;
-			int ret = sscanf(line + 5, "%lu %u", &mem, &ref_count);
-			igt_assert(ret == 2);
-			goto done;
-		}
-	}
-
-	igt_assert(!"reached");
-
-done:
-	free(line);
-	fclose(fp);
-	return ref_count;
-}
-
 /**
  * SUBTEST: rc6-disable
  * Description: Check that opening an OA stream disables RC6
@@ -4116,80 +4086,6 @@ test_mmio_triggered_reports(struct drm_xe_engine_class_instance *hwe)
 		   WEXITSTATUS(ret) == 0);
 }
 
-/**
- * SUBTEST: xe-ref-count
- * Description: Check that an open oa stream holds a reference on the xe module
- */
-static void
-test_xe_ref_count(void)
-{
-	uint64_t properties[] = {
-		DRM_XE_OA_PROPERTY_OA_UNIT_ID, 0,
-
-		/* Include OA reports in samples */
-		DRM_XE_OA_PROPERTY_SAMPLE_OA, true,
-
-		/* OA unit configuration */
-		DRM_XE_OA_PROPERTY_OA_METRIC_SET, 0 /* updated below */,
-		DRM_XE_OA_PROPERTY_OA_FORMAT, __ff(0), /* update below */
-		DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT, 0, /* update below */
-	};
-	struct intel_xe_oa_open_prop param = {
-		.num_properties = ARRAY_SIZE(properties) / 2,
-		.properties_ptr = to_user_pointer(properties),
-	};
-	unsigned baseline, ref_count0, ref_count1;
-	uint32_t oa_report0[64];
-	uint32_t oa_report1[64];
-
-	/* This should be the first test before the first fixture so no drm_fd
-	 * should have been opened so far...
-	 */
-	igt_assert_eq(drm_fd, -1);
-
-	baseline = read_xe_module_ref();
-	igt_debug("baseline ref count (drm fd closed) = %u\n", baseline);
-
-	drm_fd = __drm_open_driver(DRIVER_XE);
-	if (is_xe_device(drm_fd))
-		xe_device_get(drm_fd);
-	devid = intel_get_drm_devid(drm_fd);
-	sysfs = igt_sysfs_open(drm_fd);
-
-	/* Note: these global variables are only initialized after calling
-	 * init_sys_info()...
-	 */
-	igt_require(init_sys_info());
-	properties[5] = default_test_set->perf_oa_metrics_set;
-	properties[7] = __ff(default_test_set->perf_oa_format);
-	properties[9] = oa_exp_1_millisec;
-
-	ref_count0 = read_xe_module_ref();
-	igt_debug("initial ref count with drm_fd open = %u\n", ref_count0);
-
-	stream_fd = __perf_open(drm_fd, &param, false);
-        set_fd_flags(stream_fd, O_CLOEXEC);
-	ref_count1 = read_xe_module_ref();
-	igt_debug("ref count after opening oa stream = %u\n", ref_count1);
-
-	drm_close_driver(drm_fd);
-	close(sysfs);
-	drm_fd = -1;
-	sysfs = -1;
-	ref_count0 = read_xe_module_ref();
-	igt_debug("ref count after closing drm fd = %u\n", ref_count0);
-
-	read_2_oa_reports(default_test_set->perf_oa_format,
-			  oa_exp_1_millisec,
-			  oa_report0,
-			  oa_report1,
-			  false); /* not just timer reports */
-
-	__perf_close(stream_fd);
-	ref_count0 = read_xe_module_ref();
-	igt_debug("ref count after closing oa stream fd = %u\n", ref_count0);
-}
-
 /**
  * SUBTEST: sysctl-defaults
  * Description: Test that perf_stream_paranoid sysctl exists
@@ -4621,9 +4517,6 @@ igt_main
 		igt_require(!stat("/proc/sys/dev/xe/perf_stream_paranoid", &sb));
 	}
 
-	igt_subtest("xe-ref-count")
-		test_xe_ref_count();
-
 	igt_subtest("sysctl-defaults")
 		test_sysctl_defaults();
 
-- 
2.41.0


  parent reply	other threads:[~2024-06-30 22:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-30 22:56 [PATCH i-g-t v5 00/13] Intel Xe OA IGT's Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 01/13] tests/intel/xe_oa: Add first tests Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 02/13] tests/intel/xe_oa: Add some negative tests Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 03/13] tests/intel/xe_oa: Add "oa-formats" subtest Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 04/13] tests/intel/xe_oa: Add oa exponent tests Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 05/13] tests/intel/xe_oa: buffer-fill, non-zero-reason, enable-disable Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 06/13] tests/intel/xe_oa: blocking and polling tests Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 07/13] tests/intel/xe_oa: OAR/OAC tests Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 08/13] tests/intel/xe_oa: Exclusive/concurrent access, rc6 and stress open close Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 09/13] tests/intel/xe_oa: add remove OA config tests Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 10/13] tests/intel/xe_oa: OA buffer mmap tests Ashutosh Dixit
2024-06-30 22:56 ` [PATCH i-g-t 11/13] tests/intel/xe_oa: Register whitelisting and MMIO trigger tests Ashutosh Dixit
2024-06-30 22:56 ` Ashutosh Dixit [this message]
2024-06-30 22:56 ` [PATCH i-g-t 13/13] HAX: Add Xe OA tests to xe-fast-feedback.testlist Ashutosh Dixit
2024-06-30 23:26 ` ✓ CI.xeBAT: success for Intel Xe OA IGT's (rev5) Patchwork
2024-06-30 23:38 ` ✓ Fi.CI.BAT: " Patchwork
2024-07-01  0:25 ` ✓ CI.xeFULL: " Patchwork
2024-07-01  5:06 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-07-01  1:41 [PATCH i-g-t v6 00/13] Intel Xe OA IGT's Ashutosh Dixit
2024-07-01  1:41 ` [PATCH i-g-t 12/13] tests/intel/xe_oa: Drop "xe-ref-count" subtest Ashutosh Dixit

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=20240630225634.2404840-13-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@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