[PATCH] drm/i915/gvt: add new mmio_info flag to avoid log flood

Zhang, Pei pei.zhang at intel.com
Thu Feb 16 01:11:48 UTC 2017


> -----Original Message-----
> From: Zhenyu Wang [mailto:zhenyuw at linux.intel.com]
> Sent: Thursday, February 16, 2017 08:57
> To: Zhang, Pei <pei.zhang at intel.com>
> Cc: intel-gvt-dev at lists.freedesktop.org
> Subject: Re: [PATCH] drm/i915/gvt: add new mmio_info flag to avoid log flood
> 
> On 2017.02.16 01:04:20 +0800, Pei Zhang wrote:
> > If guest is accessing an un-expected mmio through cmd, gvt will print
> > an error log. In some special case, the guest cmd access is very huge
> > which cause the error log flood. Add a special flag to avoid this condition.
> >
> > Signed-off-by: Pei Zhang <pei.zhang at intel.com>
> > ---
> >  drivers/gpu/drm/i915/gvt/cmd_parser.c |  5 ++++-
> >  drivers/gpu/drm/i915/gvt/handlers.c   | 16 ++++++++++++++++
> >  drivers/gpu/drm/i915/gvt/mmio.h       |  4 ++++
> >  3 files changed, 24 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> > b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> > index 7ee1db7..9dc55df 100644
> > --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> > +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> > @@ -830,8 +830,11 @@ static int cmd_reg_handler(struct parser_exec_state *s,
> >  	}
> >
> >  	if (!intel_gvt_mmio_is_cmd_access(gvt, offset)) {
> > -		gvt_err("vgpu%d: %s access to non-render register (%x)\n",
> > +		if (!intel_gvt_mmio_is_cmd_access_violate(gvt, offset)) {
> > +			intel_gvt_mmio_set_cmd_access_violate(gvt, offset);
> > +			gvt_err("vgpu%d: %s access to non-render register (%x)\n",
> >  				s->vgpu->id, cmd, offset);
> > +		}
> >  		return 0;
> >  	}
> 
> So if we disable this for some vgpu, it will be kept disabled for all other
> vgpus, right? Seems not good.
[Pei] en, in fact, the mmio_info is shared for all vGPUs/guest OS. One vGPU instance occurs mmio access violation, it would be same for all other vGPU instances. Don't need to print the same error log for all vGPU instances. So I think the global setting is fine. But it's better to remove the vgpu-id info from the print log, how do you think?

> 
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/handlers.c
> > b/drivers/gpu/drm/i915/gvt/handlers.c
> > index 8fc673a..48176b3 100644
> > --- a/drivers/gpu/drm/i915/gvt/handlers.c
> > +++ b/drivers/gpu/drm/i915/gvt/handlers.c
> > @@ -61,6 +61,8 @@
> >  #define F_CMD_ACCESSED	(1 << 5)
> >  /* This reg could be accessed by unaligned address */
> >  #define F_UNALIGN	(1 << 6)
> > +/* If guest cmd access a mmio without CMD_ACCESS flag, record it */
> > +#define F_CMD_ACCESS_VIOLATE (1 << 7)
> >
> >  unsigned long intel_gvt_get_device_type(struct intel_gvt *gvt)  { @@
> > -2755,6 +2757,20 @@ bool intel_gvt_mmio_is_cmd_access(struct intel_gvt *gvt,
> >  		F_CMD_ACCESS;
> >  }
> >
> > +void intel_gvt_mmio_set_cmd_access_violate(struct intel_gvt *gvt,
> > +		unsigned int offset)
> > +{
> > +	gvt->mmio.mmio_attribute[offset >> 2] |=
> > +		F_CMD_ACCESS_VIOLATE;
> > +}
> > +
> > +bool intel_gvt_mmio_is_cmd_access_violate(struct intel_gvt *gvt,
> > +		unsigned int offset)
> > +{
> > +	return gvt->mmio.mmio_attribute[offset >> 2] &
> > +		F_CMD_ACCESS_VIOLATE;
> > +}
> > +
> >  /**
> >   * intel_gvt_mmio_is_unalign - mark a MMIO could be accessed unaligned
> >   * @gvt: a GVT device
> > diff --git a/drivers/gpu/drm/i915/gvt/mmio.h
> > b/drivers/gpu/drm/i915/gvt/mmio.h index 3bc620f..7b6c78b 100644
> > --- a/drivers/gpu/drm/i915/gvt/mmio.h
> > +++ b/drivers/gpu/drm/i915/gvt/mmio.h
> > @@ -98,10 +98,14 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu
> *vgpu, u64 pa,
> >  				void *p_data, unsigned int bytes);  bool
> > intel_gvt_mmio_is_cmd_access(struct intel_gvt *gvt,
> >  				  unsigned int offset);
> > +bool intel_gvt_mmio_is_cmd_access_violate(struct intel_gvt *gvt,
> > +				  unsigned int offset);
> >  bool intel_gvt_mmio_is_unalign(struct intel_gvt *gvt, unsigned int
> > offset);  void intel_gvt_mmio_set_accessed(struct intel_gvt *gvt,
> > unsigned int offset);  void intel_gvt_mmio_set_cmd_accessed(struct
> intel_gvt *gvt,
> >  				     unsigned int offset);
> > +void intel_gvt_mmio_set_cmd_access_violate(struct intel_gvt *gvt,
> > +					unsigned int offset);
> >  bool intel_gvt_mmio_has_mode_mask(struct intel_gvt *gvt, unsigned int
> > offset);  int intel_vgpu_default_mmio_read(struct intel_vgpu *vgpu,
> unsigned int offset,
> >  				 void *p_data, unsigned int bytes);
> > --
> > 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


More information about the intel-gvt-dev mailing list