On Fri, Nov 06, 2015 at 08:07:05PM -0500, Jubin John wrote:
> From: Ira Weiny <[email protected]>
> 
> sdma_select_engine_vl only needs to protect itself from an invalid VL.
> Something higher up the stack should be warning the user when they try
> to use an SL which maps to an invalid VL.
> 
> Reviewed-by: Dean Luick <[email protected]>
> Reviewed-by: Mike Marciniszyn <[email protected]>
> Reviewed-by: Kaike Wan <[email protected]>
> Signed-off-by: Ira Weiny <[email protected]>
> Signed-off-by: Jubin John <[email protected]>
> ---
>  drivers/staging/rdma/hfi1/sdma.c |   12 ++++++++++--
>  1 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rdma/hfi1/sdma.c 
> b/drivers/staging/rdma/hfi1/sdma.c
> index 2a1da21..998bf43 100644
> --- a/drivers/staging/rdma/hfi1/sdma.c
> +++ b/drivers/staging/rdma/hfi1/sdma.c
> @@ -777,8 +777,14 @@ struct sdma_engine *sdma_select_engine_vl(
>       struct sdma_map_elem *e;
>       struct sdma_engine *rval;
>  
> -     if (WARN_ON(vl > 8))
> -             return NULL;
> +     /* NOTE This should only happen if SC->VL changed after the initial
> +      *      checks on the QP/AH
> +      *      Default will return engine 0 below
> +      */
> +     if (unlikely(vl >= num_vls)) {

Can you prove that unlikely() makes a measured difference here?  If not,
please remove it.  If you can, please provide the proof in the changelog
when you resend it.

thanks,

greg k-h
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to