[PATCH v3] drm/i915/gvt: replace the gvt_err with gvt_vgpu_err

Zhiyuan Lv zhiyuan.lv at intel.com
Mon Mar 6 02:19:03 UTC 2017


On Sun, Mar 05, 2017 at 08:11:02PM -0500, Tina Zhang wrote:
> gvt_err should be used only for the very few critical error message
> during host i915 drvier initialization. This patch
> 1. removes the redundant gvt_err;
> 2. creates a new gvt_vgpu_err to show errors caused by vgpu;
> 3. replaces the most gvt_err with gvt_vgpu_err;
> 4. leaves very few gvt_err for dumping gvt error during host gvt
>    initialization.
> 
> V2. change name to gvt_vgpu_err and add vgpu id to the message.
> 
> Signed-off-by: Tina Zhang <tina.zhang at intel.com>
> 
> diff --git a/drivers/gpu/drm/i915/gvt/aperture_gm.c b/drivers/gpu/drm/i915/gvt/aperture_gm.c
> index f7bce86..9f01e43 100644
> diff --git a/drivers/gpu/drm/i915/gvt/debug.h b/drivers/gpu/drm/i915/gvt/debug.h

snip

> index 68cba7b..2994f8e 100644
> --- a/drivers/gpu/drm/i915/gvt/debug.h
> +++ b/drivers/gpu/drm/i915/gvt/debug.h
> @@ -27,6 +27,9 @@
>  #define gvt_err(fmt, args...) \
>  	DRM_ERROR("gvt: "fmt, ##args)
>  
> +#define gvt_vgpu_err(fmt, args...) \
> +	DRM_DEBUG_DRIVER("gvt: vgpu %d: "fmt, vgpu->id, ##args)
> +

Need to check "vgpu" not NULL here. Otherwise may introduce crash here by
inproper usage.

>  #define gvt_dbg_core(fmt, args...) \
>  	DRM_DEBUG_DRIVER("gvt: core: "fmt, ##args)
>  

snip

> @@ -259,10 +258,11 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa,
>  		if (gp) {
>  			ret = gp->handler(gp, pa, p_data, bytes);
>  			if (ret) {
> -				gvt_err("vgpu%d: guest page write error %d, "
> -					"gfn 0x%lx, pa 0x%llx, var 0x%x, len %d\n",
> -					vgpu->id, ret,
> -					gp->gfn, pa, *(u32 *)p_data, bytes);
> +				gvt_vgpu_err("guest page write error %d,",
> +					ret);
> +				gvt_vgpu_err("gfn 0x%lx, pa 0x%llx, var 0x%x,",
> +					gp->gfn, pa, *(u32 *)p_data);
> +				gvt_vgpu_err("len %d\n", bytes);

Could we still use the original format? Calling the macro multiple times will
have some redundant prefixes.

Regards,
-Zhiyuan


More information about the intel-gvt-dev mailing list