* [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment
@ 2017-05-31 2:35 Weinan Li
2017-05-31 3:02 ` ✓ Fi.CI.BAT: success for drm/i915: return the correct usable aperture size under gvt environment (rev2) Patchwork
2017-06-02 10:19 ` [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment Joonas Lahtinen
0 siblings, 2 replies; 4+ messages in thread
From: Weinan Li @ 2017-05-31 2:35 UTC (permalink / raw)
To: intel-gvt-dev, intel-gfx
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 correct available aperture size exclude the reserved part
by balloon.
v2: add 'reserved' in struct i915_address_space to record the reserved size
in ggtt (Chris)
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. KMD return the correct
usable aperture size any time (Chris, Joonas)
v4: decrease reserved in deballoon (Joonas)
v5: add onion teardown in balloon, add vgt_deballoon_space (Joonas)
v6: change title name (Zhenyu)
v7: code style refine (Joonas)
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Weinan Li <weinan.z.li@intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 4 ++--
drivers/gpu/drm/i915/i915_gem_gtt.h | 1 +
drivers/gpu/drm/i915/i915_vgpu.c | 37 ++++++++++++++++++++++++++-----------
3 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 02adf82..fabddb4 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -156,8 +156,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;
return 0;
}
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index fb15684..da9aa9f 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -255,6 +255,7 @@ 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) */
+ u64 reserved; /* size addr space reserved */
bool closed;
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 4ab8a97..efbd37f 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -92,6 +92,16 @@ struct _balloon_info_ {
static struct _balloon_info_ bl_info;
+static void vgt_deballoon_space(struct i915_ggtt *ggtt,
+ struct drm_mm_node *node)
+{
+ DRM_INFO("deballoon space: range [ 0x%llx - 0x%llx ] %llu KiB.\n",
+ node->start, node->start + node->size, node->size / 1024);
+
+ ggtt->base.reserved -= node->size;
+ drm_mm_remove_node(node);
+}
+
/**
* intel_vgt_deballoon - deballoon reserved graphics address trunks
* @dev_priv: i915 device private data
@@ -108,18 +118,15 @@ void intel_vgt_deballoon(struct drm_i915_private *dev_priv)
DRM_DEBUG("VGT deballoon.\n");
- for (i = 0; i < 4; i++) {
- if (bl_info.space[i].allocated)
- drm_mm_remove_node(&bl_info.space[i]);
- }
-
- memset(&bl_info, 0, sizeof(bl_info));
+ for (i = 0; i < 4; i++)
+ vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
}
static int vgt_balloon_space(struct i915_ggtt *ggtt,
struct drm_mm_node *node,
unsigned long start, unsigned long end)
{
+ int ret;
unsigned long size = end - start;
if (start >= end)
@@ -127,9 +134,12 @@ static int vgt_balloon_space(struct i915_ggtt *ggtt,
DRM_INFO("balloon space: range [ 0x%lx - 0x%lx ] %lu KiB.\n",
start, end, size / 1024);
- return i915_gem_gtt_reserve(&ggtt->base, node,
+ ret = i915_gem_gtt_reserve(&ggtt->base, node,
size, start, I915_COLOR_UNEVICTABLE,
0);
+ if (!ret)
+ ggtt->base.reserved += size;
+ return ret;
}
/**
@@ -222,7 +232,7 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
ret = vgt_balloon_space(ggtt, &bl_info.space[3],
unmappable_end, ggtt_end);
if (ret)
- goto err;
+ goto err_upon_mappable;
}
/* Mappable graphic memory ballooning */
@@ -231,7 +241,7 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
0, mappable_base);
if (ret)
- goto err;
+ goto err_upon_unmappable;
}
if (mappable_end < ggtt->mappable_end) {
@@ -239,14 +249,19 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
mappable_end, ggtt->mappable_end);
if (ret)
- goto err;
+ goto err_below_mappable;
}
DRM_INFO("VGT balloon successfully\n");
return 0;
+err_below_mappable:
+ vgt_deballoon_space(ggtt, &bl_info.space[0]);
+err_upon_unmappable:
+ vgt_deballoon_space(ggtt, &bl_info.space[3]);
+err_upon_mappable:
+ vgt_deballoon_space(ggtt, &bl_info.space[2]);
err:
DRM_ERROR("VGT balloon fail\n");
- intel_vgt_deballoon(dev_priv);
return ret;
}
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* ✓ Fi.CI.BAT: success for drm/i915: return the correct usable aperture size under gvt environment (rev2)
2017-05-31 2:35 [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment Weinan Li
@ 2017-05-31 3:02 ` Patchwork
2017-06-02 10:19 ` [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment Joonas Lahtinen
1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2017-05-31 3:02 UTC (permalink / raw)
To: Li, Weinan Z; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: return the correct usable aperture size under gvt environment (rev2)
URL : https://patchwork.freedesktop.org/series/24933/
State : success
== Summary ==
Series 24933v2 drm/i915: return the correct usable aperture size under gvt environment
https://patchwork.freedesktop.org/api/1.0/series/24933/revisions/2/mbox/
Test kms_busy:
Subgroup basic-flip-default-b:
dmesg-warn -> PASS (fi-skl-6700hq) fdo#101144 +2
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-atomic:
fail -> PASS (fi-skl-6700hq) fdo#101154 +7
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-snb-2600) fdo#100215
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fdo#101154 https://bugs.freedesktop.org/show_bug.cgi?id=101154
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:442s
fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:435s
fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:581s
fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:507s
fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:485s
fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:482s
fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:438s
fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:410s
fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:420s
fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:497s
fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:464s
fi-kbl-7500u total:278 pass:255 dwarn:5 dfail:0 fail:0 skip:18 time:461s
fi-kbl-7560u total:278 pass:263 dwarn:5 dfail:0 fail:0 skip:10 time:576s
fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:465s
fi-skl-6700hq total:278 pass:239 dwarn:0 dfail:1 fail:17 skip:21 time:432s
fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:468s
fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:496s
fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:435s
fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:537s
fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:401s
0af3152d8e2034d1491ef8738e7dfc6e08852606 drm-tip: 2017y-05m-30d-17h-20m-32s UTC integration manifest
00f486b drm/i915: return the correct usable aperture size under gvt environment
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4836/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment
2017-05-31 2:35 [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment Weinan Li
2017-05-31 3:02 ` ✓ Fi.CI.BAT: success for drm/i915: return the correct usable aperture size under gvt environment (rev2) Patchwork
@ 2017-06-02 10:19 ` Joonas Lahtinen
2017-06-02 13:51 ` Chris Wilson
1 sibling, 1 reply; 4+ messages in thread
From: Joonas Lahtinen @ 2017-06-02 10:19 UTC (permalink / raw)
To: Weinan Li, intel-gvt-dev, intel-gfx
On ke, 2017-05-31 at 10:35 +0800, Weinan Li wrote:
> 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 correct available aperture size exclude the reserved part
> by balloon.
>
> v2: add 'reserved' in struct i915_address_space to record the reserved size
> in ggtt (Chris)
>
> 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. KMD return the correct
> usable aperture size any time (Chris, Joonas)
>
> v4: decrease reserved in deballoon (Joonas)
>
> v5: add onion teardown in balloon, add vgt_deballoon_space (Joonas)
>
> v6: change title name (Zhenyu)
>
> v7: code style refine (Joonas)
>
> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> Signed-off-by: Weinan Li <weinan.z.li@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Comment below for Chris, if you don't merging this.
<SNIP>
> @@ -127,9 +134,12 @@ static int vgt_balloon_space(struct i915_ggtt *ggtt,
>
> DRM_INFO("balloon space: range [ 0x%lx - 0x%lx ] %lu KiB.\n",
> start, end, size / 1024);
> - return i915_gem_gtt_reserve(&ggtt->base, node,
> + ret = i915_gem_gtt_reserve(&ggtt->base, node,
> size, start, I915_COLOR_UNEVICTABLE,
> 0);
> + if (!ret)
> + ggtt->base.reserved += size;
Add newline here while applying the patch.
Regards, Joonas
> + return ret;
> }
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment
2017-06-02 10:19 ` [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment Joonas Lahtinen
@ 2017-06-02 13:51 ` Chris Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2017-06-02 13:51 UTC (permalink / raw)
To: Joonas Lahtinen, Weinan Li, intel-gvt-dev, intel-gfx
Quoting Joonas Lahtinen (2017-06-02 11:19:13)
> On ke, 2017-05-31 at 10:35 +0800, Weinan Li wrote:
> > 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 correct available aperture size exclude the reserved part
> > by balloon.
> >
> > v2: add 'reserved' in struct i915_address_space to record the reserved size
> > in ggtt (Chris)
> >
> > 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. KMD return the correct
> > usable aperture size any time (Chris, Joonas)
> >
> > v4: decrease reserved in deballoon (Joonas)
> >
> > v5: add onion teardown in balloon, add vgt_deballoon_space (Joonas)
> >
> > v6: change title name (Zhenyu)
> >
> > v7: code style refine (Joonas)
> >
> > Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> > Signed-off-by: Weinan Li <weinan.z.li@intel.com>
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>
> Comment below for Chris, if you don't merging this.
>
> <SNIP>
>
> > @@ -127,9 +134,12 @@ static int vgt_balloon_space(struct i915_ggtt *ggtt,
> >
> > DRM_INFO("balloon space: range [ 0x%lx - 0x%lx ] %lu KiB.\n",
> > start, end, size / 1024);
> > - return i915_gem_gtt_reserve(&ggtt->base, node,
> > + ret = i915_gem_gtt_reserve(&ggtt->base, node,
> > size, start, I915_COLOR_UNEVICTABLE,
> > 0);
> > + if (!ret)
> > + ggtt->base.reserved += size;
>
> Add newline here while applying the patch.
Done after a little fight with dim setup. Thanks for the patch,
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-02 13:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-31 2:35 [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment Weinan Li
2017-05-31 3:02 ` ✓ Fi.CI.BAT: success for drm/i915: return the correct usable aperture size under gvt environment (rev2) Patchwork
2017-06-02 10:19 ` [PATCH v7] drm/i915: return the correct usable aperture size under gvt environment Joonas Lahtinen
2017-06-02 13:51 ` Chris Wilson
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.