drm/i915: return the correct usable aperture size under gvt environment
Subsystems (2)
PATCH v6 1/1 drm/i915: return the correct usable 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 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)
--- drivers/gpu/drm/i915/i915_gem.c | 4 ++-- drivers/gpu/drm/i915/i915_gem_gtt.h | 1 + drivers/gpu/drm/i915/i915_vgpu.c | 44 ++++++++++++++++++++++++++----------- 3 files changed, 34 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
@@ -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 ; }
drivers/gpu/drm/i915/i915_gem_gtt.h +1 -0
@@ -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;
drivers/gpu/drm/i915/i915_vgpu.c +31 -13
99 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: return the correct usable aperture size under gvt environment
== Series Details ==
== Series Details ==
Series: drm/i915: return the correct usable aperture size under gvt environment
URL : https://patchwork.freedesktop.org/series/24933/
State : failure
== Summary ==
Series 24933v1 drm/i915: return the correct usable aperture size under gvt environment
https://patchwork.freedesktop.org/api/1.0/series/24933/revisions/1/mbox/
Test kms_busy:
Subgroup basic-flip-default-a:
pass -> DMESG-WARN (fi-skl-6700hq) fdo#101144 +3
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-atomic:
pass -> FAIL (fi-skl-6700hq)
Subgroup basic-busy-flip-before-cursor-legacy:
pass -> FAIL (fi-skl-6700hq)
Subgroup basic-flip-after-cursor-atomic:
pass -> FAIL (fi-skl-6700hq)
Subgroup basic-flip-after-cursor-legacy:
pass -> FAIL (fi-skl-6700hq)
Subgroup basic-flip-after-cursor-varying-size:
pass -> FAIL (fi-skl-6700hq)
Subgroup basic-flip-before-cursor-atomic:
pass -> FAIL (fi-skl-6700hq)
Subgroup basic-flip-before-cursor-legacy:
pass -> FAIL (fi-skl-6700hq)
Subgroup basic-flip-before-cursor-varying-size:
pass -> FAIL (fi-skl-6700hq)fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:447s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:429s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:571s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:512s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:489s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:478s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:419s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:415s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:419s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:493s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:466s fi-kbl-7500u total:278 pass:255 dwarn:5 dfail:0 fail:0 skip:18 time:465s fi-kbl-7560u total:278 pass:263 dwarn:5 dfail:0 fail:0 skip:10 time:568s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:460s fi-skl-6700hq total:278 pass:228 dwarn:1 dfail:0 fail:27 skip:22 time:406s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:463s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:499s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:436s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:531s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:403s
d47b71fd942d8a88da311863a6cfc2fd73ba1234 drm-tip: 2017y-05m-25d-20h-54m-23s UTC integration manifest c759a4c drm/i915: return the correct usable aperture size under gvt environment
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4813/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerQuoted 25 lines · Weinan Li
I915_GEM_GET_APERTUREioctl 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_spaceto record the reserved size in ggtt (Chris)v3: remain
aper_sizeas total, adjustaper_available_sizeexclude 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)
Suggested-by Chris Wilson <[email protected]>Suggested-by Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Zhenyu Wang <[email protected]>Signed-off-by Weinan Li <[email protected]>
<SNIP>
drivers/gpu/drm/i915/i915_gem.c int i915_mutex_lock_interruptible(struct drm_device *dev) · line 160
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -156,8 +156,8 @@ int i915_mutex_lock_interruptible(struct drm_device *dev) mutex_unlock(&dev->struct_mutex);
args->aper_size=ggtt->base.total;drivers/gpu/drm/i915/i915_gem.c +2
-2- args->aper_available_size = args->aper_size - pinned; - + args->aper_available_size = args->aper_size - + ggtt->base.reserved - pinned;
Wrong indentation here.
drivers/gpu/drm/i915/i915_vgpu.c struct _balloon_info_ { · line 96
Quoted 7 lines
+++
b/drivers/gpu/drm/i915/i915_vgpu.c(quoted diff) +0
-0@@ -92,6 +92,17 @@ struct _balloon_info_ {
static struct _balloon_info_bl_info;drivers/gpu/drm/i915/i915_vgpu.c +2
-0+static void vgt_deballoon_space (struct i915_ggtt *ggtt, + struct drm_mm_node *node)
Ditto.
drivers/gpu/drm/i915/i915_vgpu.c struct _balloon_info_ { · line 103
Quoted 7 lines
drivers/gpu/drm/i915/i915_vgpu.c +7
-0+{ +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); +memset (node,0 ,sizeof (*node));
memset() is not needed.
drivers/gpu/drm/i915/i915_vgpu.c static int vgt_balloon_space(struct i915_ggtt *ggtt, · line 144
Quoted 12 lines
(quoted diff) +0
-0@@ -127,9 +135,14 @@ 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);drivers/gpu/drm/i915/i915_vgpu.c +1
-1- return i915_gem_gtt_reserve(&ggtt->base, node, + ret = i915_gem_gtt_reserve(&ggtt->base, node,size, start,
I915_COLOR_UNEVICTABLE, 0);drivers/gpu/drm/i915/i915_vgpu.c +4
-0+if (!ret) + ggtt->base.reserved += size; +else +memset (node,0 ,sizeof (*node));
memset() is not needed.
drivers/gpu/drm/i915/i915_vgpu.c int intel_vgt_balloon(struct drm_i915_private *dev_priv) · line 231
Quoted 10 lines
drivers/gpu/drm/i915/i915_vgpu.c +1
-0+return ret;}
/**drivers/gpu/drm/i915/i915_vgpu.c +0
-0@@ -215,14 +228,14 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv) ggtt->mappable_end, unmappable_base);
if (ret)drivers/gpu/drm/i915/i915_vgpu.c +1
-1- goto err; + goto err_out;
"err" is a good enough label for last level error path. "out" is used when the path is also taken on a successful call of the function.
Review
Quoted 8 lines
}
if (unmappable_end<ggtt_end) {
ret =vgt_balloon_space(ggtt, &bl_info.space[3], unmappable_end, ggtt_end); if (ret)(quoted diff) +1
-1- goto err; + goto err_deballoon_upon_mappable;
This function is about ballooning, so "deballoon" is bit verbose. Just "err_upon_mappable".
I commented about the whitespace issues and memsets in previous revisions already, so please go through the review comments systematically to expedite further reviews.
Regards, Joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx