[igt-dev] [PATCH i-g-t 1/2] lib/i915/perf: fix loading configurations
Chris Wilson
chris at chris-wilson.co.uk
Mon Feb 24 14:04:48 UTC 2020
Quoting Lionel Landwerlin (2020-02-24 14:03:32)
> On 24/02/2020 14:15, Chris Wilson wrote:
> > Quoting Lionel Landwerlin (2020-02-24 09:24:17)
> >> The configuration ID created is returned not passed by argument.
> >>
> >> This would lead the verify first test in the perf tests to fail.
> >>
> >> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> >> Fixes: 3fd64d9fb8 ("lib/i915-perf: Add support for loading perf configurations")
> >> ---
> >> lib/i915/perf.c | 7 ++++---
> >> 1 file changed, 4 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/lib/i915/perf.c b/lib/i915/perf.c
> >> index 35b9aff9..1adf1393 100644
> >> --- a/lib/i915/perf.c
> >> +++ b/lib/i915/perf.c
> >> @@ -427,7 +427,7 @@ static void
> >> load_metric_set_config(struct intel_perf_metric_set *metric_set, int drm_fd)
> >> {
> >> struct drm_i915_perf_oa_config config;
> >> - uint64_t config_id = 0;
> >> + int ret;
> > Hmm, the syscall return is a long, but glibc ioctl() is only an int.
> > That bodes well for the future :(
> >
> >> memset(&config, 0, sizeof(config));
> >>
> >> @@ -442,10 +442,11 @@ load_metric_set_config(struct intel_perf_metric_set *metric_set, int drm_fd)
> >> config.n_flex_regs = metric_set->n_flex_regs;
> >> config.flex_regs_ptr = (uintptr_t) metric_set->flex_regs;
> >>
> >> - while (ioctl(drm_fd, DRM_IOCTL_I915_PERF_ADD_CONFIG, &config) < 0 &&
> >> + while ((ret = ioctl(drm_fd, DRM_IOCTL_I915_PERF_ADD_CONFIG, &config)) < 0 &&
> >> (errno == EAGAIN || errno == EINTR));
> > ret = igt_ioctl(drm_fd, ADD_CONFIG, &config);
> >
> > That will eat the EAGAIN/EINTR for you.
> >
> > Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> > -Chris
>
> If you don't mind I'll just have my own version of that ioctl helper
> locally.
>
> I tried you suggestion but it started to pull all kind of headers I
> don't really want to depend on.
Ah, lib/i915/perf.c. No worries. I though we were under test/
-Chris
More information about the igt-dev
mailing list