From: "Adrián Larumbe" <adrian.larumbe@collabora.com>
To: tvrtko.ursulin@intel.com, robdclark@chromium.org,
kamil.konieczny@linux.intel.com, igt-dev@lists.freedesktop.org
Cc: adrian.larumbe@collabora.com, kernel@collabora.com
Subject: [igt-dev] [PATCH 1/2] gputop: fix region array max iteration index loop bug
Date: Tue, 8 Aug 2023 22:03:30 +0100 [thread overview]
Message-ID: <20230808210437.977482-1-adrian.larumbe@collabora.com> (raw)
If c->regions->num_regions equals 1, then c->regions->max_region_id equals
0, so neither of the cumulative memory region size loops will be executed.
Fix it by adjusting loop termination condition.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
tools/gputop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/gputop.c b/tools/gputop.c
index ac106abea2ee..ea95e0333dd2 100644
--- a/tools/gputop.c
+++ b/tools/gputop.c
@@ -166,11 +166,11 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
len = printf("%*s ", c->clients->max_pid_len, c->pid_str);
if (c->regions->num_regions) {
- for (sz = 0, i = 0; i < c->regions->max_region_id; i++)
+ for (sz = 0, i = 0; i <= c->regions->max_region_id; i++)
sz += c->memory[i].total;
len += print_size(sz);
- for (sz = 0, i = 0; i < c->regions->max_region_id; i++)
+ for (sz = 0, i = 0; i <= c->regions->max_region_id; i++)
sz += c->memory[i].resident;
len += print_size(sz);
}
--
2.41.0
next reply other threads:[~2023-08-08 21:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 21:03 Adrián Larumbe [this message]
2023-08-08 21:03 ` [igt-dev] [PATCH 2/2] lib/igt_drm_fdinfo.c: refactor region array population code Adrián Larumbe
2023-08-09 11:31 ` Kamil Konieczny
2023-08-09 14:17 ` Sharma, Swati2
2023-08-08 22:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/2] gputop: fix region array max iteration index loop bug Patchwork
2023-08-09 1:56 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2023-08-09 11:08 ` [igt-dev] [PATCH 1/2] " Kamil Konieczny
2023-08-09 11:15 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [1/2] " Patchwork
2023-08-10 19:18 ` Kamil Konieczny
2023-08-11 9:23 ` Yedireswarapu, SaiX Nandan
2023-08-11 6:55 ` [igt-dev] ✓ Fi.CI.IGT: success " 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=20230808210437.977482-1-adrian.larumbe@collabora.com \
--to=adrian.larumbe@collabora.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=kernel@collabora.com \
--cc=robdclark@chromium.org \
--cc=tvrtko.ursulin@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