Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Upadhyay <tejas.upadhyay@intel.com>,
	igt-dev@lists.freedesktop.org,
	Badal Nilawar <badal.nilawar@intel.com>
Subject: Re: [igt-dev] [PATCH v4 3/4] tests/xe/xe_guc_pc: Change the sysfs paths
Date: Sat, 01 Jul 2023 10:58:23 -0700	[thread overview]
Message-ID: <87jzvj8qf4.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20230627180805.4189160-4-himal.prasad.ghimiray@intel.com>

On Tue, 27 Jun 2023 11:08:04 -0700, Himal Prasad Ghimiray wrote:
>

Hi Himal,

> diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c
> index 89d5ae9e..2900ff09 100644
> --- a/tests/xe/xe_guc_pc.c
> +++ b/tests/xe/xe_guc_pc.c
> @@ -133,23 +133,25 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
>	xe_vm_destroy(fd, vm);
>  }
>
> -static int set_freq(int sysfs, int gt_id, const char *freq_name, uint32_t freq)
> +static int set_freq(int sysfs, int tile_id, int gt_id, const char *freq_name, uint32_t freq)
>  {
>	int ret = -EAGAIN;
>	char path[32];
>
> -	sprintf(path, "device/gt%d/freq_%s", gt_id, freq_name);
> +	igt_assert(snprintf(path, sizeof(path), "device/tile%d/gt%d/freq_%s",
> +			    tile_id, gt_id, freq_name) < sizeof(path));
>	while (ret == -EAGAIN)
>		ret = igt_sysfs_printf(sysfs, path, "%u", freq);
>	return ret;
>  }

/snip/

> @@ -162,37 +164,37 @@ static uint32_t get_freq(int sysfs, int gt_id, const char *freq_name)
>   * Run type: BAT
>   */
>
> -static void test_freq_basic_api(int sysfs, int gt_id)
> +static void test_freq_basic_api(int sysfs, int tile_id, int gt_id)
>  {
> -	uint32_t rpn = get_freq(sysfs, gt_id, "rpn");
> -	uint32_t rpe = get_freq(sysfs, gt_id, "rpe");
> -	uint32_t rp0 = get_freq(sysfs, gt_id, "rp0");
> +	uint32_t rpn = get_freq(sysfs, tile_id, gt_id, "rpn");
> +	uint32_t rpe = get_freq(sysfs, tile_id, gt_id, "rpe");
> +	uint32_t rp0 = get_freq(sysfs, tile_id, gt_id, "rp0");

/snip/

> @@ -373,7 +375,7 @@ igt_main
>  {
>	struct drm_xe_engine_class_instance *hwe;
>	int fd;
> -	int gt;
> +	int gt, tile;
>	static int sysfs = -1;
>	int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
>	uint32_t stash_min;
> @@ -386,24 +388,24 @@ igt_main
>		sysfs = igt_sysfs_open(fd);
>		igt_assert(sysfs != -1);
>
> -		/* The defaults are the same. Stashing the gt0 is enough */
> -		stash_min = get_freq(sysfs, 0, "min");
> -		stash_max = get_freq(sysfs, 0, "max");
> +		/* The defaults are the same. Stashing the gt0 in tile0 is enough */
> +		stash_min = get_freq(sysfs, 0, 0, "min");
> +		stash_max = get_freq(sysfs, 0, 0, "max");
>	}
>
>	igt_subtest("freq_basic_api") {
> -		xe_for_each_gt(fd, gt)
> -			test_freq_basic_api(sysfs, gt);
> +		xe_for_each_gt_under_each_tile(fd, tile, gt)
> +			test_freq_basic_api(sysfs, tile, gt);

Basically I have decided I disagree with the entire approach here, so I
disagree with Patches 2 and 3 in this series. Patch 2 is especially hacky
but I think it's not needed. Let's do this differently. My points:

* gt id's are unique (so e.g. on MTL we have tile0/gt0 and tile0/gt1, on
  PVC we have tile0/gt0 and tile1/gt1).

* The code in xe_guc_pc.c touches quantities (freq's etc.) which are
  associated with gt's. It doesn't care about tiles and which gt is present
  on which tile etc. It just cares about gt's. So it wrong to change the
  whole code to start worrying about tiles now as this patch is doing (via
  xe_for_each_gt_under_each_tile()).

* So instead what we need to do is very simple. Let's write a function
  which will return the sysfs path for a gt (this function will need to be
  tile aware so it will return things like "device/tile0/gt0",
  "device/tile0/gt1", "device/tile1/gt1" etc.). The function prototype is
  something like:

  char *xe_gt_sysfs_path(int gt_id);

  How it is implemented probably doesn't matter much. It could e.g. go
  through the sysfs directory tree to find the path of a gt or it could use
  info on how gts are situated on tiles for particular platforms (MTL vs
  PVC as shown above e.g.). Either approach is fine, the platform approach
  is simpler.

  So once we have this function implemented, in the above
  set_freq()/get_freq() functions we could just use the gt path returned by
  this function to read/write the sysfs. We don't need to make the entire
  file tile aware. We just need to modify set_freq()/get_freq().

If this doesn't work for some reason please let me know why. Please don't
merge this series till we resolve this.

Thanks.
--
Ashutosh

  parent reply	other threads:[~2023-07-01 18:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 18:08 [igt-dev] [PATCH v4 0/4] Handle GT and tile seperation in IGT Himal Prasad Ghimiray
2023-06-27 18:08 ` [igt-dev] [PATCH v4 1/4] lib/igt_sysfs: Add support to query number of tiles Himal Prasad Ghimiray
2023-07-01 17:09   ` Dixit, Ashutosh
2023-07-04  4:41     ` Ghimiray, Himal Prasad
2023-06-27 18:08 ` [igt-dev] [PATCH v4 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes Himal Prasad Ghimiray
2023-06-27 18:08 ` [igt-dev] [PATCH v4 3/4] tests/xe/xe_guc_pc: Change the sysfs paths Himal Prasad Ghimiray
2023-06-30 17:33   ` Kamil Konieczny
2023-07-05  8:31     ` Ghimiray, Himal Prasad
2023-07-01 17:58   ` Dixit, Ashutosh [this message]
2023-07-03  8:00     ` Kamil Konieczny
2023-07-04  5:46     ` Ghimiray, Himal Prasad
2023-06-27 18:08 ` [igt-dev] [PATCH v4 4/4] tests/xe/xe_sysfs_tile_prop: adds new test to verify per tile vram addr_range Himal Prasad Ghimiray
2023-06-27 19:07 ` [igt-dev] ✓ Fi.CI.BAT: success for Handle GT and tile seperation in IGT (rev3) Patchwork
2023-06-28 10:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-06-29 17:47   ` Kamil Konieczny
2023-06-30  7:35     ` Yedireswarapu, SaiX Nandan
2023-06-30  7:34 ` [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=87jzvj8qf4.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tejas.upadhyay@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