From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: "Li, Weinan Z" <weinan.z.li@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"intel-gvt-dev@lists.freedesktop.org"
<intel-gvt-dev@lists.freedesktop.org>
Subject: Re: [PATCH v3] drm/i915/gvt: return the actual aperture size under gvt environment
Date: Mon, 08 May 2017 13:18:38 +0300 [thread overview]
Message-ID: <1494238718.3367.17.camel@linux.intel.com> (raw)
In-Reply-To: <9BD218709B5F2A4F96F08B4A3B98A89768550022@SHSMSX101.ccr.corp.intel.com>
On ma, 2017-05-08 at 02:49 +0000, Li, Weinan Z wrote:
> Hi Joonas/Chris, do you have any comments?
> I've asked OCL team for this patch, they also agree to use available aperture size
> for max allocation buffer definition, code confirmation ongoing.
The patch title should be corrected to refer to usable aperture size.
> > -----Original Message-----
> > From: Li, Weinan Z
> > Sent: Wednesday, May 3, 2017 8:51 AM
> > > > To: intel-gfx@lists.freedesktop.org; intel-gvt-dev@lists.freedesktop.org
> > > > Cc: Li, Weinan Z <weinan.z.li@intel.com>
> > Subject: [PATCH v3] drm/i915/gvt: return the actual aperture size under gvt
> > environment
> >
> > I915_GEM_GET_APERTURE ioctl is used to probe aperture size from userspace.
> > In gvt environment, each vm only use the ballooned part of aperture, so we
> > should return the actual available aperture size exclude the reserved part by
> > balloon.
> >
> > v2: add 'reserved' in struct i915_address_space to record the reserved size in
> > ggtt by balloon.
> >
> > v3: remain aper_size as total, adjust aper_available_size exclude reserved and
> > pinned. UMD driver need to adjust the max allocation size according to the
> > available aperture size but not total size.
> >
> > Signed-off-by: Weinan Li <weinan.z.li@intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_gem.c | 7 +++----
> > drivers/gpu/drm/i915/i915_gem_gtt.h | 3 ++-
> > drivers/gpu/drm/i915/i915_vgpu.c | 5 ++++-
> > 3 files changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c
> > b/drivers/gpu/drm/i915/i915_gem.c index 84ea249..e84576c 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -145,9 +145,8 @@ int i915_mutex_lock_interruptible(struct drm_device
> > *dev)
> > struct i915_ggtt *ggtt = &dev_priv->ggtt;
> > struct drm_i915_gem_get_aperture *args = data;
> > struct i915_vma *vma;
> > - size_t pinned;
> > + size_t pinned = 0;
Don't do this unrelated change.
> >
> > - pinned = 0;
> > mutex_lock(&dev->struct_mutex);
> > list_for_each_entry(vma, &ggtt->base.active_list, vm_link)
> > if (i915_vma_is_pinned(vma))
> > @@ -158,8 +157,8 @@ int i915_mutex_lock_interruptible(struct drm_device
> > *dev)
> > mutex_unlock(&dev->struct_mutex);
> >
> > args->aper_size = ggtt->base.total;
> > - args->aper_available_size = args->aper_size - pinned;
> > -
> > + args->aper_available_size = args->aper_size
> > + - ggtt->base.reserved - pinned;
Wrap the line at '-' mark, just like you would with '+'.
> > return 0;
> > }
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h
> > b/drivers/gpu/drm/i915/i915_gem_gtt.h
> > index fb15684..bdf832d 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> > @@ -255,7 +255,8 @@ struct i915_address_space {
> > struct drm_i915_file_private *file;
> > struct list_head global_link;
> > u64 total; /* size addr space maps (ex. 2GB for ggtt) */
> > -
> > + /* size addr space reserved by GVT balloon, only used for ggtt */
The comment should not be about GVT at all, just any reserved memory.
> > + u64 reserved;
> > bool closed;
<SNIP>
> > @@ -242,6 +242,9 @@ int intel_vgt_balloon(struct drm_i915_private
> > *dev_priv)
> > goto err;
> > }
> >
> > + for (i = 0; i < ARRAY_SIZE(bl_info.space); i++)
> > + ggtt->base.reserved += bl_info.space[i].size;
> > +
There should be an equal decrease when deballooning is done. And for
that to be correct, you need to add proper onion teardown to this
function to make sure the count stays correct (can't call deballoon on
failure or the count will become negative which will result in huge
number marked as reserved).
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
next prev parent reply other threads:[~2017-05-08 10:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 0:51 [PATCH v3] drm/i915/gvt: return the actual aperture size under gvt environment Weinan Li
2017-05-03 1:16 ` ✓ Fi.CI.BAT: success for drm/i915/gvt: return the actual aperture size under gvt environment (rev3) Patchwork
2017-05-08 2:49 ` [PATCH v3] drm/i915/gvt: return the actual aperture size under gvt environment Li, Weinan Z
2017-05-08 10:18 ` Joonas Lahtinen [this message]
2017-05-08 12:10 ` Chris Wilson
2017-05-09 3:22 ` Li, Weinan Z
2017-05-09 3:10 ` Li, Weinan Z
2017-05-09 12:35 ` Joonas Lahtinen
2017-05-10 1:45 ` Li, Weinan Z
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=1494238718.3367.17.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=weinan.z.li@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.