All of lore.kernel.org
 help / color / mirror / Atom feed
* ✓ Fi.CI.BAT: success for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-29 10:58 [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
@ 2018-03-29  2:33 ` Patchwork
  2018-03-29  8:27 ` [PATCH] " Chris Wilson
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-03-29  2:33 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
URL   : https://patchwork.freedesktop.org/series/40851/
State : success

== Summary ==

Series 40851v1 drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
https://patchwork.freedesktop.org/api/1.0/series/40851/revisions/1/mbox/

---- Possible new issues:

Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-a-frame-sequence:
                fail       -> PASS       (fi-cfl-s3)
        Subgroup read-crc-pipe-c-frame-sequence:
                fail       -> PASS       (fi-cfl-s3)

---- Known issues:

Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (fi-cfl-s3) fdo#100368

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:429s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:379s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:296s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:514s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:515s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:518s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:508s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:409s
fi-cfl-s3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:560s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:512s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:584s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:417s
fi-gdg-551       total:285  pass:177  dwarn:0   dfail:0   fail:0   skip:108 time:318s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:535s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:404s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:422s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:461s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:431s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:473s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:462s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:512s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:662s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:443s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:530s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:506s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:520s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:431s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:442s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:560s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:401s
Blacklisted hosts:
fi-cnl-psr       total:285  pass:256  dwarn:3   dfail:0   fail:0   skip:26  time:520s
fi-glk-j4005     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:484s

4668e88d66074a81aae645e0db0391e7ea9afe8a drm-tip: 2018y-03m-28d-20h-45m-29s UTC integration manifest
551f74e986ee drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8527/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-29 10:58 [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
  2018-03-29  2:33 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-03-29  8:27 ` Chris Wilson
  2018-03-29  8:55   ` Zhang, Xiong Y
  2018-04-02  8:34   ` [PATCH v2] " Xiong Zhang
  2018-03-29  9:44 ` [PATCH] " Joonas Lahtinen
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 13+ messages in thread
From: Chris Wilson @ 2018-03-29  8:27 UTC (permalink / raw)
  To: Xiong Zhang, intel-gvt-dev, intel-gfx

Quoting Xiong Zhang (2018-03-29 11:58:41)
> Four drm_mm_node are used to reserve guest ggtt space, but some of them
> may aren't initialized and used in intel_vgt_balloon(), so these unused

may be skipped and not initialised due to space constraints, 

> drm_mm_node couldn't be removed through drm_mm_remove_node().
> 
> Fixes: ff8f797557c7("drm/i915: return the correct usable aperture size under gvt environment")
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>

Had to read through and work out what the problem was; whether it was
a bug elsewhere in vgpu or deliberate, so amending the commit msg to be
clear would be helpful.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Who actually consumes bl_info? It just looks like being a balloon being
set adrift.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-29  8:27 ` [PATCH] " Chris Wilson
@ 2018-03-29  8:55   ` Zhang, Xiong Y
  2018-04-02  8:34   ` [PATCH v2] " Xiong Zhang
  1 sibling, 0 replies; 13+ messages in thread
From: Zhang, Xiong Y @ 2018-03-29  8:55 UTC (permalink / raw)
  To: Chris Wilson, intel-gvt-dev, intel-gfx

> Quoting Xiong Zhang (2018-03-29 11:58:41)
> > Four drm_mm_node are used to reserve guest ggtt space, but some of
> > them may aren't initialized and used in intel_vgt_balloon(), so these
> > unused
> 
> may be skipped and not initialised due to space constraints,
[Zhang, Xiong Y] OK, I will apply it. thanks
> 
> > drm_mm_node couldn't be removed through drm_mm_remove_node().
> >
> > Fixes: ff8f797557c7("drm/i915: return the correct usable aperture size
> > under gvt environment")
> > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> 
> Had to read through and work out what the problem was; whether it was a
> bug elsewhere in vgpu or deliberate, so amending the commit msg to be
> clear would be helpful.
[Zhang, Xiong Y] bl_info.space[i] is initialized only on specific condition in intel_vgt_balloon(). When guest i915 driver is unloaded, intel_vgt_deballon() go through all four bl_info.space[3:0] and call drm_mm_remove_node() for each. If one isn't initialized, warning and reference null pointer occur in drm_mm_remove_node().
I will update commit message. Thanks.
> 
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Who actually consumes bl_info? It just looks like being a balloon being set
> adrift.
[Zhang, Xiong Y] bl_info is internal static variable, only intel_vgt_deballoon() consume it at driver unload, it deballoon reserved ggtt space. 
> -Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-29 10:58 [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
  2018-03-29  2:33 ` ✓ Fi.CI.BAT: success for " Patchwork
  2018-03-29  8:27 ` [PATCH] " Chris Wilson
@ 2018-03-29  9:44 ` Joonas Lahtinen
  2018-03-30  7:01   ` Zhang, Xiong Y
  2018-04-02  8:37   ` [PATCH] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct Xiong Zhang
  2018-03-29 11:01 ` ✗ Fi.CI.IGT: failure for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Patchwork
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 13+ messages in thread
From: Joonas Lahtinen @ 2018-03-29  9:44 UTC (permalink / raw)
  To: Xiong Zhang, intel-gfx, intel-gvt-dev

+ Zhi and Zhenyu

Quoting Xiong Zhang (2018-03-29 13:58:41)
> Four drm_mm_node are used to reserve guest ggtt space, but some of them
> may aren't initialized and used in intel_vgt_balloon(), so these unused
> drm_mm_node couldn't be removed through drm_mm_remove_node().

I'm not sure how this slipped by in previous review, but is there an
explanation why we have;

static struct _balloon_info_ bl_info;

... and are not even initializing it?

This should definitely find it's way into dev_priv and be properly
initialized.

Regards, Joonas

> 
> Fixes: ff8f797557c7("drm/i915: return the correct usable aperture size under gvt environment")
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_vgpu.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
> index 5fe9f3f..7545686 100644
> --- a/drivers/gpu/drm/i915/i915_vgpu.c
> +++ b/drivers/gpu/drm/i915/i915_vgpu.c
> @@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info;
>  static void vgt_deballoon_space(struct i915_ggtt *ggtt,
>                                 struct drm_mm_node *node)
>  {
> +       if (!node->allocated)
> +               return;
> +
>         DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n",
>                          node->start,
>                          node->start + node->size,
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
@ 2018-03-29 10:58 Xiong Zhang
  2018-03-29  2:33 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Xiong Zhang @ 2018-03-29 10:58 UTC (permalink / raw)
  To: intel-gvt-dev, intel-gfx

Four drm_mm_node are used to reserve guest ggtt space, but some of them
may aren't initialized and used in intel_vgt_balloon(), so these unused
drm_mm_node couldn't be removed through drm_mm_remove_node().

Fixes: ff8f797557c7("drm/i915: return the correct usable aperture size under gvt environment")
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
---
 drivers/gpu/drm/i915/i915_vgpu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 5fe9f3f..7545686 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info;
 static void vgt_deballoon_space(struct i915_ggtt *ggtt,
 				struct drm_mm_node *node)
 {
+	if (!node->allocated)
+		return;
+
 	DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n",
 			 node->start,
 			 node->start + node->size,
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* ✗ Fi.CI.IGT: failure for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-29 10:58 [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
                   ` (2 preceding siblings ...)
  2018-03-29  9:44 ` [PATCH] " Joonas Lahtinen
@ 2018-03-29 11:01 ` Patchwork
  2018-04-02  8:55 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev3) Patchwork
  2018-04-02  9:12 ` ✗ Fi.CI.BAT: failure " Patchwork
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-03-29 11:01 UTC (permalink / raw)
  To: Zhang, Xiong Y; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
URL   : https://patchwork.freedesktop.org/series/40851/
State : failure

== Summary ==

---- Possible new issues:

Test drm_read:
        Subgroup empty-nonblock:
                pass       -> FAIL       (shard-snb)
Test kms_chv_cursor_fail:
        Subgroup pipe-a-128x128-right-edge:
                pass       -> FAIL       (shard-snb)
Test kms_cursor_crc:
        Subgroup cursor-256x256-sliding:
                pass       -> FAIL       (shard-snb)
        Subgroup cursor-64x64-random:
                pass       -> FAIL       (shard-snb)
Test kms_flip:
        Subgroup flip-vs-dpms-off-vs-modeset-interruptible:
                pass       -> DMESG-WARN (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbcpsr-1p-primscrn-cur-indfb-onoff:
                skip       -> FAIL       (shard-snb)
        Subgroup fbcpsr-1p-primscrn-spr-indfb-draw-mmap-gtt:
                skip       -> FAIL       (shard-snb)
        Subgroup fbcpsr-2p-primscrn-spr-indfb-draw-render:
                skip       -> FAIL       (shard-snb)
        Subgroup fbcpsr-2p-scndscrn-spr-indfb-draw-mmap-gtt:
                skip       -> FAIL       (shard-snb)
        Subgroup fbcpsr-2p-scndscrn-spr-indfb-fullscreen:
                skip       -> FAIL       (shard-snb)
        Subgroup fbcpsr-badstride:
                skip       -> FAIL       (shard-snb)
Test kms_plane:
        Subgroup plane-panning-bottom-right-pipe-b-planes:
                pass       -> FAIL       (shard-snb)
Test kms_universal_plane:
        Subgroup disable-primary-vs-flip-pipe-a:
                pass       -> FAIL       (shard-snb)

---- Known issues:

Test kms_cursor_crc:
        Subgroup cursor-64x64-suspend:
                incomplete -> PASS       (shard-hsw) fdo#103540
Test kms_flip:
        Subgroup 2x-flip-vs-expired-vblank:
                fail       -> PASS       (shard-hsw) fdo#102887
        Subgroup dpms-vs-vblank-race:
                fail       -> PASS       (shard-hsw) fdo#103060
        Subgroup plain-flip-ts-check:
                fail       -> PASS       (shard-hsw) fdo#100368
Test kms_frontbuffer_tracking:
        Subgroup fbc-2p-scndscrn-shrfb-pgflip-blt:
                skip       -> FAIL       (shard-snb) fdo#103167 +2
Test kms_plane:
        Subgroup plane-panning-bottom-right-suspend-pipe-a-planes:
                pass       -> FAIL       (shard-snb) fdo#103375
Test kms_rotation_crc:
        Subgroup sprite-rotation-180:
                pass       -> FAIL       (shard-snb) fdo#103925
Test kms_vblank:
        Subgroup pipe-a-accuracy-idle:
                fail       -> PASS       (shard-hsw) fdo#102583

fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583

shard-apl        total:3495 pass:1831 dwarn:1   dfail:0   fail:7   skip:1655 time:12858s
shard-hsw        total:3495 pass:1782 dwarn:2   dfail:0   fail:1   skip:1709 time:11525s
shard-snb        total:3495 pass:1366 dwarn:1   dfail:0   fail:30  skip:2098 time:6870s
Blacklisted hosts:
shard-kbl        total:3495 pass:1958 dwarn:1   dfail:1   fail:7   skip:1528 time:9214s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8527/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-29  9:44 ` [PATCH] " Joonas Lahtinen
@ 2018-03-30  7:01   ` Zhang, Xiong Y
  2018-03-30  7:36     ` Zhenyu Wang
  2018-04-02  8:37   ` [PATCH] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct Xiong Zhang
  1 sibling, 1 reply; 13+ messages in thread
From: Zhang, Xiong Y @ 2018-03-30  7:01 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx, intel-gvt-dev

> + Zhi and Zhenyu
> 
> Quoting Xiong Zhang (2018-03-29 13:58:41)
> > Four drm_mm_node are used to reserve guest ggtt space, but some of
> > them may aren't initialized and used in intel_vgt_balloon(), so these
> > unused drm_mm_node couldn't be removed through
> drm_mm_remove_node().
> 
> I'm not sure how this slipped by in previous review, but is there an
> explanation why we have;
> 
> static struct _balloon_info_ bl_info;
> 
> ... and are not even initializing it?
> 
> This should definitely find it's way into dev_priv and be properly initialized.
[Zhang, Xiong Y] how about move bl_info into struct i915_virtual_gpu ? so that we could get it through dev_priv->vgpu.bl_info

thanks
> 
> Regards, Joonas
> 
> >
> > Fixes: ff8f797557c7("drm/i915: return the correct usable aperture size
> > under gvt environment")
> > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_vgpu.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_vgpu.c
> > b/drivers/gpu/drm/i915/i915_vgpu.c
> > index 5fe9f3f..7545686 100644
> > --- a/drivers/gpu/drm/i915/i915_vgpu.c
> > +++ b/drivers/gpu/drm/i915/i915_vgpu.c
> > @@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info;  static void
> > vgt_deballoon_space(struct i915_ggtt *ggtt,
> >                                 struct drm_mm_node *node)  {
> > +       if (!node->allocated)
> > +               return;
> > +
> >         DRM_DEBUG_DRIVER("deballoon space: range [0x%llx -
> 0x%llx] %llu KiB.\n",
> >                          node->start,
> >                          node->start + node->size,
> > --
> > 2.7.4
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-30  7:01   ` Zhang, Xiong Y
@ 2018-03-30  7:36     ` Zhenyu Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Zhenyu Wang @ 2018-03-30  7:36 UTC (permalink / raw)
  To: Zhang, Xiong Y; +Cc: intel-gfx, intel-gvt-dev


[-- Attachment #1.1: Type: text/plain, Size: 925 bytes --]

On 2018.03.30 07:01:02 +0000, Zhang, Xiong Y wrote:
> > + Zhi and Zhenyu
> > 
> > Quoting Xiong Zhang (2018-03-29 13:58:41)
> > > Four drm_mm_node are used to reserve guest ggtt space, but some of
> > > them may aren't initialized and used in intel_vgt_balloon(), so these
> > > unused drm_mm_node couldn't be removed through
> > drm_mm_remove_node().
> > 
> > I'm not sure how this slipped by in previous review, but is there an
> > explanation why we have;
> > 
> > static struct _balloon_info_ bl_info;
> > 
> > ... and are not even initializing it?
> > 
> > This should definitely find it's way into dev_priv and be properly initialized.
> [Zhang, Xiong Y] how about move bl_info into struct i915_virtual_gpu ? so that we could get it through dev_priv->vgpu.bl_info
> 

yep, seems fine to me.

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
  2018-03-29  8:27 ` [PATCH] " Chris Wilson
  2018-03-29  8:55   ` Zhang, Xiong Y
@ 2018-04-02  8:34   ` Xiong Zhang
  1 sibling, 0 replies; 13+ messages in thread
From: Xiong Zhang @ 2018-04-02  8:34 UTC (permalink / raw)
  To: intel-gvt-dev, intel-gfx

The following call trace may exist in linux guest dmesg when guest i915
driver is unloaded.
[   90.776610] [drm:vgt_deballoon_space.isra.0 [i915]] deballoon space: range [0x0 - 0x0] 0 KiB.
[   90.776621] BUG: unable to handle kernel NULL pointer dereference at 00000000000000c0
[   90.776691] IP: drm_mm_remove_node+0x4d/0x320 [drm]
[   90.776718] PGD 800000012c7d0067 P4D 800000012c7d0067 PUD 138e4c067 PMD 0
[   90.777091] task: ffff9adab60f2f00 task.stack: ffffaf39c0fe0000
[   90.777142] RIP: 0010:drm_mm_remove_node+0x4d/0x320 [drm]
[   90.777573] Call Trace:
[   90.777653]  intel_vgt_deballoon+0x4c/0x60 [i915]
[   90.777729]  i915_ggtt_cleanup_hw+0x121/0x190 [i915]
[   90.777792]  i915_driver_unload+0x145/0x180 [i915]
[   90.777856]  i915_pci_remove+0x15/0x20 [i915]
[   90.777890]  pci_device_remove+0x3b/0xc0
[   90.777916]  device_release_driver_internal+0x157/0x220
[   90.777945]  driver_detach+0x39/0x70
[   90.777967]  bus_remove_driver+0x51/0xd0
[   90.777990]  pci_unregister_driver+0x23/0x90
[   90.778019]  SyS_delete_module+0x1da/0x240
[   90.778045]  entry_SYSCALL_64_fastpath+0x24/0x87
[   90.778072] RIP: 0033:0x7f34312af067
[   90.778092] RSP: 002b:00007ffdea3da0d8 EFLAGS: 00000206
[   90.778297] RIP: drm_mm_remove_node+0x4d/0x320 [drm] RSP: ffffaf39c0fe3dc0
[   90.778344] ---[ end trace f4b1bc8305fc59dd ]---

Four drm_mm_node are used to reserve guest ggtt space, but some of them
may be skipped and not initialised due to space constraints in
intel_vgt_balloon(). If drm_mm_remove_node() is called with
uninitialized drm_mm_node, the above call trace occurs.

This patch check drm_mm_node's validity before calling
drm_mm_remove_node().

v2: Make commit message clear (Chris)

Fixes: ff8f797557c7("drm/i915: return the correct usable aperture size under gvt environment")
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_vgpu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 5fe9f3f..7545686 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info;
 static void vgt_deballoon_space(struct i915_ggtt *ggtt,
 				struct drm_mm_node *node)
 {
+	if (!node->allocated)
+		return;
+
 	DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n",
 			 node->start,
 			 node->start + node->size,
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct
  2018-03-29  9:44 ` [PATCH] " Joonas Lahtinen
  2018-03-30  7:01   ` Zhang, Xiong Y
@ 2018-04-02  8:37   ` Xiong Zhang
  2018-04-03  3:07     ` Zhenyu Wang
  1 sibling, 1 reply; 13+ messages in thread
From: Xiong Zhang @ 2018-04-02  8:37 UTC (permalink / raw)
  To: intel-gvt-dev, intel-gfx

vgpu ballon info consists of four drm_mm_node which is used to reserve
ggtt space, then linux guest won't use these reserved ggtt space.

Each vgpu has its own ballon info, so move ballon info into
i915_virtual_gpu structure.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  | 14 ++++++++++++
 drivers/gpu/drm/i915/i915_vgpu.c | 47 ++++++++++++++++++++--------------------
 2 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 800230b..2adc73d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1301,6 +1301,20 @@ struct i915_workarounds {
 struct i915_virtual_gpu {
 	bool active;
 	u32 caps;
+
+	struct balloon_info {
+		/*
+		 * There are up to 2 regions per mappable/unmappable graphic
+		 * memory that might be ballooned. Here, index 0/1 is for
+		 * mappable graphic memory, 2/3 for unmappable graphic memory.
+		 */
+#define VGPU_MAPPABLE_BALLOON_LOW     0
+#define VGPU_MAPPABLE_BALLOON_HIGH    1
+#define VGPU_UNMAPPABLE_BALLOON_LOW   2
+#define VGPU_UNMAPPABLE_BALLOON_HIGH  3
+#define VGPU_MAX_BALLOON_NUM          4
+		struct drm_mm_node space[VGPU_MAX_BALLOON_NUM];
+	} bl_info;
 };
 
 /* used in computing the new watermarks state */
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 7545686..79d3df4 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -86,17 +86,6 @@ bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv)
 	return dev_priv->vgpu.caps & VGT_CAPS_FULL_48BIT_PPGTT;
 }
 
-struct _balloon_info_ {
-	/*
-	 * There are up to 2 regions per mappable/unmappable graphic
-	 * memory that might be ballooned. Here, index 0/1 is for mappable
-	 * graphic memory, 2/3 for unmappable graphic memory.
-	 */
-	struct drm_mm_node space[4];
-};
-
-static struct _balloon_info_ bl_info;
-
 static void vgt_deballoon_space(struct i915_ggtt *ggtt,
 				struct drm_mm_node *node)
 {
@@ -128,8 +117,9 @@ void intel_vgt_deballoon(struct drm_i915_private *dev_priv)
 
 	DRM_DEBUG("VGT deballoon.\n");
 
-	for (i = 0; i < 4; i++)
-		vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
+	for (i = 0; i < VGPU_MAX_BALLOON_NUM; i++)
+		vgt_deballoon_space(&dev_priv->ggtt,
+				    &dev_priv->vgpu.bl_info.space[i]);
 }
 
 static int vgt_balloon_space(struct i915_ggtt *ggtt,
@@ -200,6 +190,7 @@ static int vgt_balloon_space(struct i915_ggtt *ggtt,
 int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 {
 	struct i915_ggtt *ggtt = &dev_priv->ggtt;
+	struct balloon_info *bl_info;
 	unsigned long ggtt_end = ggtt->base.total;
 
 	unsigned long mappable_base, mappable_size, mappable_end;
@@ -230,34 +221,39 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 		return -EINVAL;
 	}
 
+	bl_info = &dev_priv->vgpu.bl_info;
 	/* Unmappable graphic memory ballooning */
 	if (unmappable_base > ggtt->mappable_end) {
-		ret = vgt_balloon_space(ggtt, &bl_info.space[2],
-					ggtt->mappable_end, unmappable_base);
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_UNMAPPABLE_BALLOON_LOW],
+			ggtt->mappable_end, unmappable_base);
 
 		if (ret)
 			goto err;
 	}
 
 	if (unmappable_end < ggtt_end) {
-		ret = vgt_balloon_space(ggtt, &bl_info.space[3],
-					unmappable_end, ggtt_end);
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_UNMAPPABLE_BALLOON_HIGH],
+			unmappable_end, ggtt_end);
 		if (ret)
 			goto err_upon_mappable;
 	}
 
 	/* Mappable graphic memory ballooning */
 	if (mappable_base) {
-		ret = vgt_balloon_space(ggtt, &bl_info.space[0],
-					0, mappable_base);
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_MAPPABLE_BALLOON_LOW],
+			0, mappable_base);
 
 		if (ret)
 			goto err_upon_unmappable;
 	}
 
 	if (mappable_end < ggtt->mappable_end) {
-		ret = vgt_balloon_space(ggtt, &bl_info.space[1],
-					mappable_end, ggtt->mappable_end);
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_MAPPABLE_BALLOON_HIGH],
+			mappable_end, ggtt->mappable_end);
 
 		if (ret)
 			goto err_below_mappable;
