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 1/3] tests/intel/xe_eu_stall: Close any open EU stall fd before opening a new one
Date: Wed, 04 Jun 2025 16:53:14 -0700 [thread overview]
Message-ID: <874iwvukr9.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <b5b8323fe6840bff949b8607480d57104b908a1f.1748994982.git.harish.chegondi@intel.com>
On Tue, 03 Jun 2025 16:57:34 -0700, Harish Chegondi wrote:
>
> asserts in a sub-test can prevent closing an EU stall fd and the next
> subtest may fail with EBUSY if it tries to open another EU stall fd
> as there can only be one EU stall stream open at a time. Any open fds
> are automatically closed at the end of a test (last sub-test).
>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
So -EBUSY errors are gone with this patch, correct? So this is:
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
> tests/intel/xe_eu_stall.c | 34 ++++++++++++++++++++++++++--------
> 1 file changed, 26 insertions(+), 8 deletions(-)
>
> diff --git a/tests/intel/xe_eu_stall.c b/tests/intel/xe_eu_stall.c
> index 411c30871..1499ec4b4 100644
> --- a/tests/intel/xe_eu_stall.c
> +++ b/tests/intel/xe_eu_stall.c
> @@ -69,6 +69,7 @@ static uint8_t p_gt_id;
> static uint32_t p_rate;
> static uint32_t p_user = DEFAULT_USER_BUF_SIZE;
> static uint32_t p_num_reports = DEFAULT_NUM_REPORTS;
> +static int stream_fd = -1;
>
> static volatile bool child_is_running = true;
>
> @@ -302,6 +303,25 @@ static void set_fd_flags(int fd, int flags)
> igt_assert_eq(0, fcntl(fd, F_SETFL, old | flags));
> }
>
> +static void eu_stall_close(int fd)
> +{
> + close(fd);
> + stream_fd = -1;
> +}
> +
> +static int eu_stall_open(int drm_fd, struct xe_eu_stall_open_prop *props)
> +{
> + int ret;
> +
> + if (stream_fd >= 0)
> + eu_stall_close(stream_fd);
> +
> + ret = xe_eu_stall_ioctl(drm_fd, DRM_XE_OBSERVATION_OP_STREAM_OPEN, props);
> + igt_require_fd(ret);
> +
> + return ret;
> +}
> +
> /*
> * Verify that tests with invalid arguments fail.
> */
> @@ -353,7 +373,7 @@ static inline void disable_paranoid(void)
> */
> static void test_non_privileged_access(int drm_fd)
> {
> - int paranoid, stream_fd;
> + int paranoid;
>
> paranoid = read_u64_file(OBSERVATION_PARANOID);
>
> @@ -395,9 +415,8 @@ static void test_non_privileged_access(int drm_fd)
>
> igt_drop_root();
>
> - stream_fd = xe_eu_stall_ioctl(drm_fd, DRM_XE_OBSERVATION_OP_STREAM_OPEN, &props);
> - igt_require_fd(stream_fd);
> - close(stream_fd);
> + stream_fd = eu_stall_open(drm_fd, &props);
> + eu_stall_close(stream_fd);
> }
>
> igt_waitchildren();
> @@ -472,7 +491,7 @@ static void test_eustall(int drm_fd, uint32_t devid, bool blocking_read, int ite
> uint32_t num_samples, num_drops;
> struct igt_helper_process work_load = {};
> struct sigaction sa = { 0 };
> - int ret, flags, stream_fd;
> + int ret, flags;
> uint64_t total_size;
> uint8_t *buf;
>
> @@ -518,8 +537,7 @@ static void test_eustall(int drm_fd, uint32_t devid, bool blocking_read, int ite
> properties[3] = query_eu_stall_data->sampling_rates[0];
> igt_info("Sampling Rate: %lu\n", properties[3]);
>
> - stream_fd = xe_eu_stall_ioctl(drm_fd, DRM_XE_OBSERVATION_OP_STREAM_OPEN, &props);
> - igt_require_fd(stream_fd);
> + stream_fd = eu_stall_open(drm_fd, &props);
>
> if (!blocking_read)
> flags = O_CLOEXEC | O_NONBLOCK;
> @@ -592,7 +610,7 @@ enable:
> if (--iter)
> goto enable;
>
> - close(stream_fd);
> + eu_stall_close(stream_fd);
> free(buf);
> }
>
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-06-04 23:53 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
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 ` Dixit, Ashutosh [this message]
2025-06-11 16:38 ` [PATCH i-g-t 1/3] " 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=874iwvukr9.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