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 2/8] drm/i915: Reference count struct drm_i915_file_private
Date: Fri, 20 Dec 2019 07:55:05 +0000	[thread overview]
Message-ID: <6c9d1d35-606c-925a-1f2d-18a48720135a@linux.intel.com> (raw)
In-Reply-To: <157678823997.6469.3187491361664776890@skylake-alporthouse-com>


On 19/12/2019 20:43, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-12-19 18:00:13)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> In the following patches we will develope a need to peek into the client
>> owned data from any potential leftover contexts.
>>
>> To facilitate this add reference counting to file_priv.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   drivers/gpu/drm/i915/gem/i915_gem_context.c |  2 +-
>>   drivers/gpu/drm/i915/i915_drv.c             |  4 ----
>>   drivers/gpu/drm/i915/i915_drv.h             |  4 +++-
>>   drivers/gpu/drm/i915/i915_gem.c             | 14 +++++++++++++-
>>   4 files changed, 17 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
>> index e5a7c6f02a47..b482b2e5f31f 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
>> @@ -853,7 +853,7 @@ int i915_gem_context_open(struct drm_i915_private *i915,
>>   void i915_gem_context_close(struct drm_file *file)
>>   {
>>          struct drm_i915_file_private *file_priv = file->driver_priv;
>> -       struct drm_i915_private *i915 = file_priv->dev_priv;
>> +       struct drm_i915_private *i915 = file_priv->i915;
>>          struct i915_gem_context *ctx;
>>          unsigned long idx;
>>   
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index 8b08cfe30151..0c9c93418068 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -1633,13 +1633,9 @@ static void i915_driver_lastclose(struct drm_device *dev)
>>   
>>   static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
>>   {
>> -       struct drm_i915_file_private *file_priv = file->driver_priv;
>> -
>>          i915_gem_context_close(file);
>>          i915_gem_release(dev, file);
>>   
>> -       kfree_rcu(file_priv, rcu);
> 
> As you are moving the kfree_rcu() into the i915_gem_release (via a put),
> I think it also makes sense to move the call for i915_gem_context_close
> on this file. Possibly renaming it to i915_gem_file_close() and
> s/drm_i915_file_private/i915_gem_file/ or i915_gem_client (with
> corresponding name changes) in the process.
> 
> For the basic mechanics of this patch though,
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> (Though I still suggest a bit of playing with i915_gem_context_close,
> i915_gem_release to tie them together to the notion of the file better.)

Yes, agreed in principle.

But a) I prefer the release name to match with the fops mindset and b) I 
prefer to leave drm_i915_file_private alone as the top level driver 
private container.

What I am not completely happy with, or say undecided, is whether to 
move the kref into i915_drm_client. I had it like that at one point, 
thinking to only have a smallest needed structure pinned in memory, but 
then I simplified in favour of fewer allocations. Now I think I'd like 
to move the kref into i915_drm_client again. Any opinion here?

In a later patch, when I add the i915_gem_client_get/put helpers they 
are already named like that. Hm okay, I also have a naming confusion 
between struct i915_drm_client and i915_gem_client_get/put(). :)

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:55 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 [this message]
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
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=6c9d1d35-606c-925a-1f2d-18a48720135a@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