@@ -267,11 +263,14 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 	return 0;
 
 err_below_mappable:
-	vgt_deballoon_space(ggtt, &bl_info.space[0]);
+	vgt_deballoon_space(ggtt,
+		&bl_info->space[VGPU_MAPPABLE_BALLOON_LOW]);
 err_upon_unmappable:
-	vgt_deballoon_space(ggtt, &bl_info.space[3]);
+	vgt_deballoon_space(ggtt,
+		&bl_info->space[VGPU_UNMAPPABLE_BALLOON_HIGH]);
 err_upon_mappable:
-	vgt_deballoon_space(ggtt, &bl_info.space[2]);
+	vgt_deballoon_space(ggtt,
+		&bl_info->space[VGPU_UNMAPPABLE_BALLOON_LOW]);
 err:
 	DRM_ERROR("VGT balloon fail\n");
 	return ret;
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev3)
  2018-03-29 10:58 [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
                   ` (3 preceding siblings ...)
  2018-03-29 11:01 ` ✗ Fi.CI.IGT: failure for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Patchwork
@ 2018-04-02  8:55 ` Patchwork
  2018-04-02  9:12 ` ✗ Fi.CI.BAT: failure " Patchwork
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-04-02  8:55 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev3)
URL   : https://patchwork.freedesktop.org/series/40851/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
b0bcc0a1ee76 drm/i915: Move vgpu balloon info into i915_virtual_gpu struct
-:91: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#91: FILE: drivers/gpu/drm/i915/i915_vgpu.c:225:
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_UNMAPPABLE_BALLOON_LOW],

