From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915/userptr: Probe vma range before gup
Date: Tue, 15 Jan 2019 10:40:24 +0000 [thread overview]
Message-ID: <cdf0aee6-1329-8037-d896-3e6a341143a0@linux.intel.com> (raw)
In-Reply-To: <154754825753.30063.4084449652142812295@skylake-alporthouse-com>
On 15/01/2019 10:30, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-01-15 10:19:11)
>>
>> On 14/01/2019 21:17, Chris Wilson wrote:
>>> @@ -620,40 +682,24 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
>>> return -EAGAIN;
>>> }
>>>
>>> - pvec = NULL;
>>> - pinned = 0;
>>> + if (mm == current->mm && try_fast_gup(obj) == 0)
>>> + return 0;
>>
>> Is try_fast_gup guaranteed to fail on ranges probe_range would have
>> rejected?
>
> If a page isn't present, it will fail. For our purposes that means
> fast_gup fails for GGTT mmaps, as well as other ranges.
What if it has been pre-faulted?
>>> - if (mm == current->mm) {
>>> - pvec = kvmalloc_array(num_pages, sizeof(struct page *),
>>> - GFP_KERNEL |
>>> - __GFP_NORETRY |
>>> - __GFP_NOWARN);
>>> - if (pvec) /* defer to worker if malloc fails */
>>> - pinned = __get_user_pages_fast(obj->userptr.ptr,
>>> - num_pages,
>>> - !i915_gem_object_is_readonly(obj),
>>> - pvec);
>>> - }
>>> + /* lockdep doesn't yet automatically allow nesting of readers */
>>> + down_read_nested(&mm->mmap_sem, SINGLE_DEPTH_NESTING);
>>
>> Why is nesting needed - comment needs to explain.
>
> We get called with mm->mmap_sem held for reading on a fault path, and
> without mm->mmap_sem held otherwise. lockdep doesn't allow nesting of
> readers, hence the comment.
Something like that in the comment yes please. :)
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-01-15 10:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 21:17 [PATCH 1/3] drm/i915: Prevent concurrent GGTT update and use on Braswell (again) Chris Wilson
2019-01-14 21:17 ` [PATCH 2/3] drm/i915/userptr: Avoid struct_mutex recursion for mmu_invalidate_range_start Chris Wilson
2019-01-15 9:47 ` Tvrtko Ursulin
2019-01-15 10:00 ` Chris Wilson
2019-01-15 11:25 ` Tvrtko Ursulin
2019-01-15 11:54 ` Tvrtko Ursulin
2019-01-15 11:58 ` Chris Wilson
2019-01-14 21:17 ` [PATCH 3/3] drm/i915/userptr: Probe vma range before gup Chris Wilson
2019-01-15 10:19 ` Tvrtko Ursulin
2019-01-15 10:30 ` Chris Wilson
2019-01-15 10:40 ` Tvrtko Ursulin [this message]
2019-01-15 11:59 ` Chris Wilson
2019-01-15 10:27 ` Tvrtko Ursulin
2019-01-15 10:41 ` Chris Wilson
2019-01-15 10:52 ` Tvrtko Ursulin
2019-01-15 12:03 ` Chris Wilson
2019-01-14 21:32 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Prevent concurrent GGTT update and use on Braswell (again) Patchwork
2019-01-14 21:58 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-15 3:58 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-15 9:04 ` [PATCH 1/3] " Tvrtko Ursulin
2019-01-15 9:28 ` 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=cdf0aee6-1329-8037-d896-3e6a341143a0@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.