From: Soham Purkait <soham.purkait@intel.com>
To: igt-dev@lists.freedesktop.org, riana.tauro@intel.com,
badal.nilawar@intel.com, kamil.konieczny@intel.com
Cc: anshuman.gupta@intel.com, soham.purkait@intel.com,
umesh.nerlige.ramappa@intel.com
Subject: [PATCH i-g-t v2 1/2] tools/gputop/xe_gputop: Close card_fd after engine population in xe_populate_engines()
Date: Wed, 17 Dec 2025 15:01:08 +0530 [thread overview]
Message-ID: <20251217093109.4096902-2-soham.purkait@intel.com> (raw)
In-Reply-To: <20251217093109.4096902-1-soham.purkait@intel.com>
During the engine initialization for a specific device in GPUTOP,
IGT helper functions need card_fd to access each engine and
respective configs. These are required in obtaining the busyness
of the respective engines through PMU in GPUTOP. But for KMS tests
no other DRM client should run while it is running. So once the
required configs and engines are obtained, the card_fd is closed
as opened card_fd in xe_populate_engines() makes appear itself as
DRM client.
v1:
- Initialize pmu_device_obj to null.
Fixes: c8106465683f ("tools/gputop/xe_gputop: Add gputop support for xe specific devices")
Signed-off-by: Soham Purkait <soham.purkait@intel.com>
---
tools/gputop/xe_gputop.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/gputop/xe_gputop.c b/tools/gputop/xe_gputop.c
index bb2caa6ea..45cb5bf93 100644
--- a/tools/gputop/xe_gputop.c
+++ b/tools/gputop/xe_gputop.c
@@ -92,6 +92,7 @@ void xe_gputop_init(void *ptr, int index,
obj = ((struct xe_gputop *)ptr) + index;
obj->card = card;
+ obj->pmu_device_obj = NULL;
}
static int pmu_format_shift(int xe, const char *name)
@@ -197,6 +198,8 @@ void *xe_populate_engines(const void *obj, int index)
engines->num_engines++;
}
+ close(card_fd);
+
if (!ret) {
errno = ret;
return NULL;
@@ -263,11 +266,11 @@ int xe_pmu_init(const void *obj, int index)
fd = _open_pmu(type, &engines->num_counters, &engine->engine_active_ticks,
&engines->fd);
if (fd < 0)
- return -1;
+ return fd;
fd = _open_pmu(type, &engines->num_counters, &engine->engine_total_ticks,
&engines->fd);
if (fd < 0)
- return -1;
+ return fd;
}
return 0;
}
--
2.34.1
next prev parent reply other threads:[~2025-12-17 9:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 9:31 [PATCH i-g-t v2 0/2] Close any open drm device after engine initialization in GPUTOP Soham Purkait
2025-12-17 9:31 ` Soham Purkait [this message]
2025-12-17 9:31 ` [PATCH i-g-t v2 2/2] tools/gputop/gputop: Enable support for multiple GPUs and instances Soham Purkait
2025-12-22 19:02 ` Kamil Konieczny
2025-12-24 6:34 ` Purkait, Soham
2025-12-17 12:41 ` ✓ Xe.CI.BAT: success for Close any open drm device after engine initialization in GPUTOP (rev3) Patchwork
2025-12-17 12:55 ` ✓ i915.CI.BAT: " Patchwork
2025-12-17 15:55 ` ✗ i915.CI.Full: failure " Patchwork
2025-12-18 9:35 ` ✗ 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=20251217093109.4096902-2-soham.purkait@intel.com \
--to=soham.purkait@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@intel.com \
--cc=riana.tauro@intel.com \
--cc=umesh.nerlige.ramappa@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