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, stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH v3 2/3] drm/i915: Fix userptr deadlock with aliased GTT mmappings
Date: Thu, 10 Sep 2015 10:44:14 +0100	[thread overview]
Message-ID: <55F150EE.1080503@linux.intel.com> (raw)
In-Reply-To: <20150909150300.GG32324@nuc-i3427.alporthouse.com>


On 09/09/2015 04:03 PM, Chris Wilson wrote:
> On Wed, Sep 09, 2015 at 02:56:16PM +0100, Tvrtko Ursulin wrote:
>>
>> Hi,
>>
>> On 08/10/2015 09:51 AM, Chris Wilson wrote:
>>> +out:
>>>    	drm_free_large(pvec);
>>>    	return ret;
>>> +
>>> +err:
>>> +	/* No pages here, no need for the mmu-notifier to wake us */
>>> +	__i915_gem_userptr_set_active(obj, false);
>>> +err_active:
>>> +	release_pages(pvec, pinned, 0);
>>> +	goto out;
>>>    }
>>
>> I don't like the goto dance. Would something like the below be clearer?
>
> We can condense it if we use a bool active and then feed everything
> through the single exit path:
>
> 	active = false;
>          if (pinned < 0)
>                  ret = pinned, pinned = 0;
>          else if (pinned < num_pages)
>                  ret = __i915_gem_userptr_get_pages_queue(obj, &active);
>          else
>                  ret = __i915_gem_userptr_set_pages(obj, pvec, num_pages);
>          if (ret) {
>                  __i915_gem_userptr_set_active(obj, active);
>                  release_pages(pvec, pinned, 0);
>          }
>          drm_free_large(pvec);
>          return ret;
>
> Not happy with _queue. I guess i915_gem_userptr_get_pages_via_worker()
> is better. Or i915_gem_userptr_get_pages_deferred().

Looks much better on a glance. If release_pages with pinned = 0 is OK.

For the queueue/via_worker/deferred maybe _schedule_get_pages_worker?

Tvrtko

  reply	other threads:[~2015-09-10  9:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10  8:51 [PATCH v3 1/3] drm/i915: Only update the current userptr worker Chris Wilson
2015-08-10  8:51 ` [PATCH v3 2/3] drm/i915: Fix userptr deadlock with aliased GTT mmappings Chris Wilson
2015-09-09 13:56   ` [Intel-gfx] " Tvrtko Ursulin
2015-09-09 15:03     ` Chris Wilson
2015-09-10  9:44       ` Tvrtko Ursulin [this message]
2015-09-10  9:51         ` Chris Wilson
2015-08-10  8:51 ` [PATCH v3 3/3] drm/i915: Use a task to cancel the userptr on invalidate_range Chris Wilson
2015-09-09 14:45   ` Tvrtko Ursulin
2015-09-09 15:08     ` Chris Wilson
2015-09-09 15:20       ` Tvrtko Ursulin
2015-09-09 15:42         ` Chris Wilson
2015-09-10  9:50           ` Tvrtko Ursulin
2015-09-09 10:39 ` [PATCH v3 1/3] drm/i915: Only update the current userptr worker Tvrtko Ursulin
2015-09-09 10:44   ` Chris Wilson

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=55F150EE.1080503@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@vger.kernel.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