diff mbox

[v2,2/2] staging/rdma/hfi1: Eliminate WARN_ON when VL is invalid

Message ID 1447114701-11003-3-git-send-email-jubin.john@intel.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

jubin.john@intel.com Nov. 10, 2015, 12:18 a.m. UTC
From: Ira Weiny <iweiny@gmail.com>

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 <dean.luick@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Ira Weiny <iweiny@gmail.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
---
 drivers/staging/rdma/hfi1/sdma.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

Comments

Greg KH Nov. 20, 2015, 12:58 a.m. UTC | #1
On Mon, Nov 09, 2015 at 07:18:21PM -0500, Jubin John wrote:
> From: Ira Weiny <iweiny@gmail.com>
> 
> 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 <dean.luick@intel.com>
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Reviewed-by: Kaike Wan <kaike.wan@intel.com>
> Signed-off-by: Ira Weiny <iweiny@gmail.com>
> Signed-off-by: Jubin John <jubin.john@intel.com>
> ---
>  drivers/staging/rdma/hfi1/sdma.c |   12 ++++++++++--
>  1 files changed, 10 insertions(+), 2 deletions(-)

Doesn't apply to my tree :(

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marciniszyn, Mike Nov. 20, 2015, 3:23 p.m. UTC | #2
> >  drivers/staging/rdma/hfi1/sdma.c |   12 ++++++++++--
> >  1 files changed, 10 insertions(+), 2 deletions(-)
> 
> Doesn't apply to my tree :(

Ok.

Is the inprocess branch available?

Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg KH Nov. 20, 2015, 4:35 p.m. UTC | #3
On Fri, Nov 20, 2015 at 03:23:55PM +0000, Marciniszyn, Mike wrote:
> > >  drivers/staging/rdma/hfi1/sdma.c |   12 ++++++++++--
> > >  1 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > Doesn't apply to my tree :(
> 
> Ok.
> 
> Is the inprocess branch available?

I do not understand what you mean here :(
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marciniszyn, Mike Nov. 20, 2015, 4:43 p.m. UTC | #4
> >
> > Is the inprocess branch available?
> 
> I do not understand what you mean here :(

Does it fail to apply to staging-next or staging-testing or something else?

Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg KH Nov. 20, 2015, 5 p.m. UTC | #5
On Fri, Nov 20, 2015 at 04:43:56PM +0000, Marciniszyn, Mike wrote:
> > >
> > > Is the inprocess branch available?
> > 
> > I do not understand what you mean here :(
> 
> Does it fail to apply to staging-next or staging-testing or something else?

As both trees are now the same, it fails to apply to both at the moment
:)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
jubin.john@intel.com Nov. 20, 2015, 11:59 p.m. UTC | #6
On Fri, Nov 20, 2015 at 09:00:23AM -0800, Greg KH wrote:
> On Fri, Nov 20, 2015 at 04:43:56PM +0000, Marciniszyn, Mike wrote:
> > > >
> > > > Is the inprocess branch available?
> > > 
> > > I do not understand what you mean here :(
> > 
> > Does it fail to apply to staging-next or staging-testing or something else?
> 
> As both trees are now the same, it fails to apply to both at the moment
> :)

I will refresh this patch against the latest staging-next.

Thanks,
Jubin John
> 
> thanks,
> 
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c
index 2a1da21..d7982a7 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 (vl >= num_vls) {
+		rval = NULL;
+		goto done;
+	}
 
 	rcu_read_lock();
 	m = rcu_dereference(dd->sdma_map);
@@ -790,6 +796,8 @@  struct sdma_engine *sdma_select_engine_vl(
 	rval = e->sde[selector & e->mask];
 	rcu_read_unlock();
 
+done:
+	rval =  !rval ? &dd->per_sdma[0] : rval;
 	trace_hfi1_sdma_engine_select(dd, selector, vl, rval->this_idx);
 	return rval;
 }