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
Subject: Re: [PATCH 12/12] drm/i915: Extend GET_APERTURE ioctl to report size of the stolen region
Date: Thu, 21 Apr 2016 15:52:36 +0100 [thread overview]
Message-ID: <5718E934.7040808@linux.intel.com> (raw)
In-Reply-To: <20160421144122.GW17454@nuc-i3427.alporthouse.com>
On 21/04/16 15:41, Chris Wilson wrote:
> On Thu, Apr 21, 2016 at 03:17:06PM +0100, Tvrtko Ursulin wrote:
>>> +void i915_gem_stolen_size_info(struct drm_i915_private *dev_priv,
>>> + uint64_t *stolen_free,
>>> + uint64_t *stolen_largest)
>>> +{
>>> + struct drm_mm *mm = &dev_priv->mm.stolen;
>>> + struct drm_mm_node *head_node = &mm->head_node;
>>> + struct drm_mm_node *entry;
>>> + uint64_t hole_size, hole_start, hole_end, largest_hole = 0;
>>> + uint64_t total_free = 0;
>>> +
>>> + if (dev_priv->mm.volatile_stolen) {
>>> + *stolen_free = 0;
>>> + *stolen_largest = 0;
>>> + return;
>>> + }
>>> +
>>> + if (head_node->hole_follows) {
>>> + hole_start = drm_mm_hole_node_start(head_node);
>>> + hole_end = drm_mm_hole_node_end(head_node);
>>> + hole_size = hole_end - hole_start;
>>> + total_free += hole_size;
>>> + if (largest_hole < hole_size)
>>> + largest_hole = hole_size;
>>> + }
>>> +
>>
>> Why does this block need to be separately handled and the loop below
>> would not cover it? On first iteration entry will be the head node
>> below as well, no?
>
> Hmm, didn't I/somebody add drm_mm_for_each_hole() ?
I see it in the header, yes.
>>> + *stolen_free = total_free;
>>> + *stolen_largest = largest_hole;
>>> +}
>>> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
>>> index 8f38407..424e57e 100644
>>> --- a/include/uapi/drm/i915_drm.h
>>> +++ b/include/uapi/drm/i915_drm.h
>>> @@ -1012,6 +1012,12 @@ struct drm_i915_gem_get_aperture {
>>> * Total space in the mappable region of the aperture, in bytes
>>> */
>>> __u64 map_total_size;
>>> +
>>> + /**
>>> + * Total space in the stolen region, in bytes
>>> + */
>>> + __u64 stolen_total_size;
>>> +
>>
>> How will the userspace detect existence of the new ioctl fields? Is
>> it intended that they try to call it with a buffer of certain size
>> and act on the failure when that fails? Is that good enough or we
>> need something better like get_param or something?
>
> As we are extending the structure:
>
> 1. Old userspace, old kernel: unaffacted
>
> 2. Old userspace, new kernel:
> Kernel computes the new fields, but the struct is truncated in the copy
> back to userspace. userspace only sees the fields it used to, no change.
>
> 3. New userspace, old kernel:
> Userspace passes in a larger struct, kernel only copies back in the
> fields it knows and zero fills the tail of the user's struct. userspace
> sees a stolen_total_size of 0 and knows to avoid the new interface.
I suppose it doesn't make any practical difference to the driver between
"there is no stolen memory" and "driver does not support stolen memory
query / create".
For mappable region it is a bit weirder because it wouldn't be able to
tell if there is no mappable or no query support so it would potentially
incorrectly avoid mmap_gtt etc.
> 4. New userspace, new kernel:
> Everything explodes^W just works.
>
> In this case, the struct is only an out, so we don't need to do invalid
> pad or flag rejection. We just have the ABI rule that anything the
> kernel doesn't know about is ignored and zero-filled were applicable.
> -Chris
>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-04-21 14:52 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 11:17 [PATCH v19 00/12] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 01/12] drm/i915: Add support for mapping an object page by page ankitprasad.r.sharma
2016-04-20 12:04 ` Chris Wilson
2016-05-24 8:17 ` Ankitprasad Sharma
2016-04-20 11:17 ` [PATCH 02/12] drm/i915: Introduce i915_gem_object_get_dma_address() ankitprasad.r.sharma
2016-04-20 12:08 ` Chris Wilson
2016-04-20 11:17 ` [PATCH 03/12] drm/i915: Use insert_page for pwrite_fast ankitprasad.r.sharma
2016-04-20 13:01 ` kbuild test robot
2016-04-20 11:17 ` [PATCH 04/12] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 05/12] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 06/12] drm/i915: Propagating correct error codes to the userspace ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 07/12] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 08/12] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2016-04-20 12:19 ` Chris Wilson
2016-04-20 11:17 ` [PATCH 09/12] drm/i915: Migrate stolen objects before hibernation ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 10/12] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-04-20 23:15 ` Lukas Wunner
2016-04-20 11:17 ` [PATCH 11/12] drm/i915: Extend GET_APERTURE ioctl to report available map space ankitprasad.r.sharma
2016-04-20 13:02 ` [PATCH] drm/i915: fix semicolon.cocci warnings kbuild test robot
2016-04-20 13:02 ` [PATCH 11/12] drm/i915: Extend GET_APERTURE ioctl to report available map space kbuild test robot
2016-04-21 14:04 ` Tvrtko Ursulin
2016-04-21 14:46 ` Chris Wilson
2016-04-21 14:59 ` Tvrtko Ursulin
2016-04-25 10:35 ` Ankitprasad Sharma
2016-04-25 14:51 ` Tvrtko Ursulin
2016-04-26 9:44 ` Chris Wilson
2016-04-28 9:30 ` Tvrtko Ursulin
2016-04-28 10:24 ` Chris Wilson
2016-04-29 10:06 ` Tvrtko Ursulin
2016-04-29 10:18 ` Chris Wilson
2016-04-29 10:26 ` Tvrtko Ursulin
2016-04-29 10:39 ` Chris Wilson
2016-04-29 10:56 ` Tvrtko Ursulin
2016-04-29 11:03 ` Chris Wilson
2016-04-20 11:17 ` [PATCH 12/12] drm/i915: Extend GET_APERTURE ioctl to report size of the stolen region ankitprasad.r.sharma
2016-04-21 14:17 ` Tvrtko Ursulin
2016-04-21 14:41 ` Chris Wilson
2016-04-21 14:52 ` Tvrtko Ursulin [this message]
2016-04-20 16:28 ` ✗ Fi.CI.BAT: failure for Support for creating/using Stolen memory backed objects (rev13) Patchwork
2016-04-28 10:20 ` Tvrtko Ursulin
2016-04-24 14:58 ` ✓ Fi.CI.BAT: success " Patchwork
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=5718E934.7040808@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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).