public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v6 03/11] drm/i915/perf: allow for CS OA configs to be created lazily
Date: Tue, 9 Jul 2019 09:47:04 +0300	[thread overview]
Message-ID: <b4e45d91-3115-461f-65f2-fceccd5ff61d@intel.com> (raw)
In-Reply-To: <156199377822.1583.13857985932185394689@skylake-alporthouse-com>

On 01/07/2019 18:09, Chris Wilson wrote:
> Quoting Lionel Landwerlin (2019-07-01 12:34:29)
>>   struct i915_oa_config {
>> +       struct drm_i915_private *i915;
>> +
>>          char uuid[UUID_STRING_LEN + 1];
>>          int id;
>>   
>> @@ -1110,6 +1112,10 @@ struct i915_oa_config {
>>          struct attribute *attrs[2];
>>          struct device_attribute sysfs_metric_id;
>>   
>> +       struct drm_i915_gem_object *obj;
>> +
>> +       struct list_head vma_link;
>> +
>>          atomic_t ref_count;
>>   };
>> -static void free_oa_config(struct drm_i915_private *dev_priv,
>> -                          struct i915_oa_config *oa_config)
>> +static void put_oa_config(struct i915_oa_config *oa_config)
>>   {
>> +       if (!atomic_dec_and_test(&oa_config->ref_count))
>> +               return;
> I strongly advise that ref_count be replaced by struct kref, just so that
> we get the benefit of debugging.
>
> put_oa_config -> kref_put(&oa_config->ref, free_oa_config)
> (free_oa_config takes kref as its arg and uses container_of())


This is done in "drm/i915: add a new perf configuration execbuf parameter"

I'll factor it in this commit.


>
>> +int i915_perf_get_oa_config(struct drm_i915_private *i915,
>> +                           int metrics_set,
>> +                           struct i915_oa_config **out_config,
>> +                           struct drm_i915_gem_object **out_obj)
>> +{
>> +       int ret = 0;
>> +       struct i915_oa_config *oa_config;
>> +
>> +       if (!i915->perf.initialized)
>> +               return -ENODEV;
>> +
>> +       ret = mutex_lock_interruptible(&i915->perf.metrics_lock);
>>          if (ret)
>>                  return ret;
>>   
>> -       *out_config = idr_find(&dev_priv->perf.metrics_idr, metrics_set);
>> -       if (!*out_config)
>> -               ret = -EINVAL;
>> -       else
>> -               atomic_inc(&(*out_config)->ref_count);
>> +       if (metrics_set == 1) {
>> +               oa_config = &i915->perf.oa.test_config;
>> +       } else {
>> +               oa_config = idr_find(&i915->perf.metrics_idr, metrics_set);
> Why not have the builtin[1] inside the idr?


I think it was just a way to avoid removing it from the idr through 
userspace calls.


> -Chris
>

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

  reply	other threads:[~2019-07-09  6:47 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 11:34 [PATCH v6 00/11] drm/i915: Vulkan performance query support Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 01/11] drm/i915/perf: add missing delay for OA muxes configuration Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 02/11] drm/i915/perf: introduce a versioning of the i915-perf uapi Lionel Landwerlin
2019-07-01 12:45   ` Chris Wilson
2019-07-01 11:34 ` [PATCH v6 03/11] drm/i915/perf: allow for CS OA configs to be created lazily Lionel Landwerlin
2019-07-01 13:06   ` Chris Wilson
2019-07-01 13:45     ` Lionel Landwerlin
2019-07-01 15:09   ` Chris Wilson
2019-07-09  6:47     ` Lionel Landwerlin [this message]
2019-07-09  8:31       ` Chris Wilson
2019-07-09  8:30   ` Chris Wilson
2019-07-01 11:34 ` [PATCH v6 04/11] drm/i915: enumerate scratch fields Lionel Landwerlin
2019-07-01 12:07   ` Chris Wilson
2019-07-01 11:34 ` [PATCH v6 05/11] drm/i915/perf: implement active wait for noa configurations Lionel Landwerlin
2019-07-01 12:43   ` Chris Wilson
2019-07-01 13:10     ` Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 06/11] drm/i915: introduce a mechanism to extend execbuf2 Lionel Landwerlin
2019-07-01 15:17   ` Chris Wilson
2019-07-02 11:36     ` Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 07/11] drm/i915: add syncobj timeline support Lionel Landwerlin
2019-07-01 13:13   ` Chris Wilson
2019-07-01 13:15     ` Lionel Landwerlin
2019-07-01 13:18   ` Chris Wilson
2019-07-01 13:22     ` Lionel Landwerlin
2019-07-03  8:56   ` Chris Wilson
2019-07-03  9:17     ` Lionel Landwerlin
2019-07-15 11:30       ` Koenig, Christian
2019-07-16  8:17         ` Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 08/11] drm/i915: add a new perf configuration execbuf parameter Lionel Landwerlin
2019-07-01 12:05   ` Chris Wilson
2019-07-01 12:14     ` Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 09/11] drm/i915/perf: allow holding preemption on filtered ctx Lionel Landwerlin
2019-07-01 12:03   ` Chris Wilson
2019-07-01 12:10     ` Lionel Landwerlin
2019-07-01 14:37       ` Chris Wilson
2019-07-09  9:18         ` Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 10/11] drm/i915/perf: execute OA configuration from command stream Lionel Landwerlin
2019-07-01 13:32   ` Chris Wilson
2019-07-01 13:42     ` Lionel Landwerlin
2019-07-01 11:34 ` [PATCH v6 11/11] drm/i915: add support for perf configuration queries Lionel Landwerlin
2019-07-01 13:08 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Vulkan performance query support (rev6) Patchwork
2019-07-01 13:14 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-01 13:38 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-02 18:02 ` ✗ Fi.CI.IGT: failure " 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=b4e45d91-3115-461f-65f2-fceccd5ff61d@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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