intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org,
	akash.goel@intel.com, shashidhar.hiremath@intel.com
Subject: Re: [PATCH 4/6] drm/i915: Add support for stealing purgable stolen pages
Date: Thu, 8 Oct 2015 15:31:08 +0100	[thread overview]
Message-ID: <56167E2C.3050806@linux.intel.com> (raw)
In-Reply-To: <20151008110932.GO27939@nuc-i3427.alporthouse.com>


On 08/10/15 12:09, Chris Wilson wrote:
> On Thu, Oct 08, 2015 at 11:43:29AM +0100, Tvrtko Ursulin wrote:
>>> -struct drm_i915_gem_object *
>>> -i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
>>> +static bool
>>> +mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
>>> +{
>>> +	BUG_ON(obj->stolen == NULL);
>>
>> I am fundamentally opposed to BUG_ONs which can be avoided. In this
>> I see no value in hanging the machine while we could WARN_ON and
>> return false.
>
> Don't bother with the WARN_ON. Either take the BUG_ON or accept that to
> get to this point the machine is dead anyway and a warning here doesn't
> help identify the root cause (better off with list debugging and memory
> debugging). I have personally been converting these asserts over to a
> dev-only compiletime option as I still find the BUGs more useful than
> WARNs in the GEM code.

This is one of the ones which are to be expected in development only. At 
that time I much prefer a WARN_ON since it potentially saves you one 
reboot cycle and there aren't really any downsides to it. Especially if, 
as you say, machine is dead already.

>>> +	if (obj->madv != I915_MADV_DONTNEED)
>>> +		return false;
>>> +
>>> +	if (obj->pin_display)
>>> +		return false;
>>> +
>>> +	list_add(&obj->tmp_link, unwind);
>>> +	return drm_mm_scan_add_block(&obj->stolen->base);
>>> +}
>
>>> @@ -520,17 +609,59 @@ i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
>>>   	if (!stolen)
>>>   		return ERR_PTR(-ENOMEM);
>>>
>>> -	ret = i915_gem_stolen_insert_node(dev_priv, stolen, size, 4096);
>>> +	ret = i915_gem_stolen_insert_node(dev_priv, &stolen->base, size, 4096);
>>> +	if (ret == 0)
>>> +		goto out;
>>> +
>>> +	/* No more stolen memory available, or too fragmented.
>>> +	 * Try evicting purgeable objects and search again.
>>> +	 */
>>> +	ret = stolen_evict(dev_priv, size);
>>
>> I have raised this question of struct_mutex in the previous round.
>>
>> Correct me if I am wrong, but I thought there was some effort made
>> to make stolen object allocation run without struct mutex?
>
> Correct. But note that we do GEM operations inside the eviction logic
> and the struct_mutex is the only one we have for them.
>
>> With this change it requires it again. At the moment callers seem to
>> hold it anyway. But I think lockdep_assert_held is needed now at
>> least to document the requirement, probably in top level
>> i915_gem_object_create_stolen.
>
> And a comment as to why, might as well also try and document the logic
> behind such decisions.

Agreed.

Regards,

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

  reply	other threads:[~2015-10-08 14:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08  6:24 [PATCH v8 0/6] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-10-08  6:24 ` [PATCH 1/6] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-10-08  6:24 ` [PATCH 2/6] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-10-08  6:24 ` [PATCH 3/6] drm/i915: Propagating correct error codes to the userspace ankitprasad.r.sharma
2015-10-08 10:22   ` Tvrtko Ursulin
2015-10-09 15:13     ` Dave Gordon
2015-10-08 10:49   ` Chris Wilson
2015-10-08  6:24 ` [PATCH 4/6] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-10-08 10:43   ` Tvrtko Ursulin
2015-10-08 11:09     ` Chris Wilson
2015-10-08 14:31       ` Tvrtko Ursulin [this message]
2015-10-08 15:08         ` Chris Wilson
2015-10-09  8:13           ` Daniel Vetter
2015-10-09  8:11     ` Daniel Vetter
2015-10-08  6:24 ` [PATCH 5/6] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-10-08 13:56   ` Tvrtko Ursulin
2015-10-28 11:18     ` Ankitprasad Sharma
2015-10-08  6:24 ` [PATCH 6/6] drm/i915: Migrate stolen objects before hibernation ankitprasad.r.sharma
2015-10-08 11:02   ` Chris Wilson
2015-10-13  5:25     ` Ankitprasad Sharma
2015-10-28 11:22     ` Ankitprasad Sharma
  -- strict thread matches above, loose matches on Subject: below --
2015-11-11 10:36 [PATCH v9 0/6] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-11-11 10:36 ` [PATCH 4/6] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-11-13 16:35   ` Tvrtko Ursulin
2015-12-09 12:46 [PATCH v10 0/6] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-12-09 12:46 ` [PATCH 4/6] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-12-09 15:40   ` Tvrtko Ursulin

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=56167E2C.3050806@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=akash.goel@intel.com \
    --cc=ankitprasad.r.sharma@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shashidhar.hiremath@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;
as well as URLs for NNTP newsgroup(s).