All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org,
	akash.goel@intel.com, shashidhar.hiremath@intel.com
Subject: Re: [PATCH 2/9] drm/i915: Use insert_page for pwrite_fast
Date: Thu, 17 Dec 2015 11:19:55 +0000	[thread overview]
Message-ID: <20151217111955.GA22950@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <5672923B.3000305@linux.intel.com>

On Thu, Dec 17, 2015 at 10:45:15AM +0000, Tvrtko Ursulin wrote:
> 
> Hi,
> 
> On 14/12/15 05:46, ankitprasad.r.sharma@intel.com wrote:
> >From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> >
> >In pwrite_fast, map an object page by page if obj_ggtt_pin fails. First,
> >we try a nonblocking pin for the whole object (since that is fastest if
> >reused), then failing that we try to grab one page in the mappable
> >aperture. It also allows us to handle objects larger than the mappable
> >aperture (e.g. if we need to pwrite with vGPU restricting the aperture
> >to a measely 8MiB or something like that).
> >
> >v2: Pin pages before starting pwrite, Combined duplicate loops (Chris)
> >
> >v3: Combined loops based on local patch by Chris (Chris)
> >
> >v4: Added i915 wrapper function for drm_mm_insert_node_in_range (Chris)
> >
> >Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> >Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >---
> >  drivers/gpu/drm/i915/i915_gem.c | 86 ++++++++++++++++++++++++++++++-----------
> >  1 file changed, 64 insertions(+), 22 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> >index bf7f203..46c1e75 100644
> >--- a/drivers/gpu/drm/i915/i915_gem.c
> >+++ b/drivers/gpu/drm/i915/i915_gem.c
> >@@ -61,6 +61,21 @@ static bool cpu_write_needs_clflush(struct drm_i915_gem_object *obj)
> >  	return obj->pin_display;
> >  }
> >
> >+static int
> >+i915_gem_insert_node_in_range(struct drm_i915_private *i915,
> >+			      struct drm_mm_node *node, u64 size,
> >+			      unsigned alignment, u64 start, u64 end)
> >+{
> >+	int ret;
> >+
> >+	ret = drm_mm_insert_node_in_range_generic(&i915->gtt.base.mm, node,
> >+						  size, alignment, 0, start,
> >+						  end, DRM_MM_SEARCH_DEFAULT,
> >+						  DRM_MM_SEARCH_DEFAULT);
> >+
> >+	return ret;
> >+}
> >+
> >  /* some bookkeeping */
> >  static void i915_gem_info_add_obj(struct drm_i915_private *dev_priv,
> >  				  size_t size)
> >@@ -760,20 +775,29 @@ fast_user_write(struct io_mapping *mapping,
> >   * user into the GTT, uncached.
> >   */
> >  static int
> >-i915_gem_gtt_pwrite_fast(struct drm_device *dev,
> >+i915_gem_gtt_pwrite_fast(struct drm_i915_private *i915,
> >  			 struct drm_i915_gem_object *obj,
> >  			 struct drm_i915_gem_pwrite *args,
> >  			 struct drm_file *file)
> >  {
> >-	struct drm_i915_private *dev_priv = dev->dev_private;
> >-	ssize_t remain;
> >-	loff_t offset, page_base;
> >+	struct drm_mm_node node;
> >+	uint64_t remain, offset;
> >  	char __user *user_data;
> >-	int page_offset, page_length, ret;
> >+	int ret;
> >
> >  	ret = i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE | PIN_NONBLOCK);
> >-	if (ret)
> >-		goto out;
> >+	if (ret) {
> >+		memset(&node, 0, sizeof(node));
> >+		ret = i915_gem_insert_node_in_range(i915, &node, 4096, 0,
> >+						    0, i915->gtt.mappable_end);
> 
> Suggest PAGE_SIZE instead of 4096 to match the main loop below.
> 
> >+		if (ret)
> >+			goto out;
> >+
> >+		i915_gem_object_pin_pages(obj);
> 
> i915_gem_object_get_pages is missing again before pin pages I think.

That's due to rebasing my patch where I merge the get_pages call into
pin_pages, sorry.

> If true it means we need an IGT to exercise this path. Should be
> easy with a huge object and just pwrite a small chunk?

Hmm, it should be hit by gem_pwrite/big-gtt + huge-gtt. If not, then we
do indeed more testing.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-12-17 11:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14  5:46 [PATCH v11 0/9] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-12-14  5:46 ` [PATCH 1/9] drm/i915: Allow use of get_dma_address for stolen " ankitprasad.r.sharma
2015-12-17 10:20   ` Tvrtko Ursulin
2015-12-14  5:46 ` [PATCH 2/9] drm/i915: Use insert_page for pwrite_fast ankitprasad.r.sharma
2015-12-14  9:54   ` Chris Wilson
2015-12-14 10:48     ` Chris Wilson
2015-12-14 11:22       ` Chris Wilson
2015-12-17 10:45   ` Tvrtko Ursulin
2015-12-17 11:19     ` Chris Wilson [this message]
2015-12-14  5:46 ` [PATCH 3/9] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-12-14  9:48   ` Chris Wilson
2015-12-17 10:27   ` Tvrtko Ursulin
2015-12-14  5:46 ` [PATCH 4/9] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-12-14 10:05   ` Chris Wilson
2015-12-15  6:10     ` Ankitprasad Sharma
2015-12-14  5:46 ` [PATCH 5/9] drm/i915: Propagating correct error codes to the userspace ankitprasad.r.sharma
2015-12-14 10:10   ` Chris Wilson
2015-12-14  5:46 ` [PATCH 6/9] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-12-14 10:13   ` Chris Wilson
2015-12-17 10:51   ` Tvrtko Ursulin
2015-12-14  5:46 ` [PATCH 7/9] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-12-14  9:43   ` Chris Wilson
2015-12-14  5:46 ` [PATCH 8/9] drm/i915: Migrate stolen objects before hibernation ankitprasad.r.sharma
2015-12-14 10:31   ` Chris Wilson
2015-12-14  5:46 ` [PATCH 9/9] drm/i915: Fail the execbuff using stolen objects as batchbuffers ankitprasad.r.sharma
2015-12-14  9:44   ` Chris Wilson
2015-12-15 14:41   ` Dave Gordon
2015-12-15 14:54     ` Chris Wilson
2015-12-15 17:50       ` Dave Gordon
2015-12-16 12:35         ` 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=20151217111955.GA22950@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=akash.goel@intel.com \
    --cc=ankitprasad.r.sharma@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shashidhar.hiremath@intel.com \
    --cc=tvrtko.ursulin@linux.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.