All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Robert Bragg <robert@sixbynine.org>
Cc: David Airlie <airlied@linux.ie>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Sourab Gupta <sourab.gupta@intel.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v9 01/11] drm/i915: Add i915 perf infrastructure
Date: Tue, 22 Nov 2016 16:35:37 +0100	[thread overview]
Message-ID: <20161122153537.64s526oq7a2eph2w@phenom.ffwll.local> (raw)
In-Reply-To: <CAMou1-3OdZ0WVthohoEYPYxXSETARQj+2NJRtSRbySYiU5Qptw@mail.gmail.com>

On Tue, Nov 22, 2016 at 02:02:38PM +0000, Robert Bragg wrote:
> On Tue, Nov 22, 2016 at 1:31 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> 
> > On Tue, Nov 22, 2016 at 02:29:18PM +0100, Daniel Vetter wrote:
> > > On Wed, Nov 09, 2016 at 08:00:06PM +0000, Matthew Auld wrote:
> > > > On 7 November 2016 at 19:49, Robert Bragg <robert@sixbynine.org>
> > wrote:
> > > > > Adds base i915 perf infrastructure for Gen performance metrics.
> > > > >
> > > > > This adds a DRM_IOCTL_I915_PERF_OPEN ioctl that takes an array of
> > uint64
> > > > > properties to configure a stream of metrics and returns a new fd
> > usable
> > > > > with standard VFS system calls including read() to read typed and
> > sized
> > > > > records; ioctl() to enable or disable capture and poll() to wait for
> > > > > data.
> > > > >
> > > > > A stream is opened something like:
> > > > >
> > > > >   uint64_t properties[] = {
> > > > >       /* Single context sampling */
> > > > >       DRM_I915_PERF_PROP_CTX_HANDLE,        ctx_handle,
> > > > >
> > > > >       /* Include OA reports in samples */
> > > > >       DRM_I915_PERF_PROP_SAMPLE_OA,         true,
> > > > >
> > > > >       /* OA unit configuration */
> > > > >       DRM_I915_PERF_PROP_OA_METRICS_SET,    metrics_set_id,
> > > > >       DRM_I915_PERF_PROP_OA_FORMAT,         report_format,
> > > > >       DRM_I915_PERF_PROP_OA_EXPONENT,       period_exponent,
> > > > >    };
> > > > >    struct drm_i915_perf_open_param parm = {
> > > > >       .flags = I915_PERF_FLAG_FD_CLOEXEC |
> > > > >                I915_PERF_FLAG_FD_NONBLOCK |
> > > > >                I915_PERF_FLAG_DISABLED,
> > > > >       .properties_ptr = (uint64_t)properties,
> > > > >       .num_properties = sizeof(properties) / 16,
> > > > >    };
> > > > >    int fd = drmIoctl(drm_fd, DRM_IOCTL_I915_PERF_OPEN, &param);
> > > > >
> > > > > Records read all start with a common { type, size } header with
> > > > > DRM_I915_PERF_RECORD_SAMPLE being of most interest. Sample records
> > > > > contain an extensible number of fields and it's the
> > > > > DRM_I915_PERF_PROP_SAMPLE_xyz properties given when opening that
> > > > > determine what's included in every sample.
> > > > >
> > > > > No specific streams are supported yet so any attempt to open a stream
> > > > > will return an error.
> > > > >
> > > > > v2:
> > > > >     use i915_gem_context_get() - Chris Wilson
> > > > > v3:
> > > > >     update read() interface to avoid passing state struct - Chris
> > Wilson
> > > > >     fix some rebase fallout, with i915-perf init/deinit
> > > > > v4:
> > > > >     s/DRM_IORW/DRM_IOW/ - Emil Velikov
> > > > >
> > > > > Signed-off-by: Robert Bragg <robert@sixbynine.org>
> > > > > Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> > > > > Reviewed-by: Sourab Gupta <sourab.gupta@intel.com>
> > > > Minor nit, there are a fair few DRM_ERROR's missing a new line.
> > >
> > > Also, DRM_ERROR for userspace-triggerable failures is no good. igt
> > > testcase are supposed to exercise all the invalid stuff, and would then
> > > fail if you spam dmesg. Why was this not caught?
> > >
> > > Fixup patch totally fine, but if this wasn't caught due to missing igt
> > > that needs to be fixed, too.
> >
> > Another nitpick for the future: Enabling new features first and then
> > fixing up the fallout is the wrong way round, if someone bisects over this
> > range mesa might blow up in really bad ways.
> >
> > Oh well, this has been out there for way too long, so meh.
> >
> 
> Fwiw I'm aware of this, and think I've ordered the patches correctly to
> avoid bisect problems in Mesa / userspace. This infrastructure patch should
> have no fallout to fix for userspace. The command parser changes that
> affect userspace were done before adding oacontrol usage to i915-perf and
> the cmd parser's EINVAL reporting for access failures was changed *before*
> removing oacontrol from the whitelist.
> 
> Did I overlook something in particular?

