All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: petri.latvala@intel.com, igt-dev@lists.freedesktop.org,
	krishnaiah.bommu@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t 2/6] lib/igt_sysfs: Add helpers to iterate over GTs
Date: Mon, 25 Apr 2022 16:13:19 -0700	[thread overview]
Message-ID: <875ymw7o4w.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20220425200752.GH55612@unerlige-ril-10.165.21.154>

On Mon, 25 Apr 2022 13:07:52 -0700, Umesh Nerlige Ramappa wrote:
>
> On Thu, Apr 21, 2022 at 10:45:46PM -0700, Dixit, Ashutosh wrote:
> > On Thu, 21 Apr 2022 07:52:07 -0700, <priyanka.dandamudi@intel.com> wrote:
> >>
> >> +char *igt_sysfs_gt_path(int device, int gt, char *path, int pathlen)
> >> +{
> >> +	struct stat st;
> >> +
> >> +	if (device < 0)
> >> +		return NULL;
> >> +
> >> +	if (igt_debug_on(fstat(device, &st)) || igt_debug_on(!S_ISCHR(st.st_mode)))
> >> +		return NULL;
> >> +
> >> +	snprintf(path, pathlen, "/sys/dev/char/%d:%d/gt/gt%d",
> >> +		 major(st.st_rdev), minor(st.st_rdev), gt);
> >> +
> >> +	if (!igt_debug_on(access(path, F_OK)))
> >> +		return path;
> >> +	else if (!igt_debug_on(gt != 0))
> >> +		return igt_sysfs_path(device, path, pathlen);
> >
> > I think these two igt_debug_on()'s should be removed. The issue is the
> > for_each_sysfs_gt() loops below will send a gt value 1 greater than the
> > actual number of gt's (at which point this function returns NULL and the
> > loops exit). And then these igt_debug_on's will fire during the normal
> > course of operation whereas they are meant to fire only in error. So if we
> > fix this, this code becomes:
> >
> >> +	if (!(access(path, F_OK)))
> >> +		return path;
> >> +	else if (!gt)
> >> +		return igt_sysfs_path(device, path, pathlen);
>
> Agree that this should be fixed. Thanks for catching this.

Thanks for confirming, this is now merged.

  reply	other threads:[~2022-04-25 23:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 14:52 [igt-dev] [PATCH i-g-t 0/6] Test for shared reset domain priyanka.dandamudi
2022-04-21 14:52 ` [igt-dev] [PATCH i-g-t 1/6] lib/i915/i915_drm_local : Add DRM_I915_QUERY_DISTANCE_INFO query priyanka.dandamudi
2022-04-21 16:34   ` Matt Roper
2022-04-21 16:41     ` Dixit, Ashutosh
2022-04-21 14:52 ` [igt-dev] [PATCH i-g-t 2/6] lib/igt_sysfs: Add helpers to iterate over GTs priyanka.dandamudi
2022-04-22  5:45   ` Dixit, Ashutosh
2022-04-22  5:58     ` Dixit, Ashutosh
2022-04-25 20:07     ` Umesh Nerlige Ramappa
2022-04-25 23:13       ` Dixit, Ashutosh [this message]
2022-04-21 14:52 ` [igt-dev] [PATCH i-g-t 3/6] lib/sysfs: helper for number of gts priyanka.dandamudi
2022-04-26  8:33   ` Kamil Konieczny
2022-04-26 15:33     ` Dandamudi, Priyanka
2022-04-26 16:02       ` Dandamudi, Priyanka
2022-04-21 14:52 ` [igt-dev] [PATCH i-g-t 4/6] lib/i915/gem_engine_topology: Add helper to list engines priyanka.dandamudi
2022-04-21 14:52 ` [igt-dev] [PATCH i-g-t 5/6] lib/intel_ctx: Create intel_ctx with physical engines in a single gt priyanka.dandamudi
2022-04-21 14:52 ` [igt-dev] [PATCH i-g-t 6/6] tests/gem_reset_stats: Test for shared reset domain priyanka.dandamudi
2022-04-21 21:14   ` Umesh Nerlige Ramappa
2022-04-21 16:15 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2022-04-21 21:26 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-04-22  5:06 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2022-04-22  5:36 ` 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=875ymw7o4w.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=krishnaiah.bommu@intel.com \
    --cc=petri.latvala@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.