public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dave Gordon <david.s.gordon@intel.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/9] drm/i915: Rename drm_gem_object_unreference in preparation for lockless free
Date: Wed, 20 Jul 2016 12:51:31 +0100	[thread overview]
Message-ID: <578F65C3.8010109@intel.com> (raw)
In-Reply-To: <1469015008.4964.9.camel@linux.intel.com>

On 20/07/16 12:43, Joonas Lahtinen wrote:
> On ke, 2016-07-20 at 09:59 +0100, Chris Wilson wrote:
>
>> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
>> index 605c69658d2c..75a1496ceb6f 100644
>> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
>> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
>> @@ -737,13 +737,15 @@ void intel_guc_fini(struct drm_device *dev)
>>   	struct drm_i915_private *dev_priv = to_i915(dev);
>>   	struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw;
>>
>> +	if (!guc_fw->guc_fw_obj)
>> +		return;
>> +
>
> This is definitely not a mechanical change, should be split to separate
> patch (maybe outside of this series too).
>
> With that split out,
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>
> Regards, Joonas
>
>>   	mutex_lock(&dev->struct_mutex);
>>   	direct_interrupts_to_host(dev_priv);
>>   	i915_guc_submission_disable(dev_priv);
>>   	i915_guc_submission_fini(dev_priv);
>>
>> -	if (guc_fw->guc_fw_obj)
>> -		drm_gem_object_unreference(&guc_fw->guc_fw_obj->base);
>> +	i915_gem_object_put(guc_fw->guc_fw_obj);
>>   	guc_fw->guc_fw_obj = NULL;
>>   	mutex_unlock(&dev->struct_mutex);

In my version of this set of transformations, I allowed the 
reference-releasing function (equivalent to i915_gem_object_put() here) 
to be called with NULL as a parameter; drm_gem_object_unreference() can 
already handle NULL, and since we now guarantee gem-obj == NULL <=> 
i915-obj == NULL, it's safe to pass it though. That allows quite a few 
simplifications in various bits of cleanup code.

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

  reply	other threads:[~2016-07-20 11:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20  8:59 A simple batch of churn to make reference handling look consistent Chris Wilson
2016-07-20  8:59 ` [PATCH 1/9] drm/i915: Rename request reference/unreference to get/put Chris Wilson
2016-07-20  8:59 ` [PATCH 2/9] drm/i915: Rename i915_gem_context_reference/unreference() Chris Wilson
2016-07-20  8:59 ` [PATCH 3/9] drm/i915: Wrap drm_gem_object_lookup in i915_gem_object_lookup Chris Wilson
2016-07-20 11:28   ` Dave Gordon
2016-07-20 11:38     ` Chris Wilson
2016-07-20 11:38   ` Joonas Lahtinen
2016-07-20 12:03     ` Chris Wilson
2016-07-20  8:59 ` [PATCH 4/9] drm/i915: Wrap drm_gem_object_reference in i915_gem_object_get Chris Wilson
2016-07-20 11:38   ` Dave Gordon
2016-07-20 11:45     ` Chris Wilson
2016-07-20 11:45   ` Joonas Lahtinen
2016-07-20  8:59 ` [PATCH 5/9] drm/i915: Rename drm_gem_object_unreference in preparation for lockless free Chris Wilson
2016-07-20 11:43   ` Joonas Lahtinen
2016-07-20 11:51     ` Dave Gordon [this message]
2016-07-20 12:11       ` Chris Wilson
2016-07-21 16:58   ` [PATCH] drm/i915: use i915_gem_object_put_unlocked() after releasing mutex Dave Gordon
2016-07-21 17:25     ` Chris Wilson
2016-07-20  8:59 ` [PATCH 6/9] drm/i915: Rename drm_gem_object_unreference_unlocked in preparation for lockless free Chris Wilson
2016-07-20 12:04   ` Joonas Lahtinen
2016-07-20  9:00 ` [PATCH 7/9] drm/i915: Treat ringbuffer writes as write to normal memory Chris Wilson
2016-07-20  9:00 ` [PATCH 8/9] drm/i915: Rename ring->virtual_start as ring->vaddr Chris Wilson
2016-07-20 11:54   ` Dave Gordon
2016-07-20 12:07   ` Joonas Lahtinen
2016-07-20  9:00 ` [PATCH 9/9] drm/i915: Convert i915_semaphores_is_enabled over to early sanitize Chris Wilson
2016-07-20 12:18   ` Joonas Lahtinen
2016-07-20  9:38 ` ✗ Ro.CI.BAT: failure for series starting with [1/9] drm/i915: Rename request reference/unreference to get/put Patchwork
2016-07-22  5:28 ` ✗ Ro.CI.BAT: failure for series starting with [1/9] drm/i915: Rename request reference/unreference to get/put (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=578F65C3.8010109@intel.com \
    --to=david.s.gordon@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox