public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, Intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [RFC 3/8] drm/i915: Expose list of clients in sysfs
Date: Fri, 20 Dec 2019 07:56:25 +0000	[thread overview]
Message-ID: <88c3d8a8-0a37-036a-5c79-845d3157ecf4@linux.intel.com> (raw)
In-Reply-To: <157678851938.6469.1830542116916640880@skylake-alporthouse-com>


On 19/12/2019 20:48, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-12-19 18:00:14)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Expose a list of clients with open file handles in sysfs.
>>
>> This will be a basis for a top-like utility showing per-client and per-
>> engine GPU load.
>>
>> Currently we only expose each client's pid and name under opaque numbered
>> directories in /sys/class/drm/card0/clients/.
>>
>> For instance:
>>
>> /sys/class/drm/card0/clients/3/name: Xorg
>> /sys/class/drm/card0/clients/3/pid: 5664
>>
>> v2:
>>   Chris Wilson:
>>   * Enclose new members into dedicated structs.
>>   * Protect against failed sysfs registration.
>>
>> v3:
>>   * sysfs_attr_init.
>>
>> v4:
>>   * Fix for internal clients.
>>
>> v5:
>>   * Use cyclic ida for client id. (Chris)
>>   * Do not leak pid reference. (Chris)
>>   * Tidy code with some locals.
>>
>> v6:
>>   * Use xa_alloc_cyclic to simplify locking. (Chris)
>>   * No need to unregister individial sysfs files. (Chris)
>>   * Rebase on top of fpriv kref.
>>   * Track client closed status and reflect in sysfs.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_drv.h   |  20 +++++
>>   drivers/gpu/drm/i915/i915_gem.c   | 133 ++++++++++++++++++++++++++++--
>>   drivers/gpu/drm/i915/i915_sysfs.c |   8 ++
>>   3 files changed, 155 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index 6f13f0c619e9..e1d8361aafd7 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -188,6 +188,7 @@ struct i915_hotplug {
>>   struct drm_i915_private;
>>   struct i915_mm_struct;
>>   struct i915_mmu_object;
>> +struct i915_drm_clients;
>>   
>>   struct drm_i915_file_private {
>>          struct kref kref;
>> @@ -226,6 +227,19 @@ struct drm_i915_file_private {
>>          /** ban_score: Accumulated score of all ctx bans and fast hangs. */
>>          atomic_t ban_score;
>>          unsigned long hang_timestamp;
>> +
>> +       struct i915_drm_client {
> 
> I agree with the distinction here between drm_client and
> gem_client. (This concept will be required beyond GEM.)

So you think I should keep the i915_drm_client naming for these bits 
throughout?

>> +               unsigned int id;
>> +               struct pid *pid;
>> +               char *name;
>> +               bool closed;
>> +
>> +               struct kobject *root;
>> +               struct {
>> +                       struct device_attribute pid;
>> +                       struct device_attribute name;
>> +               } attr;
>> +       } client;
>>   };
>>   
>>   /* Interface history:
>> @@ -1280,6 +1294,12 @@ struct drm_i915_private {
>>   
>>          struct i915_pmu pmu;
>>   
>> +       struct i915_drm_clients {
>> +               struct xarray xarray;
>> +
>> +               struct kobject *root;
>> +       } clients;
> 
> You might as well pull this out into i915_drm_client.[ch]
> Actually make that into a please. :)

Np. Maybe next year though. :)

Regards,

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

  reply	other threads:[~2019-12-20  7:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 18:00 [Intel-gfx] [RFC 0/8] Per client engine busyness Tvrtko Ursulin
2019-12-19 18:00 ` [Intel-gfx] [RFC 1/8] drm/i915: Switch context id allocation directoy to xarray Tvrtko Ursulin
2019-12-19 19:55   ` Chris Wilson
2019-12-19 18:00 ` [Intel-gfx] [RFC 2/8] drm/i915: Reference count struct drm_i915_file_private Tvrtko Ursulin
2019-12-19 20:43   ` Chris Wilson
2019-12-20  7:55     ` Tvrtko Ursulin
2019-12-19 18:00 ` [Intel-gfx] [RFC 3/8] drm/i915: Expose list of clients in sysfs Tvrtko Ursulin
2019-12-19 20:48   ` Chris Wilson
2019-12-20  7:56     ` Tvrtko Ursulin [this message]
2019-12-20 10:08       ` Chris Wilson
2019-12-19 18:00 ` [Intel-gfx] [RFC 4/8] drm/i915: Update client name on context create Tvrtko Ursulin
2019-12-19 18:00 ` [Intel-gfx] [RFC 5/8] drm/i915: Track per-context engine busyness Tvrtko Ursulin
2019-12-19 20:51   ` Chris Wilson
2019-12-20  7:58     ` Tvrtko Ursulin
2019-12-19 18:00 ` [Intel-gfx] [RFC 6/8] drm/i915: Track all user contexts per client Tvrtko Ursulin
2019-12-19 18:00 ` [Intel-gfx] [RFC 7/8] drm/i915: Contexts can use struct pid stored in the client Tvrtko Ursulin
2019-12-19 20:57   ` Chris Wilson
2019-12-20  8:00     ` Tvrtko Ursulin
2019-12-19 18:00 ` [Intel-gfx] [RFC 8/8] drm/i915: Expose per-engine client busyness Tvrtko Ursulin
2019-12-19 21:04   ` Chris Wilson
2019-12-20  8:07     ` Tvrtko Ursulin
2019-12-19 21:23   ` Chris Wilson
2019-12-19 23:16     ` Chris Wilson
2019-12-19 18:41 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Per client engine busyness (rev2) Patchwork
2019-12-19 19:17 ` [Intel-gfx] ✗ Fi.CI.BAT: 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=88c3d8a8-0a37-036a-5c79-845d3157ecf4@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    /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