Ah, if you key the userspace side off the cmd parser change then I think
it should be all fine. I only looked at this ioctl here, and that alone
looked like it was unsafe. Ordering of the patches later on seemed correct
indeed.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-11-22 15:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 19:49 [PATCH v9 00/11] Enable i915 perf stream for Haswell OA unit Robert Bragg
2016-11-07 19:49 ` [PATCH v9 01/11] drm/i915: Add i915 perf infrastructure Robert Bragg
2016-11-09 20:00   ` Matthew Auld
2016-11-22 13:29     ` [Intel-gfx] " Daniel Vetter
2016-11-22 13:31       ` Daniel Vetter
2016-11-22 14:02         ` [Intel-gfx] " Robert Bragg
2016-11-22 15:35           ` Daniel Vetter [this message]
2016-11-07 19:49 ` [PATCH v9 02/11] drm/i915: rename OACONTROL GEN7_OACONTROL Robert Bragg
2016-11-07 19:49 ` [PATCH v9 03/11] drm/i915: return EACCES for check_cmd() failures Robert Bragg
2016-11-07 19:49 ` [PATCH v9 04/11] drm/i915: don't whitelist oacontrol in cmd parser Robert Bragg
2016-11-08 12:51   ` [PATCH v2] " Robert Bragg
2016-11-22 13:34     ` [Intel-gfx] " Daniel Vetter
2016-11-22 14:09       ` Robert Bragg
2016-11-22 15:36         ` Daniel Vetter
2016-11-07 19:49 ` [PATCH v9 05/11] drm/i915: Add 'render basic' Haswell OA unit config Robert Bragg
2016-11-08  6:04   ` sourab gupta
2016-11-07 19:49 ` [PATCH v9 06/11] drm/i915: Enable i915 perf stream for Haswell OA unit Robert Bragg
2016-11-15  9:24   ` sourab gupta
2016-11-07 19:49 ` [PATCH v9 07/11] drm/i915: advertise available metrics via sysfs Robert Bragg
2016-11-07 19:49 ` [PATCH v9 08/11] drm/i915: Add dev.i915.perf_stream_paranoid sysctl option Robert Bragg
2016-11-07 19:49 ` [PATCH v9 09/11] drm/i915: add dev.i915.oa_max_sample_rate sysctl Robert Bragg
2016-11-08  6:19   ` sourab gupta
2016-11-08 11:47     ` Robert Bragg
2016-11-08 12:14       ` sourab gupta
2016-11-09 19:52   ` Matthew Auld
2016-11-10 13:57     ` Robert Bragg
2016-11-07 19:49 ` [PATCH v9 10/11] drm/i915: Add more Haswell OA metric sets Robert Bragg
2016-11-07 19:49 ` [PATCH v9 11/11] drm/i915: Add a kerneldoc summary for i915_perf.c Robert Bragg
2016-11-08  6:27   ` sourab gupta
2016-11-22 13:43   ` Daniel Vetter
2016-11-07 20:14 ` ✗ Fi.CI.BAT: failure for Enable i915 perf stream for Haswell OA unit Patchwork
2016-11-08 13:19 ` ✗ Fi.CI.BAT: failure for Enable i915 perf stream for Haswell OA unit (rev2) 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=20161122153537.64s526oq7a2eph2w@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=robert@sixbynine.org \
    --cc=sourab.gupta@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.