All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/i915: Use pagecache write to prepopulate shmemfs from pwrite-ioctl
Date: Mon, 06 Mar 2017 21:48:31 +0200	[thread overview]
Message-ID: <1488829711.4701.14.camel@linux.intel.com> (raw)
In-Reply-To: <20170306092916.11623-1-chris@chris-wilson.co.uk>

On ma, 2017-03-06 at 09:29 +0000, Chris Wilson wrote:
> Before we instantiate/pin the backing store for our use, we
> can prepopulate the shmemfs filp efficiently using the a
> write into the pagecache. We avoid the penalty of instantiating
> all the pages, important if the user is just writing to a few
> and never uses the object on the GPU, and using a direct write
> into shmemfs allows it to avoid the cost of retrieving a page
> (either swapin or clearing-before-use) before it is overwritten.
> 
> This can be extended later to provide additional specialisation for
> other backends (other than shmemfs).
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=99107
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>

<SNIP>

> +static int
> +i915_gem_object_pwrite_gtt(struct drm_i915_gem_object *obj,
> +			   const struct drm_i915_gem_pwrite *arg)
> +{
> +	struct address_space *mapping = obj->base.filp->f_mapping;
> +	char __user *user_data = u64_to_user_ptr(arg->data_ptr);
> +	u64 remain, offset;
> +	unsigned int pg;
> +
> +	/* Before we instantiate/pin the backing store for our use, we
> +	 * can prepopulate the shmemfs filp efficiently using the a
> +	 * write into the pagecache. We avoid the penalty of instantiating
> +	 * all the pages, important if the user is just writing to a few
> +	 * and never uses the object on the GPU, and using a direct write
> +	 * into shmemfs allows it to avoid the cost of retrieving a page
> +	 * (either swapin or clearing-before-use) before it is overwritten.
> +	 */
> +	if (READ_ONCE(obj->mm.pages))
> +		return -ENODEV;
> +
> +	/* Before the pages are instantioted the object is treated as being

*instantiated

<SNIP>

> +		err = pagecache_write_end(obj->base.filp, mapping, offset,
> +					  len, len - unwritten,
> +					  page, data);

Did you deliberately make the arguments different from write_begin? :)

If this solves a problem;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

But should we instead fix libva?

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-03-06 19:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06  9:29 [PATCH 1/3] drm/i915: Use pagecache write to prepopulate shmemfs from pwrite-ioctl Chris Wilson
2017-03-06  9:29 ` [PATCH 2/3] drm/i915: Wake up all waiters before idling Chris Wilson
2017-03-06 11:02   ` Chris Wilson
2017-03-06 13:47     ` Chris Wilson
2017-03-06  9:29 ` [PATCH 3/3] drm/i915: Take rpm wakelock for releasing the fence on unbind Chris Wilson
2017-03-06 14:03   ` Tvrtko Ursulin
2017-03-06 14:47     ` Chris Wilson
2017-03-06 12:24 ` ✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915: Use pagecache write to prepopulate shmemfs from pwrite-ioctl Patchwork
2017-03-06 12:24 ` [PATCH 1/3] " Tvrtko Ursulin
2017-03-06 12:48   ` Chris Wilson
2017-03-06 13:49     ` Tvrtko Ursulin
2017-03-06 14:14       ` Chris Wilson
2017-03-06 16:32         ` Tvrtko Ursulin
2017-03-06 21:49           ` Chris Wilson
2017-03-07  7:30             ` Tvrtko Ursulin
2017-03-06 19:48 ` Joonas Lahtinen [this message]
2017-03-07  9:55 ` Petri Latvala
2017-03-07 10:22   ` Chris Wilson
2017-03-07 11:46     ` Petri Latvala
2017-03-07 12:02       ` 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=1488829711.4701.14.camel@linux.intel.com \
    --to=joonas.lahtinen@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.