All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: matthew.auld@intel.com
Subject: Re: [PATCH 7/7] drm/i915/perf: add flushing ioctl
Date: Mon, 4 Feb 2019 15:30:12 +0000	[thread overview]
Message-ID: <e873bf6e-3004-60fc-7787-592eb991c144@intel.com> (raw)
In-Reply-To: <154817433953.8871.11566961163517410064@jlahtine-desk.ger.corp.intel.com>

On 22/01/2019 16:25, Joonas Lahtinen wrote:
> Quoting Lionel Landwerlin (2019-01-16 17:36:22)
>> With the currently available parameters for the i915-perf stream,
>> there are still situations that are not well covered :
>>
>> If an application opens the stream with polling disable or at very low
>> frequency and OA interrupt enabled, no data will be available even
>> though somewhere between nothing and half of the OA buffer worth of
>> data might have landed in memory.
>>
>> To solve this issue we have a new flush ioctl on the perf stream that
>> forces the i915-perf driver to look at the state of the buffer when
>> called and makes any data available through both poll() & read() type
>> syscalls.
>>
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Link to userspace changes?
>
> Regards, Joonas


Hey Joonas,


I'm about to make the changes in gputop for the high frequency sampling 
use case.


One thing I would like to know is whether these new features should be 
reported through a flag.

So far we haven't added any new option to the i915/perf driver since the 
initial upstreaming series.


The way I'm currently detecting newly added parameters is by using 
trying to open the stream with a value that I know will report ENOENT 
rather than EINVAL when the feature is not available :

https://github.com/djdeath/intel-gpu-tools/blob/wip/djdeath/oa-interrupts/tests/perf.c#L4345

Is there a better way to do this?


Thanks,


-Lionel


>
>> ---
>>   drivers/gpu/drm/i915/i915_perf.c | 17 +++++++++++++++++
>>   include/uapi/drm/i915_drm.h      | 19 +++++++++++++++++++
>>   2 files changed, 36 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
>> index da721fce2543..6c98ffa2135e 100644
>> --- a/drivers/gpu/drm/i915/i915_perf.c
>> +++ b/drivers/gpu/drm/i915/i915_perf.c
>> @@ -2433,6 +2433,20 @@ static void i915_perf_disable_locked(struct i915_perf_stream *stream)
>>                  stream->ops->disable(stream);
>>   }
>>   
>> +/**
>> + * i915_perf_flush_data - handle `I915_PERF_IOCTL_FLUSH_DATA` ioctl
>> + * @stream: An enabled i915 perf stream
>> + *
>> + * The intention is to flush all the data available for reading from the OA
>> + * buffer
>> + */
>> +static void i915_perf_flush_data(struct i915_perf_stream *stream)
>> +{
>> +       struct drm_i915_private *dev_priv = stream->dev_priv;
>> +
>> +       dev_priv->perf.oa.pollin = oa_buffer_check(stream->dev_priv, true);
>> +}
>> +
>>   /**
>>    * i915_perf_ioctl - support ioctl() usage with i915 perf stream FDs
>>    * @stream: An i915 perf stream
>> @@ -2456,6 +2470,9 @@ static long i915_perf_ioctl_locked(struct i915_perf_stream *stream,
>>          case I915_PERF_IOCTL_DISABLE:
>>                  i915_perf_disable_locked(stream);
>>                  return 0;
>> +       case I915_PERF_IOCTL_FLUSH_DATA:
>> +               i915_perf_flush_data(stream);
>> +               return 0;
>>          }
>>   
>>          return -EINVAL;
>> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
>> index b6db5e544a35..0f0d20080572 100644
>> --- a/include/uapi/drm/i915_drm.h
>> +++ b/include/uapi/drm/i915_drm.h
>> @@ -1594,6 +1594,25 @@ struct drm_i915_perf_open_param {
>>    */
>>   #define I915_PERF_IOCTL_DISABLE        _IO('i', 0x1)
>>   
>> +/**
>> + * Actively check the availability of data from a stream.
>> + *
>> + * A stream data availability can be driven by two types of events :
>> + *
>> + *   - if enabled, the kernel's hrtimer checking the amount of available data
>> + *     in the OA buffer through head/tail registers.
>> + *
>> + *   - if enabled, the OA unit's interrupt mechanism
>> + *
>> + * The kernel hrtimer incur a cost of running callback at fixed time
>> + * intervals, while the OA interrupt might only happen rarely. In the
>> + * situation where the application has disabled the kernel's hrtimer and only
>> + * uses the OA interrupt to know about available data, the application can
>> + * request an active check of the available OA data through this ioctl. This
>> + * will make any data in the OA buffer available with either poll() or read().
>> + */
>> +#define I915_PERF_IOCTL_FLUSH_DATA _IO('i', 0x2)
>> +
>>   /**
>>    * Common to all i915 perf records
>>    */
>> -- 
>> 2.20.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-02-04 15:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 15:36 [PATCH 0/7] drm/i915/perf: add OA interrupt support Lionel Landwerlin
2019-01-16 15:36 ` [PATCH 1/7] drm/i915/perf: rework aging tail workaround Lionel Landwerlin
2019-01-16 15:36 ` [PATCH 2/7] drm/i915/perf: reset pollin when perf stream is enabled Lionel Landwerlin
2019-01-16 17:13   ` Matthew Auld
2019-01-16 18:14     ` Lionel Landwerlin
2019-01-16 15:36 ` [PATCH 3/7] drm/i915/perf: only append status when data is available Lionel Landwerlin
2019-01-16 22:40   ` kbuild test robot
2019-01-16 15:36 ` [PATCH 4/7] drm/i915/perf: add new open param to configure polling of OA buffer Lionel Landwerlin
2019-01-16 15:36 ` [PATCH 5/7] drm/i915: handle interrupts from the OA unit Lionel Landwerlin
2019-01-16 15:52   ` Chris Wilson
2019-01-16 15:58     ` Lionel Landwerlin
2019-01-16 16:02       ` Lionel Landwerlin
2019-01-16 16:09         ` Chris Wilson
2019-01-16 16:05       ` Chris Wilson
2019-01-16 16:25         ` Lionel Landwerlin
2019-01-16 16:31           ` Chris Wilson
2019-01-16 18:04             ` Lionel Landwerlin
2019-01-17 11:43               ` Lionel Landwerlin
2019-01-16 15:36 ` [PATCH 6/7] drm/i915/perf: add interrupt enabling parameter Lionel Landwerlin
2019-01-16 15:36 ` [PATCH 7/7] drm/i915/perf: add flushing ioctl Lionel Landwerlin
2019-01-22 16:25   ` Joonas Lahtinen
2019-01-22 17:48     ` Lionel Landwerlin
2019-02-04 15:30     ` Lionel Landwerlin [this message]
2019-02-25 17:16       ` Joonas Lahtinen
2019-01-17  8:09 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/perf: add OA interrupt support (rev2) Patchwork
2019-01-17  8:12 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-01-17  8:31 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-17 11:42 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-01-22 10:53 ` [PATCH 0/7] drm/i915/perf: add OA interrupt support Lionel Landwerlin

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=e873bf6e-3004-60fc-7787-592eb991c144@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=matthew.auld@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.