[PATCH] drm/i915/gvt: clear the vGPU reset logic

Zhenyu Wang zhenyuw at linux.intel.com
Mon Feb 20 03:04:24 UTC 2017


On 2017.02.20 10:01:22 +0800, Ping Gao wrote:
> Releasing shadow PPGTT pages is not enough when vGPU reset, the
> guest page table tracking data should has same life-cycle with
> all the shadow PPGTT pages; Otherwise there is no chance to
> re-shadow the PPGTT pages without free the guest page table
> tracking data.
> 
> This patch clear the PPGTT reset logic and make the vGPU reset in
> working order.
> 
> Signed-off-by: Ping Gao <ping.a.gao at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/gtt.c | 33 ++++++++++++++++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> index 28c9234..77fe681 100644
> --- a/drivers/gpu/drm/i915/gvt/gtt.c
> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> @@ -2309,6 +2309,36 @@ void intel_vgpu_reset_ggtt(struct intel_vgpu *vgpu)
>  }
>  
>  /**
> + * intel_vgpu_reset_ppgtt - free all the ppgtt entries and the
> + * guest page table tracking data.
> + * @vgpu: a vGPU
> + *
> + * This function is called during vGPU reset.
> + *
> + */
> +static void intel_vgpu_reset_ppgtt(struct intel_vgpu *vgpu)
> +{
> +	struct list_head *pos, *n;
> +	struct intel_vgpu_mm *mm;
> +
> +	ppgtt_free_all_shadow_page(vgpu);
> +
> +	/* The guest page table tracking data should free also after
> +	 * free all the shadow pages, otherwise there is no chance
> +	 * to create those shadow pages again when it's need.
> +	 */
> +	list_for_each_safe(pos, n, &vgpu->gtt.mm_list_head) {
> +		mm = container_of(pos, struct intel_vgpu_mm, list);
> +		if (mm->type == INTEL_GVT_MM_PPGTT) {
> +			vgpu->gvt->gtt.mm_free_page_table(mm);
> +			list_del(&mm->list);
> +			list_del(&mm->lru_list);
> +			kfree(mm);
> +		}
> +	}
> +}
> +

hmm, could we do some refactor cleanup of this with intel_vgpu_clean_gtt()?
Don't like more duplicated code.

> +/**
>   * intel_vgpu_reset_gtt - reset the all GTT related status
>   * @vgpu: a vGPU
>   * @dmlr: true for vGPU Device Model Level Reset, false for GT Reset
> @@ -2321,7 +2351,8 @@ void intel_vgpu_reset_gtt(struct intel_vgpu *vgpu, bool dmlr)
>  {
>  	int i;
>  
> -	ppgtt_free_all_shadow_page(vgpu);
> +	intel_vgpu_reset_ppgtt(vgpu);
> +
>  	if (!dmlr)
>  		return;
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170220/efbae216/attachment.sig>


More information about the intel-gvt-dev mailing list