All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org,
	akash.goel@intel.com, shashidhar.hiremath@intel.com
Subject: Re: [PATCH 05/11] drm/i915: Support for creating Stolen memory backed objects
Date: Thu, 14 Jan 2016 10:46:39 +0000	[thread overview]
Message-ID: <56977C8F.40304@linux.intel.com> (raw)
In-Reply-To: <20160114102408.GO29867@nuc-i3427.alporthouse.com>


On 14/01/16 10:24, Chris Wilson wrote:
> On Thu, Jan 14, 2016 at 11:46:41AM +0530, ankitprasad.r.sharma@intel.com wrote:
>> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>>
>> Extend the drm_i915_gem_create structure to add support for
>> creating Stolen memory backed objects. Added a new flag through
>> which user can specify the preference to allocate the object from
>> stolen memory, which if set, an attempt will be made to allocate
>> the object from stolen memory subject to the availability of
>> free space in the stolen region.
>>
>> v2: Rebased to the latest drm-intel-nightly (Ankit)
>>
>> v3: Changed versioning of GEM_CREATE param, added new comments (Tvrtko)
>>
>> v4: Changed size from 32b to 64b to prevent userspace overflow (Tvrtko)
>> Corrected function arguments ordering (Chris)
>>
>> v5: Corrected function name (Chris)
>>
>> v6: Updated datatype for flags to keep sizeof(drm_i915_gem_create) u64
>> aligned (Chris)
>>
>> v7: Use first 8 bits of gem_create flags for placement (Chris), Add helper
>> function for object allocation from stolen region (Ankit)
>>
>> Testcase: igt/gem_stolen
>>
>> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
>
>> +	/**
>> +	 * Requested flags (currently used for placement
>> +	 * (which memory domain))
>> +	 *
>> +	 * You can request that the object be created from special memory
>> +	 * rather than regular system pages using this parameter. Such
>> +	 * irregular objects may have certain restrictions (such as CPU
>> +	 * access to a stolen object is verboten).
>> +	 *
>> +	 * This can be used in the future for other purposes too
>> +	 * e.g. specifying tiling/caching/madvise
>> +	 */
>> +	__u64 flags;
>> +#define I915_CREATE_PLACEMENT_NORMAL 	0 /* standard swappable bo  */
>> +#define I915_CREATE_PLACEMENT_STOLEN 	1 /* Cannot use CPU mmaps */
>
> /* Allocate the object from memory reserved for the igfx (stolen).
>   *
>   * Objects allocated from stolen are restricted in the API they can use,
>   * as direct CPU access to stolen memory is prohibited by the system.
>   * This means that you cannot use a regular CPU mmap (either using WB
>   * or with the WC extension). You can still use a GTT mmap, pwrite,
>   * pread and pass it around for use by execbuffer and between processes
>   * like normal.

What happens when a stolen batch buffer gets to relocate_entry_cpu ?

>   *
>   * Stolen memory is a very limited resource and certain functions of the
>   * hardware can only work from within stolen memory. Userspace's
>   * allocations may be evicted from stolen and moved to normal memory as
>   * required. If the allocation is marked as purgeable (using madvise),
>   * the allocation will be dropped and further access to the object's
>   * backing storage will result in -EFAULT. Stolen objects will also be
>   * migrated to normal memory across suspend and resume, as the stolen
>   * memory is not preserved.
>   *
>   * Stolen memory is regarded as a resource placement hint, most suitable
>   * for medium-sized buffers that are only accessed by the GPU and can be
>   * discarded.
>   */

Would it be better if the placement hint did not specifically mention 
stolen memory but specific limitations? Like,

create.flags = NOT_A_BATCHBUFFER | DONT_NEED_MMAP_CPU

?

Regards,

Tvrtko







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

  reply	other threads:[~2016-01-14 10:46 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14  6:16 [PATCH v14 0/11] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-01-14  6:16 ` [PATCH 01/11] drm/i915: Add support for mapping an object page by page ankitprasad.r.sharma
2016-01-14 10:32   ` Tvrtko Ursulin
2016-01-14 13:34     ` Chris Wilson
2016-01-15  9:53       ` Tvrtko Ursulin
2016-01-15 11:44         ` Chris Wilson
2016-01-15 15:15           ` Tvrtko Ursulin
2016-01-14  6:16 ` [PATCH 02/11] drm/i915: Introduce i915_gem_object_get_dma_address() ankitprasad.r.sharma
2016-01-14  6:16 ` [PATCH 03/11] drm/i915: Use insert_page for pwrite_fast ankitprasad.r.sharma
2016-01-14  9:46   ` Chris Wilson
2016-01-14  6:16 ` [PATCH 04/11] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2016-01-14 10:06   ` Chris Wilson
2016-01-14  6:16 ` [PATCH 05/11] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2016-01-14 10:24   ` Chris Wilson
2016-01-14 10:46     ` Tvrtko Ursulin [this message]
2016-01-14 11:14       ` Chris Wilson
2016-01-14 11:27         ` Tvrtko Ursulin
2016-01-14 11:57           ` Chris Wilson
2016-01-14  6:16 ` [PATCH 06/11] drm/i915: Propagating correct error codes to the userspace ankitprasad.r.sharma
2016-01-14 10:25   ` Chris Wilson
2016-01-14  6:16 ` [PATCH 07/11] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2016-01-14  6:16 ` [PATCH 08/11] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2016-01-14 10:51   ` Chris Wilson
2016-01-14  6:16 ` [PATCH 09/11] drm/i915: Migrate stolen objects before hibernation ankitprasad.r.sharma
2016-01-14 10:53   ` Chris Wilson
2016-01-14  6:16 ` [PATCH 10/11] acpi: Export acpi_bus_type ankitprasad.r.sharma
2016-01-14  6:16   ` ankitprasad.r.sharma
2016-01-15 14:51   ` Rafael J. Wysocki
2016-01-18  9:01     ` Ankitprasad Sharma
2016-01-18  9:01       ` Ankitprasad Sharma
2016-01-18 14:57       ` Rafael J. Wysocki
2016-01-18 18:26         ` Lukas Wunner
2016-01-19  8:15           ` Ankitprasad Sharma
2016-01-18 22:28         ` Rafael J. Wysocki
2016-01-18 22:39           ` Lukas Wunner
2016-01-18 22:46             ` Rafael J. Wysocki
2016-01-18 23:00               ` Lukas Wunner
2016-01-18 23:00                 ` Lukas Wunner
2016-01-18 23:59                 ` Rafael J. Wysocki
2016-01-19 16:31                   ` Lukas Wunner
2016-01-19 22:03                     ` Rafael J. Wysocki
2016-01-14  6:16 ` [PATCH 11/11] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-01-14  6:16   ` ankitprasad.r.sharma
2016-01-14 11:20 ` ✗ failure: Fi.CI.BAT Patchwork
2016-05-31  6:19 [PATCH v20 00/11] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-05-31  6:19 ` [PATCH 05/11] drm/i915: Support for creating " ankitprasad.r.sharma
2016-06-08  9:26 [PATCH v21 00/11] Support for creating/using " ankitprasad.r.sharma
2016-06-08  9:26 ` [PATCH 05/11] drm/i915: Support for creating " ankitprasad.r.sharma
2016-06-08 12:20 [PATCH v22 00/11] Support for creating/using " ankitprasad.r.sharma
2016-06-08 12:20 ` [PATCH 05/11] drm/i915: Support for creating " ankitprasad.r.sharma

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=56977C8F.40304@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=akash.goel@intel.com \
    --cc=ankitprasad.r.sharma@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shashidhar.hiremath@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.