-:102: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#102: FILE: drivers/gpu/drm/i915/i915_vgpu.c:234:
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_UNMAPPABLE_BALLOON_HIGH],

-:113: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#113: FILE: drivers/gpu/drm/i915/i915_vgpu.c:243:
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_MAPPABLE_BALLOON_LOW],

-:124: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#124: FILE: drivers/gpu/drm/i915/i915_vgpu.c:252:
+		ret = vgt_balloon_space(ggtt,
+			&bl_info->space[VGPU_MAPPABLE_BALLOON_HIGH],

-:135: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#135: FILE: drivers/gpu/drm/i915/i915_vgpu.c:264:
+	vgt_deballoon_space(ggtt,
+		&bl_info->space[VGPU_MAPPABLE_BALLOON_LOW]);

-:139: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#139: FILE: drivers/gpu/drm/i915/i915_vgpu.c:267:
+	vgt_deballoon_space(ggtt,
+		&bl_info->space[VGPU_UNMAPPABLE_BALLOON_HIGH]);

-:143: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#143: FILE: drivers/gpu/drm/i915/i915_vgpu.c:270:
+	vgt_deballoon_space(ggtt,
+		&bl_info->space[VGPU_UNMAPPABLE_BALLOON_LOW]);

total: 0 errors, 0 warnings, 7 checks, 119 lines checked

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev3)
  2018-03-29 10:58 [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
                   ` (4 preceding siblings ...)
  2018-04-02  8:55 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev3) Patchwork
@ 2018-04-02  9:12 ` Patchwork
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-04-02  9:12 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev3)
URL   : https://patchwork.freedesktop.org/series/40851/
State : failure

