From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v1 3/4] lib/drmtest: create helper for dropping logged opened paths
Date: Thu, 2 Nov 2023 13:10:38 +0100 [thread overview]
Message-ID: <20231102121044.58786-4-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20231102121044.58786-1-kamil.konieczny@linux.intel.com>
Create helper for cleaning all cached opened paths for drivers.
This may be used when we want to test multi-GPU scenarios and in
them inform user about each opened GPU card including first one.
Currently almost all tests open first card at start for
performing checks for it but that cause a lost possibilty to
inform user later about opening this first card.
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
lib/drmtest.c | 24 +++++++++++++++++++++---
lib/drmtest.h | 2 ++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 4425d4ca9..d114e8ecf 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -221,16 +221,17 @@ struct _opened_device_path {
struct igt_list_head link;
};
+static IGT_LIST_HEAD(_opened_paths);
+
/*
* Logs path of opened device. Device path opened for the first time is logged at info level,
* subsequent opens (if any) are logged at debug level.
*/
static void log_opened_device_path(const char *device_path)
{
- static IGT_LIST_HEAD(opened_paths);
struct _opened_device_path *item;
- igt_list_for_each_entry(item, &opened_paths, link) {
+ igt_list_for_each_entry(item, &_opened_paths, link) {
if (!strcmp(item->path, device_path)) {
igt_debug("Opened previously opened device: %s\n", device_path);
return;
@@ -241,10 +242,27 @@ static void log_opened_device_path(const char *device_path)
igt_assert(item);
item->path = strdup(device_path);
igt_assert(item->path);
- igt_list_add(&item->link, &opened_paths);
+ igt_list_add(&item->link, &_opened_paths);
igt_info("Opened device: %s\n", item->path);
}
+/**
+ * __drm_invalidate_opened:
+ *
+ * Invalidate cached opened paths.
+ */
+void __drm_invalidate_opened_log(void)
+{
+ struct _opened_device_path *item, *tmp;
+
+ if (!igt_list_empty(&_opened_paths))
+ igt_list_for_each_entry_safe(item, tmp, &_opened_paths, link) {
+ free(item->path);
+ igt_list_del(&item->link);
+ free(item);
+ }
+}
+
static int open_device(const char *name, unsigned int chipset)
{
const char *forced;
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 992ada194..635a1b47c 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -98,6 +98,8 @@ void __set_forced_driver(const char *name);
*/
#define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
+void __drm_invalidate_opened_log(void);
+
void drm_load_module(unsigned int chipset);
int drm_open_driver(int chipset);
int drm_open_driver_master(int chipset);
--
2.42.0
next prev parent reply other threads:[~2023-11-02 12:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 12:10 [igt-dev] [PATCH i-g-t v1 0/4] drmtest changes for filtering GPUs on multi-gpu Kamil Konieczny
2023-11-02 12:10 ` [igt-dev] [PATCH i-g-t v1 1/4] lib/drmtest: add multi-GPU helpers for filtered devices Kamil Konieczny
2023-11-02 19:52 ` Zbigniew Kempczyński
2023-11-03 9:58 ` Kamil Konieczny
2023-11-02 12:10 ` [igt-dev] [PATCH i-g-t v1 2/4] tests/intel/xe_create: add multi-GPU basic test Kamil Konieczny
2023-11-02 12:10 ` Kamil Konieczny [this message]
2023-11-02 19:55 ` [igt-dev] [PATCH i-g-t v1 3/4] lib/drmtest: create helper for dropping logged opened paths Zbigniew Kempczyński
2023-11-02 12:10 ` [igt-dev] [PATCH i-g-t v1 4/4] tests/intel/xe_create: print first opened card Kamil Konieczny
2023-11-02 19:57 ` Zbigniew Kempczyński
2023-11-02 15:14 ` [igt-dev] ✓ Fi.CI.BAT: success for drmtest changes for filtering GPUs on multi-gpu Patchwork
2023-11-02 16:06 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-11-03 10:14 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20231102121044.58786-4-kamil.konieczny@linux.intel.com \
--to=kamil.konieczny@linux.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