From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Kamil Konieczny" <kamil.konieczny@linux.intel.com>
Subject: [PATCH i-g-t 3/3] tests/xe_intel_bb: check multithreading rescans won't segfault
Date: Thu, 23 Jan 2025 10:22:10 +0100 [thread overview]
Message-ID: <20250123092210.48249-4-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20250123092210.48249-1-zbigniew.kempczynski@intel.com>
This test is likely only for checking purposes, it doesn't makes
sense to merge it after series review.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
tests/intel-ci/xe-fast-feedback.testlist | 1 +
tests/intel/xe_intel_bb.c | 47 ++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/tests/intel-ci/xe-fast-feedback.testlist b/tests/intel-ci/xe-fast-feedback.testlist
index 0234d3e72d..7adb9a3436 100644
--- a/tests/intel-ci/xe-fast-feedback.testlist
+++ b/tests/intel-ci/xe-fast-feedback.testlist
@@ -7,6 +7,7 @@ igt@fbdev@nullptr
igt@fbdev@read
igt@fbdev@write
+igt@xe_intel_bb@multithread-open
igt@kms_addfb_basic@addfb25-4-tiled
igt@kms_addfb_basic@addfb25-bad-modifier
igt@kms_addfb_basic@addfb25-modifier-no-flag
diff --git a/tests/intel/xe_intel_bb.c b/tests/intel/xe_intel_bb.c
index 845052bf26..5df009f9ed 100644
--- a/tests/intel/xe_intel_bb.c
+++ b/tests/intel/xe_intel_bb.c
@@ -18,6 +18,7 @@
#include "igt.h"
#include "igt_crc.h"
+#include "igt_device_scan.h"
#include "intel_blt.h"
#include "intel_bufops.h"
#include "intel_mocs.h"
@@ -950,6 +951,49 @@ static int render(struct buf_ops *bops, uint32_t tiling,
return fails;
}
+/**
+ * SUBTEST: multithread-open
+ * Description: check device scanning when multiple threads are involved
+ */
+static void *__single_open(void *data)
+{
+ struct igt_device_card card;
+ int fd;
+
+ igt_info("Thread: %d\n", (int)to_user_pointer(data));
+
+ for (int i = 0; i < 5; i++)
+ igt_devices_scan();
+
+ igt_assert_eq(igt_device_card_match("pci:vendor=intel", &card), true);
+ igt_info("Device detail: %s, %s, %s\n", card.subsystem, card.card, card.render);
+
+ fd = igt_open_card(&card);
+ igt_info("Fd: %d\n", fd);
+ igt_assert(fd >= 0);
+ close(fd);
+
+ return NULL;
+}
+
+#define NUM_THREADS 100
+static void multithread_open(void)
+{
+ pthread_t pth[NUM_THREADS];
+ int i, ret;
+
+ for (i = 0; i < NUM_THREADS; i++) {
+ ret = pthread_create(&pth[i], NULL, __single_open,
+ from_user_pointer(i));
+ igt_assert_eq(ret, 0);
+ }
+
+ for (i = 0; i < NUM_THREADS; i++) {
+ ret = pthread_join(pth[i], NULL);
+ igt_assert_eq(ret, 0);
+ }
+}
+
static int opt_handler(int opt, int opt_index, void *data)
{
switch (opt) {
@@ -1063,6 +1107,9 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL)
}
}
+ igt_subtest("multithread-open")
+ multithread_open();
+
igt_fixture {
buf_ops_destroy(bops);
drm_close_driver(xe);
--
2.34.1
next prev parent reply other threads:[~2025-01-23 9:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 9:22 [PATCH i-g-t 0/3] Drop device scan cache logic Zbigniew Kempczyński
2025-01-23 9:22 ` [PATCH i-g-t 1/3] lib/igt_device_scan: drop " Zbigniew Kempczyński
2025-01-23 9:22 ` [PATCH i-g-t 2/3] lib/igt_device_scan: change device list variable visibility Zbigniew Kempczyński
2025-01-23 17:37 ` Lucas De Marchi
2025-01-23 9:22 ` Zbigniew Kempczyński [this message]
2025-01-23 17:34 ` [PATCH i-g-t 3/3] tests/xe_intel_bb: check multithreading rescans won't segfault Lucas De Marchi
2025-01-23 17:37 ` Lucas De Marchi
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=20250123092210.48249-4-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=lucas.demarchi@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