== Summary ==

Series 40851v3 drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest
https://patchwork.freedesktop.org/api/1.0/series/40851/revisions/3/mbox/

---- Possible new issues:

Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (fi-blb-e6850)

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:429s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:441s
fi-blb-e6850     total:285  pass:219  dwarn:1   dfail:0   fail:1   skip:64  time:378s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:533s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:297s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:514s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:515s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:524s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:512s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:411s
fi-cfl-s3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:563s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:514s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:581s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:424s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:321s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:540s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:410s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:423s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:471s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:432s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:471s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:468s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:515s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:661s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:440s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:534s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:509s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:513s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:433s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:444s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:593s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:400s
Blacklisted hosts:
fi-cnl-psr       total:285  pass:256  dwarn:3   dfail:0   fail:0   skip:26  time:525s
fi-glk-j4005     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:485s

c46052cde6a50c5459e00791ffc4d5aa1ec58a9e drm-tip: 2018y-03m-30d-18h-56m-26s UTC integration manifest
b0bcc0a1ee76 drm/i915: Move vgpu balloon info into i915_virtual_gpu struct

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8559/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct
  2018-04-02  8:37   ` [PATCH] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct Xiong Zhang
@ 2018-04-03  3:07     ` Zhenyu Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Zhenyu Wang @ 2018-04-03  3:07 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx, intel-gvt-dev


