From: "Grzegorzek, Dominik" <dominik.grzegorzek@intel.com>
To: "Piatkowski, Dominik Karol" <dominik.karol.piatkowski@intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Kempczynski, Zbigniew" <zbigniew.kempczynski@intel.com>,
"Sikora, Pawel" <pawel.sikora@intel.com>,
"Manszewski, Christoph" <christoph.manszewski@intel.com>,
"Cavitt, Jonathan" <jonathan.cavitt@intel.com>
Subject: Re: [PATCH v2 i-g-t 2/2] tests/xe_eudebug_online: Adjust interrupt-other test
Date: Thu, 3 Oct 2024 13:49:27 +0000 [thread overview]
Message-ID: <cc11d8b61760737467dc16e79de686616cf85ff5.camel@intel.com> (raw)
In-Reply-To: <20241002112914.5556-3-dominik.karol.piatkowski@intel.com>
Hi Dominik!
On Wed, 2024-10-02 at 13:29 +0200, Dominik Karol Piątkowski wrote:
> This test fails due to preemption interfering with it.
>
> In order to fix it, set the preempt_timeout_us for engine_class used in
> this test to maximum for the duration of the test.
>
> It is set to maximum inside test_gt_render_or_compute. If set before,
> we would lack engine_class info. If set inside the test function, we
> would need to pass original preempt_timeout_us value from there,
> unnecessarily complicating the declaration of test function.
>
> It is restored in subsequent igt_fixture. This way, a proper cleanup
> can be assured. If restored inside the test function or even
> test_gt_render_or_compute section, any failed assert preceding cleanup
> inside test function would prevent cleanup from happening. We cannot
> allow that.
>
> In order to underline that the subsequent igt_fixture is related to
> this test, both test_gt_render_or_compute and igt_fixture sections
> were put inside igt_subtest_group, hopefully increasing readability.
>
> Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
> ---
> tests/intel/xe_eudebug_online.c | 45 +++++++++++++++++++++++++++++++--
> 1 file changed, 43 insertions(+), 2 deletions(-)
>
> diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
> index 68d1b786f..84736192f 100644
> --- a/tests/intel/xe_eudebug_online.c
> +++ b/tests/intel/xe_eudebug_online.c
> @@ -16,6 +16,7 @@
> #include "xe/xe_ioctl.h"
> #include "xe/xe_query.h"
> #include "igt.h"
> +#include "igt_sysfs.h"
> #include "intel_pat.h"
> #include "intel_mocs.h"
> #include "gpgpu_shader.h"
> @@ -2201,6 +2202,30 @@ static struct drm_xe_engine_class_instance *pick_compute(int fd, int gt)
> return NULL;
> }
>
> +static bool set_preempt_timeout_to_max(int fd, uint16_t engine_class, uint32_t *preempt_timeout)
> +{
> + uint32_t preempt_timeout_max;
> +
> + if (!xe_sysfs_engine_class_get_property(fd, 0, engine_class, "preempt_timeout_max",
> + &preempt_timeout_max))
> + return false;
> +
> + if (!xe_sysfs_engine_class_set_property(fd, 0, engine_class, "preempt_timeout_us",
> + preempt_timeout_max, preempt_timeout))
> + return false;
> +
> + return true;
Minor nit, you could ommit second if:
return xe_sysfs_engine_class_set_property(fd, 0, engine_class, "preempt_timeout_us",
+ preempt_timeout_max, preempt_timeout))
> +}
> +
> +static bool restore_preempt_timeout(int fd, uint16_t engine_class, uint32_t preempt_timeout)
> +{
> + if (!xe_sysfs_engine_class_set_property(fd, 0, engine_class, "preempt_timeout_us",
> + preempt_timeout, NULL))
> + return false;
> +
> + return true;
same as above.
> +}
> +
> #define test_gt_render_or_compute(t, fd, __hwe) \
> igt_subtest_with_dynamic(t) \
> for (int gt = 0; (__hwe = pick_compute(fd, gt)); gt++) \
> @@ -2212,6 +2237,8 @@ igt_main
> struct drm_xe_engine_class_instance *hwe;
> bool was_enabled;
> int fd;
> + uint16_t engine_class = 0xFFFF;
> + uint32_t preempt_timeout = 0xFFFFFFFF;
>
> igt_fixture {
> fd = drm_open_driver(DRIVER_XE);
> @@ -2247,8 +2274,22 @@ igt_main
> test_gt_render_or_compute("interrupt-other-debuggable", fd, hwe)
> test_interrupt_other(fd, hwe, SHADER_LOOP);
>
> - test_gt_render_or_compute("interrupt-other", fd, hwe)
> - test_interrupt_other(fd, hwe, SHADER_LOOP | DISABLE_DEBUG_MODE);
> + igt_subtest_group {
> + test_gt_render_or_compute("interrupt-other", fd, hwe) {
> + engine_class = hwe->engine_class;
> +
> + igt_skip_on(!set_preempt_timeout_to_max(fd, engine_class,
> + &preempt_timeout));
> +
> + test_interrupt_other(fd, hwe, SHADER_LOOP | DISABLE_DEBUG_MODE);
> + }
> +
> + igt_fixture {
> + if ((uint16_t)~engine_class && ~preempt_timeout)
Maybe I'm not seeing sth but why do we need to cast it to uint16, isn't it already that type?
Other than that it is:
Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
> + if (!restore_preempt_timeout(fd, engine_class, preempt_timeout))
> + igt_warn("Cleanup of preempt_timeout failed!\n");
> + }
> + }
>
> test_gt_render_or_compute("interrupt-all-set-breakpoint", fd, hwe)
> test_interrupt_all(fd, hwe, SHADER_LOOP | TRIGGER_RESUME_SET_BP);
next prev parent reply other threads:[~2024-10-03 13:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 11:29 [PATCH v2 i-g-t 0/2] Fix xe_eudebug_online@interrupt-other test Dominik Karol Piątkowski
2024-10-02 11:29 ` [PATCH v2 i-g-t 1/2] lib/igt_sysfs: Introduce engine_class property helpers Dominik Karol Piątkowski
2024-10-03 13:58 ` Grzegorzek, Dominik
2024-10-07 4:03 ` Zbigniew Kempczyński
2024-10-07 8:15 ` Zbigniew Kempczyński
2024-10-07 11:45 ` Grzegorzek, Dominik
2024-10-02 11:29 ` [PATCH v2 i-g-t 2/2] tests/xe_eudebug_online: Adjust interrupt-other test Dominik Karol Piątkowski
2024-10-03 13:49 ` Grzegorzek, Dominik [this message]
2024-10-04 6:01 ` Piatkowski, Dominik Karol
2024-10-02 13:05 ` ✓ CI.xeBAT: success for Fix xe_eudebug_online@interrupt-other test (rev2) Patchwork
2024-10-02 13:13 ` ✓ Fi.CI.BAT: " Patchwork
2024-10-02 14:49 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-03 12:06 ` ✗ 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=cc11d8b61760737467dc16e79de686616cf85ff5.camel@intel.com \
--to=dominik.grzegorzek@intel.com \
--cc=christoph.manszewski@intel.com \
--cc=dominik.karol.piatkowski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=pawel.sikora@intel.com \
--cc=zbigniew.kempczynski@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