[PATCH] drm/i915/gvt: remove redundant ring id check which cause significant CPU misprediction

Tian, Kevin kevin.tian at intel.com
Thu Apr 6 03:28:24 UTC 2017


> From: changbin.du at intel.com
> Sent: Thursday, April 6, 2017 10:56 AM
> 
> From: Changbin Du <changbin.du at intel.com>
> 
> From perf data, found a significant overhead at ring id check in the
> function get_opcode. This inline function is frequently used.

How significant is it? Do you have some data?

> 
> Since Intel static predictor will predict the branch to fall through
> so the prediction most fail. This is wasting CPU pipeline resource.
> We do not need check the engine id everywhere, it should be reliable.

what do you mean by "should be reliable"? Meaning the caller is
expected to check ring_id before calling this inline function, or
something else?

> 
> Signed-off-by: Changbin Du <changbin.du at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> index e698c88..41b2c3a 100644
> --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> @@ -616,9 +616,6 @@ static inline u32 get_opcode(u32 cmd, int ring_id)
>  {
>  	struct decode_info *d_info;
> 
> -	if (ring_id >= I915_NUM_ENGINES)
> -		return INVALID_OP;
> -
>  	d_info = ring_decode_info[ring_id][CMD_TYPE(cmd)];
>  	if (d_info == NULL)
>  		return INVALID_OP;
> @@ -661,9 +658,6 @@ static inline void print_opcode(u32 cmd, int ring_id)
>  	struct decode_info *d_info;
>  	int i;
> 
> -	if (ring_id >= I915_NUM_ENGINES)
> -		return;
> -
>  	d_info = ring_decode_info[ring_id][CMD_TYPE(cmd)];
>  	if (d_info == NULL)
>  		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


More information about the intel-gvt-dev mailing list