All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: Re: [PATCH v2 5/5] drm/i915: Add cpu fault handler for mmap_offset
Date: Mon, 07 Oct 2019 11:20:04 +0100	[thread overview]
Message-ID: <157044360431.2661.4206905363669575919@skylake-alporthouse-com> (raw)
In-Reply-To: <20191007091920.2176-5-abdiel.janulgue@linux.intel.com>

Quoting Abdiel Janulgue (2019-10-07 10:19:20)
> +static vm_fault_t i915_gem_fault_cpu(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;
> +       vm_fault_t vmf_ret;
> +       unsigned long size = area->vm_end - area->vm_start;
> +       bool write = area->vm_flags & VM_WRITE;
> +       int i, 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);
> +
> +       for (i = 0; i < size >> PAGE_SHIFT; i++) {
> +               struct page *page = i915_gem_object_get_page(obj, i);
> +
> +               vmf_ret = vmf_insert_pfn(area,
> +                                        (unsigned long)area->vm_start + i * PAGE_SIZE,
> +                                        page_to_pfn(page));
> +               if (vmf_ret & VM_FAULT_ERROR)
> +                       break;

So why are we using vmf_insert_pfn + VM_PFNMAP for this? It does seem to
be page backed. And since you are prefaulting, you may legitimately try
to double insert the same page and hit an error. You should only bail if
you fail to insert the fault address.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-10-07 10:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07  9:19 [PATCH v2 1/5] drm/i915: Allow i915 to manage the vma offset nodes instead of drm core Abdiel Janulgue
2019-10-07  9:19 ` [PATCH v2 2/5] drm/i915: define HAS_MAPPABLE_APERTURE Abdiel Janulgue
2019-10-07  9:19 ` [PATCH v2 3/5] drm/i915: Introduce DRM_I915_GEM_MMAP_OFFSET Abdiel Janulgue
2019-10-07  9:56   ` Chris Wilson
2019-10-07  9:58   ` Chris Wilson
2019-10-07  9:59   ` Chris Wilson
2019-10-07 10:01   ` Chris Wilson
2019-10-07 16:55   ` Bloomfield, Jon
2019-10-07 20:16     ` Chris Wilson
2019-10-07 20:17       ` Chris Wilson
2019-10-07  9:19 ` [PATCH v2 4/5] drm/i915: cpu-map based dumb buffers Abdiel Janulgue
2019-10-07 10:04   ` Chris Wilson
2019-10-07  9:19 ` [PATCH v2 5/5] drm/i915: Add cpu fault handler for mmap_offset Abdiel Janulgue
2019-10-07 10:10   ` Chris Wilson
2019-10-07 10:20   ` Chris Wilson [this message]
2019-10-07  9:25 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v2,1/5] drm/i915: Allow i915 to manage the vma offset nodes instead of drm core Patchwork
2019-10-07  9:41 ` [PATCH v2 1/5] " Chris Wilson
2019-10-07  9:49 ` ✓ Fi.CI.BAT: success for series starting with [v2,1/5] " Patchwork
2019-10-07 11:17 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-08-26 12:20 [PATCH 1/5] " Abdiel Janulgue
2019-10-07  8:48 ` [PATCH v2 " Abdiel Janulgue
2019-10-07  8:48   ` [PATCH v2 5/5] drm/i915: Add cpu fault handler for mmap_offset Abdiel Janulgue

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=157044360431.2661.4206905363669575919@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=abdiel.janulgue@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@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 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.