Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 1/5] lib/power: Allow use of rapl by specifying fd=-1
Date: Mon, 16 Sep 2024 23:18:37 +0300	[thread overview]
Message-ID: <20240916201841.29592-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240916201841.29592-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

igt_power_open() is currently defunct when you don't have
the GPU driver loaded, or when you explicitly want to measure
via rapl even when using a DGPU. Allow those use cases by
accepting fd<0 to indicate that we explicitly want to use rapl.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_power.c b/lib/igt_power.c
index 810859b134dc..f4d3efcf0cec 100644
--- a/lib/igt_power.c
+++ b/lib/igt_power.c
@@ -106,7 +106,7 @@ int igt_power_open(int fd, struct igt_power *p, const char *domain)
 	p->hwmon_fd = -1;
 	p->rapl.fd = -1;
 
-	is_dgfx = is_xe_device(fd) ? xe_has_vram(fd) : gem_has_lmem(fd);
+	is_dgfx = fd >= 0 && (is_xe_device(fd) ? xe_has_vram(fd) : gem_has_lmem(fd));
 	if (is_dgfx) {
 		if (strncmp(domain, "gpu", strlen("gpu")) == 0) {
 			p->hwmon_fd = igt_hwmon_open(fd);
-- 
2.44.2


  reply	other threads:[~2024-09-16 20:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16 20:18 [PATCH i-g-t 0/5] Power/energy and display memory bandwidth measurement tools Ville Syrjala
2024-09-16 20:18 ` Ville Syrjala [this message]
2024-10-11 17:17   ` [PATCH i-g-t 1/5] lib/power: Allow use of rapl by specifying fd=-1 Kamil Konieczny
2024-10-14 16:57     ` Ville Syrjälä
2024-09-16 20:18 ` [PATCH i-g-t 2/5] igt: Use is_intel_dgfx() Ville Syrjala
2024-10-11 17:20   ` Kamil Konieczny
2024-09-16 20:18 ` [PATCH i-g-t 3/5] lib/igt_power: Add power_supply/BAT based measurement Ville Syrjala
2024-10-11 17:30   ` Kamil Konieczny
2024-10-14 17:07     ` Ville Syrjälä
2024-09-16 20:18 ` [PATCH i-g-t 4/5] tools/power: Introduce a small power/energy measurement tool Ville Syrjala
2024-10-11 17:39   ` Kamil Konieczny
2024-09-16 20:18 ` [PATCH i-g-t 5/5] tools/intel_display_bandwidth: Tool for measuring display memory bandwidth utilization Ville Syrjala
2024-10-11 17:52   ` Kamil Konieczny
2024-10-14 16:34     ` Ville Syrjälä
2025-02-26 15:39       ` Govindapillai, Vinod
2025-02-26 15:51         ` Ville Syrjälä
2025-02-26 16:23           ` Govindapillai, Vinod
2024-09-16 21:24 ` ✓ CI.xeBAT: success for Power/energy and display memory bandwidth measurement tools Patchwork
2024-09-16 21:40 ` ✓ Fi.CI.BAT: " Patchwork
2024-09-17  0:20 ` ✗ CI.xeFULL: failure " Patchwork
2024-09-17 11:05 ` ✗ Fi.CI.IGT: " 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=20240916201841.29592-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@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