All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Matthew Auld <matthew.william.auld@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Add lmem fault handler
Date: Fri, 13 Dec 2019 07:39:36 +0200	[thread overview]
Message-ID: <51f2f2da-c60c-2b54-c81a-5f6d6385f0ed@linux.intel.com> (raw)
In-Reply-To: <157616399450.4546.5472279753206797713@skylake-alporthouse-com>



On 12/12/2019 17.19, Chris Wilson wrote:
> Quoting Matthew Auld (2019-12-12 15:11:02)
>> On Thu, 12 Dec 2019 at 14:20, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>>>
>>> Quoting Abdiel Janulgue (2019-12-12 11:34:38)
>>>> Fault handler to handle missing pages for lmem objects.
>>>>
>>>> v3: Add get_vm_cpu_ops, iterate over all memory regions in the
>>>>     lmem selftest, use remap_io_mapping.
>>>>
>>>> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
>>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>>> ---
>>>>  drivers/gpu/drm/i915/gem/i915_gem_lmem.c      |  40 +++++
>>>>  drivers/gpu/drm/i915/gem/i915_gem_lmem.h      |   6 +
>>>>  drivers/gpu/drm/i915/gem/i915_gem_mman.c      |  32 +++-
>>>>  drivers/gpu/drm/i915/gem/i915_gem_mman.h      |   1 +
>>>>  .../drm/i915/gem/selftests/i915_gem_mman.c    | 137 +++++++++++++++---
>>>>  5 files changed, 188 insertions(+), 28 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
>>>> index 0e2bf6b7e143..bbe625935005 100644
>>>> --- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
>>>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
>>>> @@ -6,8 +6,36 @@
>>>>  #include "intel_memory_region.h"
>>>>  #include "gem/i915_gem_region.h"
>>>>  #include "gem/i915_gem_lmem.h"
>>>> +#include "gem/i915_gem_mman.h"
>>>>  #include "i915_drv.h"
>>>>
>>>> +vm_fault_t vm_fault_iomem(struct vm_fault *vmf)
>>>> +{
>>>> +       struct vm_area_struct *area = vmf->vma;
>>>> +       struct i915_mmap_offset *priv = area->vm_private_data;
>>>> +       struct drm_i915_gem_object *obj = priv->obj;
>>>> +       struct intel_memory_region *mem = obj->mm.region;
>>>> +       unsigned long size = area->vm_end - area->vm_start;
>>>> +       bool write = area->vm_flags & VM_WRITE;
>>>> +       int ret;
>>>> +
>>>> +       /* Sanity check that we allow writing into this object */
>>>> +       if (i915_gem_object_is_readonly(obj) && write)
>>>> +               return VM_FAULT_SIGBUS;
>>>> +
>>>> +       ret = i915_gem_object_pin_pages(obj);
>>>> +       if (ret)
>>>> +               return i915_error_to_vmf_fault(ret);
>>>> +
>>>> +       ret = remap_io_mapping(area, area->vm_start,
>>>> +                              i915_gem_object_lmem_io_pfn(obj, 0), size,
>>>> +                              &mem->iomap);
>>>
>>> So this implementation only works with contiguous objects, right?
>>
>> Hmm can't we go back to what we had before, so support !contiguous also?
> 
> The fun part is that you can do both :) Do a discontiguous
> remap_io_mapping() The queue part is that remap_io_mapping() avoids the
> O(N^2), and should give us O(N) instead.

So just to be clear,

if (obj->flags & I915_BO_ALLOC_CONTIGUOUS) {
	remap_io_mapping(...)
} else {
	for(...)
		vmf_insert_pfn()
}

??

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

  reply	other threads:[~2019-12-13  5:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 11:34 [Intel-gfx] [PATCH] drm/i915: Add lmem fault handler Abdiel Janulgue
2019-12-12 11:45 ` Chris Wilson
2019-12-12 14:19 ` Chris Wilson
2019-12-12 15:11   ` Matthew Auld
2019-12-12 15:19     ` Chris Wilson
2019-12-13  5:39       ` Abdiel Janulgue [this message]
2019-12-12 15:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add lmem fault handler (rev3) Patchwork
2019-12-12 16:22 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-12-11  5:59 [Intel-gfx] [PATCH] drm/i915: Add lmem fault handler Abdiel Janulgue
2019-12-11  9:39 ` Chris Wilson
2019-12-11 15:29 ` Chris Wilson
2019-12-13  9:49 ` Dan Carpenter
2019-12-13  9:49   ` Dan Carpenter
2019-12-13  9:49   ` Dan Carpenter
2019-12-05 10:14 Abdiel Janulgue
2019-12-05 10:20 ` Matthew Auld
2019-12-05 10:31   ` 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=51f2f2da-c60c-2b54-c81a-5f6d6385f0ed@linux.intel.com \
    --to=abdiel.janulgue@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.william.auld@gmail.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 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.