From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Harish Chegondi <harish.chegondi@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 2/3] tests/intel/xe_eu_stall: Do not check for presence of data on simulation
Date: Wed, 04 Jun 2025 17:10:37 -0700 [thread overview]
Message-ID: <8734cfujya.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <37ab7f14480edb308e152d1a9088394407b031e8.1748994982.git.harish.chegondi@intel.com>
On Tue, 03 Jun 2025 16:57:35 -0700, Harish Chegondi wrote:
>
> Some simulation models may not have full EU stall sampling support.
>
> v2: 1. Make EU stall fd global and close any open fd before open (Ashutosh)
This is probably patch 1/3, so no need to mention here I think.
> 2. Move disable IOCTL call to before the assert.
> 3. Allocate and free the user buffer in the main routine to prevent
> any memory leak due to an assert.
3 is probably not worth it since any allocated memory will be freed when
the process exits, so the memory "leak" is only for the duration the
process is running after the assert.
Generally multiple changes like these should be sent in separate patches to
make review easier, but in any case, here it is obvious what's happening so
this is:
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
> ---
> tests/intel/xe_eu_stall.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/tests/intel/xe_eu_stall.c b/tests/intel/xe_eu_stall.c
> index 1499ec4b4..b3a0ee742 100644
> --- a/tests/intel/xe_eu_stall.c
> +++ b/tests/intel/xe_eu_stall.c
> @@ -65,6 +65,7 @@
> static FILE *output;
> static char *p_args[8];
> static char *output_file;
> +static uint8_t *user_buf;
> static uint8_t p_gt_id;
> static uint32_t p_rate;
> static uint32_t p_user = DEFAULT_USER_BUF_SIZE;
> @@ -493,7 +494,6 @@ static void test_eustall(int drm_fd, uint32_t devid, bool blocking_read, int ite
> struct sigaction sa = { 0 };
> int ret, flags;
> uint64_t total_size;
> - uint8_t *buf;
>
> uint64_t properties[] = {
> DRM_XE_EU_STALL_PROP_GT_ID, p_gt_id,
> @@ -520,9 +520,6 @@ static void test_eustall(int drm_fd, uint32_t devid, bool blocking_read, int ite
> else
> igt_info("Workload: GPGPU fill\n");
>
> - buf = malloc(p_user);
> - igt_assert(buf);
> -
> igt_assert_eq(igt_ioctl(drm_fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
> igt_assert_neq(query.size, 0);
>
> @@ -579,11 +576,11 @@ enable:
> igt_assert_eq(ret, 1);
> igt_assert(pollfd.revents & POLLIN);
> }
> - ret = read(stream_fd, buf, p_user);
> + ret = read(stream_fd, user_buf, p_user);
> if (ret > 0) {
> total_size += ret;
> if (output)
> - print_eu_stall_data(devid, buf, ret);
> + print_eu_stall_data(devid, user_buf, ret);
> num_samples += ret / query_eu_stall_data->record_size;
> } else if ((ret < 0) && (errno != EAGAIN)) {
> if (errno == EINTR)
> @@ -598,20 +595,21 @@ enable:
> }
> } while (child_is_running);
>
> + do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_DISABLE, 0);
> +
> igt_info("Total size read: %lu\n", total_size);
> igt_info("Number of samples: %u\n", num_samples);
> igt_info("Number of drops reported: %u\n", num_drops);
>
> ret = wait_child(&work_load);
> igt_assert_f(ret == 0, "waitpid() - ret: %d, errno: %d\n", ret, errno);
> - igt_assert_f(num_samples, "No EU stalls detected during the workload\n");
> + if (!igt_run_in_simulation())
> + igt_assert_f(num_samples, "No EU stalls detected during the workload\n");
>
> - do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_DISABLE, 0);
> if (--iter)
> goto enable;
>
> eu_stall_close(stream_fd);
> - free(buf);
> }
>
> static int opt_handler(int opt, int opt_index, void *data)
> @@ -678,6 +676,8 @@ igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL)
> output = fopen(output_file, "w");
> igt_require(output);
> }
> + user_buf = malloc(p_user);
> + igt_assert(user_buf);
> }
>
> igt_describe("Verify non-blocking read of EU stall data during a workload run");
> @@ -717,6 +717,7 @@ igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL)
> test_invalid_event_report_count(drm_fd);
>
> igt_fixture {
> + free(user_buf);
> if (output)
> fclose(output);
> drm_close_driver(drm_fd);
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-06-05 0:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 23:57 [PATCH i-g-t 1/3] tests/intel/xe_eu_stall: Close any open EU stall fd before opening a new one Harish Chegondi
2025-06-03 23:57 ` [PATCH i-g-t 2/3] tests/intel/xe_eu_stall: Do not check for presence of data on simulation Harish Chegondi
2025-06-05 0:10 ` Dixit, Ashutosh [this message]
2025-06-03 23:57 ` [PATCH i-g-t 3/3] tests/intel/xe_eu_stall: Use query IOCTL to check for EU stall support Harish Chegondi
2025-06-04 13:35 ` Kolakowski, Jakub1
2025-06-04 22:21 ` Dixit, Ashutosh
2025-06-04 22:34 ` Dixit, Ashutosh
2025-06-05 2:29 ` Dixit, Ashutosh
2025-06-11 16:37 ` Harish Chegondi
2025-06-04 0:22 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,1/3] tests/intel/xe_eu_stall: Close any open EU stall fd before opening a new one Patchwork
2025-06-04 0:42 ` ✓ i915.CI.BAT: " Patchwork
2025-06-04 2:36 ` ✗ i915.CI.Full: failure " Patchwork
2025-06-04 23:53 ` [PATCH i-g-t 1/3] " Dixit, Ashutosh
2025-06-11 16:38 ` Harish Chegondi
2025-06-05 0:22 ` ✗ Xe.CI.Full: failure for series starting with [i-g-t,1/3] " 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=8734cfujya.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=harish.chegondi@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