[-- Attachment #1.1: Type: text/plain, Size: 5558 bytes --]

On 2018.04.02 16:37:55 +0800, Xiong Zhang wrote:
> vgpu ballon info consists of four drm_mm_node which is used to reserve
> ggtt space, then linux guest won't use these reserved ggtt space.
> 
> Each vgpu has its own ballon info, so move ballon info into
> i915_virtual_gpu structure.
> 
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> ---

Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>

>  drivers/gpu/drm/i915/i915_drv.h  | 14 ++++++++++++
>  drivers/gpu/drm/i915/i915_vgpu.c | 47 ++++++++++++++++++++--------------------
>  2 files changed, 37 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 800230b..2adc73d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1301,6 +1301,20 @@ struct i915_workarounds {
>  struct i915_virtual_gpu {
>  	bool active;
>  	u32 caps;
> +
> +	struct balloon_info {
> +		/*
> +		 * There are up to 2 regions per mappable/unmappable graphic
> +		 * memory that might be ballooned. Here, index 0/1 is for
> +		 * mappable graphic memory, 2/3 for unmappable graphic memory.
> +		 */
> +#define VGPU_MAPPABLE_BALLOON_LOW     0
> +#define VGPU_MAPPABLE_BALLOON_HIGH    1
> +#define VGPU_UNMAPPABLE_BALLOON_LOW   2
> +#define VGPU_UNMAPPABLE_BALLOON_HIGH  3
> +#define VGPU_MAX_BALLOON_NUM          4
> +		struct drm_mm_node space[VGPU_MAX_BALLOON_NUM];
> +	} bl_info;
>  };
>  
>  /* used in computing the new watermarks state */
> diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
> index 7545686..79d3df4 100644
> --- a/drivers/gpu/drm/i915/i915_vgpu.c
> +++ b/drivers/gpu/drm/i915/i915_vgpu.c
> @@ -86,17 +86,6 @@ bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv)
>  	return dev_priv->vgpu.caps & VGT_CAPS_FULL_48BIT_PPGTT;
>  }
>  
> -struct _balloon_info_ {
> -	/*
> -	 * There are up to 2 regions per mappable/unmappable graphic
> -	 * memory that might be ballooned. Here, index 0/1 is for mappable
> -	 * graphic memory, 2/3 for unmappable graphic memory.
> -	 */
> -	struct drm_mm_node space[4];
> -};
> -
> -static struct _balloon_info_ bl_info;
> -
>  static void vgt_deballoon_space(struct i915_ggtt *ggtt,
>  				struct drm_mm_node *node)
>  {
> @@ -128,8 +117,9 @@ void intel_vgt_deballoon(struct drm_i915_private *dev_priv)
>  
>  	DRM_DEBUG("VGT deballoon.\n");
>  
> -	for (i = 0; i < 4; i++)
> -		vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
> +	for (i = 0; i < VGPU_MAX_BALLOON_NUM; i++)
> +		vgt_deballoon_space(&dev_priv->ggtt,
> +				    &dev_priv->vgpu.bl_info.space[i]);
>  }
>  
>  static int vgt_balloon_space(struct i915_ggtt *ggtt,
> @@ -200,6 +190,7 @@ static int vgt_balloon_space(struct i915_ggtt *ggtt,
>  int intel_vgt_balloon(struct drm_i915_private *dev_priv)
>  {
>  	struct i915_ggtt *ggtt = &dev_priv->ggtt;
> +	struct balloon_info *bl_info;
>  	unsigned long ggtt_end = ggtt->base.total;
>  
>  	unsigned long mappable_base, mappable_size, mappable_end;
> @@ -230,34 +221,39 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
>  		return -EINVAL;
>  	}
>  
> +	bl_info = &dev_priv->vgpu.bl_info;
>  	/* Unmappable graphic memory ballooning */
>  	if (unmappable_base > ggtt->mappable_end) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[2],
> -					ggtt->mappable_end, unmappable_base);
> +		ret = vgt_balloon_space(ggtt,
> +			&bl_info->space[VGPU_UNMAPPABLE_BALLOON_LOW],
> +			ggtt->mappable_end, unmappable_base);
>  
>  		if (ret)
>  			goto err;
>  	}
>  
>  	if (unmappable_end < ggtt_end) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[3],
> -					unmappable_end, ggtt_end);
> +		ret = vgt_balloon_space(ggtt,
> +			&bl_info->space[VGPU_UNMAPPABLE_BALLOON_HIGH],
> +			unmappable_end, ggtt_end);
>  		if (ret)
>  			goto err_upon_mappable;
>  	}
>  
>  	/* Mappable graphic memory ballooning */
>  	if (mappable_base) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[0],
> -					0, mappable_base);
> +		ret = vgt_balloon_space(ggtt,
> +			&bl_info->space[VGPU_MAPPABLE_BALLOON_LOW],
> +			0, mappable_base);
>  
>  		if (ret)
>  			goto err_upon_unmappable;
>  	}
>  
>  	if (mappable_end < ggtt->mappable_end) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[1],
> -					mappable_end, ggtt->mappable_end);
> +		ret = vgt_balloon_space(ggtt,
> +			&bl_info->space[VGPU_MAPPABLE_BALLOON_HIGH],
> +			mappable_end, ggtt->mappable_end);
>  
>  		if (ret)
>  			goto err_below_mappable;
> @@ -267,11 +263,14 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
>  	return 0;
>  
>  err_below_mappable:
> -	vgt_deballoon_space(ggtt, &bl_info.space[0]);
> +	vgt_deballoon_space(ggtt,
> +		&bl_info->space[VGPU_MAPPABLE_BALLOON_LOW]);
>  err_upon_unmappable:
> -	vgt_deballoon_space(ggtt, &bl_info.space[3]);
> +	vgt_deballoon_space(ggtt,
> +		&bl_info->space[VGPU_UNMAPPABLE_BALLOON_HIGH]);
>  err_upon_mappable:
> -	vgt_deballoon_space(ggtt, &bl_info.space[2]);
> +	vgt_deballoon_space(ggtt,
> +		&bl_info->space[VGPU_UNMAPPABLE_BALLOON_LOW]);
>  err:
>  	DRM_ERROR("VGT balloon fail\n");
>  	return ret;
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-04-03  3:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29 10:58 [PATCH] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
2018-03-29  2:33 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-03-29  8:27 ` [PATCH] " Chris Wilson
2018-03-29  8:55   ` Zhang, Xiong Y
2018-04-02  8:34   ` [PATCH v2] " Xiong Zhang
2018-03-29  9:44 ` [PATCH] " Joonas Lahtinen
2018-03-30  7:01   ` Zhang, Xiong Y
2018-03-30  7:36     ` Zhenyu Wang
2018-04-02  8:37   ` [PATCH] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct Xiong Zhang
2018-04-03  3:07     ` Zhenyu Wang
2018-03-29 11:01 ` ✗ Fi.CI.IGT: failure for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Patchwork
2018-04-02  8:55 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev3) Patchwork
2018-04-02  9:12 ` ✗ Fi.CI.BAT: failure " Patchwork

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.