[Intel-gfx] [PATCH] drm/i915: Fix GVT balloon fail path handling

Chris Wilson chris at chris-wilson.co.uk
Mon Jun 10 11:32:08 UTC 2019


Quoting Zhenyu Wang (2019-06-10 10:28:19)
> For any reason if GVT balloon failed, deballoon would be called.
> This adds a simple mask to check validity of balloon spaces. When
> failure happens, that mask is used to track for deballoon, so it
> won't cause any invalid space reference in fail path, which fixed
> kernel oops when balloon error happened.

Against the upstream, it uses an onion unwind. Only those nodes
successfully reserved are removed.

> Signed-off-by: Zhenyu Wang <zhenyuw at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_vgpu.c | 27 +++++++++++++++------------
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
> index 94d3992b599d..5aec34db1aaa 100644
> --- a/drivers/gpu/drm/i915/i915_vgpu.c
> +++ b/drivers/gpu/drm/i915/i915_vgpu.c
> @@ -94,6 +94,7 @@ struct _balloon_info_ {
>          * graphic memory, 2/3 for unmappable graphic memory.
>          */
>         struct drm_mm_node space[4];
> +       u8 valid;
>  };
>  
>  static struct _balloon_info_ bl_info;
> @@ -126,8 +127,12 @@ 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 < 4; i++) {
> +               if (bl_info.valid & BIT(i)) {
> +                       vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
> +                       bl_info.valid &= ~(u8)BIT(i);

Is the problem that you are calling it twice? As far I can see we only
call it from i915_ggtt_cleanup_hw... Oh, note that i915_gem_init_ggtt()
fails to unwind correctly, and intel_vgt_deballoon is called from the
wrong point.

Fwiw, you could just use
	if (!drm_mm_node_alloced(node))
		return;

-Chris


More information about the Intel-gfx mailing list