Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Hogander, Jouni" <jouni.hogander@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Brost, Matthew" <matthew.brost@intel.com>,
	"Naladala, Ramanaidu" <ramanaidu.naladala@intel.com>,
	"Nerlige Ramappa, Umesh" <umesh.nerlige.ramappa@intel.com>,
	"De Marchi, Lucas" <lucas.demarchi@intel.com>
Subject: Re: [PATCH i-g-t v2 1/4] tests/intel/xe_drm_fdinfo: Implement virtual/parallel exec queues
Date: Tue, 10 Sep 2024 13:18:09 +0000	[thread overview]
Message-ID: <adf16abfaaad7d2c2b53e240c2c7e77d7bf1733d.camel@intel.com> (raw)
In-Reply-To: <20240910131248.334521-2-jouni.hogander@intel.com>

Hello,

I made mistake in sending patches. Please ignore this and
"lib/intel_batchbuffer: Introduce
intel_bb_create_with_context_in_region" sent by me.

Sorry for inconvenience,

Jouni Högander

On Tue, 2024-09-10 at 16:12 +0300, Jouni Högander wrote:
> From: Lucas De Marchi <lucas.demarchi@intel.com>
> 
> Implement a similar function to utilization_single(), but also taking
> virtual/parallel into account. I chose some different variable names
> to make it more obvious what exactly it is testing and integrated
> with the xe_gt_fill_engines_by_class() function recently added.
> A possible refactor in the future is to make the other tests use
> this function and remove utilization_single().
> 
> Based on previous patch by Umesh.
> 
> Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Link:
> https://lore.kernel.org/r/20240904225746.2857448-3-lucas.demarchi@intel.com
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  tests/intel/xe_drm_fdinfo.c | 124
> +++++++++++++++++++++++++++++++++++-
>  1 file changed, 123 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/intel/xe_drm_fdinfo.c
> b/tests/intel/xe_drm_fdinfo.c
> index 8acb95040..747b6155c 100644
> --- a/tests/intel/xe_drm_fdinfo.c
> +++ b/tests/intel/xe_drm_fdinfo.c
> @@ -12,6 +12,8 @@
>  #include "xe/xe_ioctl.h"
>  #include "xe/xe_query.h"
>  #include "xe/xe_spin.h"
> +#include "xe/xe_util.h"
> +
>  /**
>   * TEST: xe drm fdinfo
>   * Description: Read and verify drm client memory consumption and
> engine utilization using fdinfo
> @@ -67,6 +69,8 @@ IGT_TEST_DESCRIPTION("Read and verify drm client
> memory consumption and engine u
>  #define TEST_BUSY              (1 << 0)
>  #define TEST_TRAILING_IDLE     (1 << 1)
>  #define TEST_ISOLATION         (1 << 2)
> +#define TEST_VIRTUAL           (1 << 3)
> +#define TEST_PARALLEL          (1 << 4)
>  
>  enum expected_load {
>         EXPECTED_LOAD_IDLE,
> @@ -715,10 +719,102 @@ utilization_all_full_load(int fd)
>  
>         xe_vm_destroy(fd, vm);
>  }
> +
> +/**
> + * SUBTEST: %s-utilization-single-idle
> + * Description: Check that each engine shows no load
> + *
> + * SUBTEST: %s-utilization-single-full-load
> + * Description: Check that each engine shows full load
> + *
> + * SUBTEST: %s-utilization-single-full-load-isolation
> + * Description: Check that each engine load does not spill over to
> other drm clients
> + *
> + * arg[1]:
> + *
> + * @virtual:                   virtual
> + * @parallel:                  parallel
> + */
> +static void
> +utilization_multi(int fd, int gt, int class, unsigned int flags)
> +{
> +       struct pceu_cycles pceu[2][DRM_XE_ENGINE_CLASS_COMPUTE + 1];
> +       struct pceu_cycles pceu_spill[2][DRM_XE_ENGINE_CLASS_COMPUTE
> + 1];
> +       struct drm_xe_engine_class_instance
> eci[XE_MAX_ENGINE_INSTANCE];
> +       struct spin_ctx *ctx = NULL;
> +       enum expected_load expected_load;
> +       int fd_spill, num_placements;
> +       uint32_t vm;
> +       bool virtual = flags & TEST_VIRTUAL;
> +       bool parallel = flags & TEST_PARALLEL;
> +       uint16_t width;
> +
> +       igt_assert(virtual ^ parallel);
> +
> +       num_placements = xe_gt_fill_engines_by_class(fd, gt, class,
> eci);
> +       if (num_placements < 2)
> +               return;
> +
> +       if (parallel) {
> +               width = num_placements;
> +               num_placements = 1;
> +       } else {
> +               width = 1;
> +       }
> +
> +       if (flags & TEST_ISOLATION)
> +               fd_spill = drm_reopen_driver(fd);
> +
> +       vm = xe_vm_create(fd, 0, 0);
> +       if (flags & TEST_BUSY) {
> +               ctx = spin_ctx_init(fd, eci, vm, width,
> num_placements);
> +               spin_sync_start(fd, ctx);
> +       }
> +
> +       read_engine_cycles(fd, pceu[0]);
> +       if (flags & TEST_ISOLATION)
> +               read_engine_cycles(fd_spill, pceu_spill[0]);
> +
> +       usleep(batch_duration_usec);
> +       if (flags & TEST_TRAILING_IDLE)
> +               spin_sync_end(fd, ctx);
> +
> +       read_engine_cycles(fd, pceu[1]);
> +       if (flags & TEST_ISOLATION)
> +               read_engine_cycles(fd_spill, pceu_spill[1]);
> +
> +       expected_load = flags & TEST_BUSY ?
> +              EXPECTED_LOAD_FULL : EXPECTED_LOAD_IDLE;
> +       check_results(pceu[0], pceu[1], class, width, expected_load);
> +
> +       if (flags & TEST_ISOLATION) {
> +               /*
> +                * Load from one client shouldn't spill on another,
> +                * so check for idle
> +                */
> +               check_results(pceu_spill[0], pceu_spill[1], class,
> width,
> +                             EXPECTED_LOAD_IDLE);
> +               close(fd_spill);
> +       }
> +
> +       spin_sync_end(fd, ctx);
> +       spin_ctx_destroy(fd, ctx);
> +
> +       xe_vm_destroy(fd, vm);
> +}
> +
>  igt_main
>  {
> +       const struct section {
> +               const char *name;
> +               unsigned int flags;
> +       } sections[] = {
> +               { .name = "virtual", .flags = TEST_VIRTUAL },
> +               { .name = "parallel", .flags = TEST_PARALLEL },
> +               { }
> +       };
>         struct drm_xe_engine_class_instance *hwe;
> -       int xe;
> +       int xe, gt, class;
>  
>         igt_fixture {
>                 struct drm_client_fdinfo info = { };
> @@ -775,6 +871,32 @@ igt_main
>         igt_subtest("utilization-all-full-load")
>                 utilization_all_full_load(xe);
>  
> +
> +       for (const struct section *s = sections; s->name; s++) {
> +               igt_subtest_f("%s-utilization-single-idle", s->name)
> +                       xe_for_each_gt(xe, gt)
> +                               xe_for_each_engine_class(class)
> +                                       utilization_multi(xe, gt,
> class, s->flags);
> +
> +               igt_subtest_f("%s-utilization-single-full-load", s-
> >name)
> +                       xe_for_each_gt(xe, gt)
> +                               xe_for_each_engine_class(class)
> +                                       utilization_multi(xe, gt,
> class,
> +                                                         s->flags |
> +                                                         TEST_BUSY |
> +                                                        
> TEST_TRAILING_IDLE);
> +
> +               igt_subtest_f("%s-utilization-single-full-load-
> isolation",
> +                             s->name)
> +                       xe_for_each_gt(xe, gt)
> +                               xe_for_each_engine_class(class)
> +                                       utilization_multi(xe, gt,
> class,
> +                                                         s->flags |
> +                                                         TEST_BUSY |
> +                                                        
> TEST_TRAILING_IDLE |
> +                                                        
> TEST_ISOLATION);
> +       }
> +
>         igt_fixture {
>                 drm_close_driver(xe);
>         }


  reply	other threads:[~2024-09-10 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 13:12 [PATCH i-g-t v2 0/4] PSR testing improvement by checking sink status Jouni Högander
2024-09-10 13:12 ` [PATCH i-g-t v2 1/4] tests/intel/xe_drm_fdinfo: Implement virtual/parallel exec queues Jouni Högander
2024-09-10 13:18   ` Hogander, Jouni [this message]
2024-09-10 13:12 ` [PATCH i-g-t v2 2/4] lib/intel_batchbuffer: Introduce intel_bb_create_with_context_in_region Jouni Högander
2024-09-10 13:12 ` [PATCH i-g-t v2 3/4] lib/igt_psr: Add mechanism to check sink status as well Jouni Högander

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=adf16abfaaad7d2c2b53e240c2c7e77d7bf1733d.camel@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=ramanaidu.naladala@intel.com \
    --cc=umesh.nerlige.ramappa@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