linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ib_srp: initialize dma_length in srp_map_idb
@ 2015-11-15 17:59 Christoph Hellwig
  2015-11-15 18:20 ` Sagi Grimberg
       [not found] ` <1447610393-2899-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2015-11-15 17:59 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: sagig, linux-scsi, linux-rdma

Without this sg_dma_len will return 0 on architectures tha have
the dma_length field.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 32f7962..445c0a6 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1520,6 +1520,9 @@ static int srp_map_idb(struct srp_rdma_ch *ch, struct srp_request *req,
 		state.sg_nents = 1;
 		sg_set_buf(idb_sg, req->indirect_desc, idb_len);
 		idb_sg->dma_address = req->indirect_dma_addr; /* hack! */
+#ifdef CONFIG_NEED_SG_DMA_LENGTH
+		idb_sg->dma_length = idb_sg->length;	      /* hack^2 */
+#endif
 		ret = srp_map_finish_fr(&state, ch);
 		if (ret < 0)
 			return ret;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ib_srp: initialize dma_length in srp_map_idb
  2015-11-15 17:59 [PATCH] ib_srp: initialize dma_length in srp_map_idb Christoph Hellwig
@ 2015-11-15 18:20 ` Sagi Grimberg
       [not found]   ` <5648CD03.4000206-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
       [not found] ` <1447610393-2899-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Sagi Grimberg @ 2015-11-15 18:20 UTC (permalink / raw)
  To: Christoph Hellwig, Bart Van Assche; +Cc: linux-scsi, linux-rdma



On 15/11/2015 19:59, Christoph Hellwig wrote:
> Without this sg_dma_len will return 0 on architectures tha have
> the dma_length field.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/infiniband/ulp/srp/ib_srp.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 32f7962..445c0a6 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -1520,6 +1520,9 @@ static int srp_map_idb(struct srp_rdma_ch *ch, struct srp_request *req,
>   		state.sg_nents = 1;
>   		sg_set_buf(idb_sg, req->indirect_desc, idb_len);
>   		idb_sg->dma_address = req->indirect_dma_addr; /* hack! */
> +#ifdef CONFIG_NEED_SG_DMA_LENGTH
> +		idb_sg->dma_length = idb_sg->length;	      /* hack^2 */
> +#endif

:)

We should really get this properly map/unmap per IO at some point.
Probably do it in both code paths...

Having said that,

Looks fine,

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ib_srp: initialize dma_length in srp_map_idb
       [not found]   ` <5648CD03.4000206-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2015-11-15 21:10     ` Or Gerlitz
  2015-11-16  9:50       ` Sagi Grimberg
  0 siblings, 1 reply; 7+ messages in thread
From: Or Gerlitz @ 2015-11-15 21:10 UTC (permalink / raw)
  To: Sagi Grimberg, Nicholas A. Bellinger
  Cc: Christoph Hellwig, Bart Van Assche,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Sun, Nov 15, 2015, Sagi Grimberg <sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote:
> On 15/11/2015 19:59, Christoph Hellwig wrote:

>> Without this sg_dma_len will return 0 on architectures tha have
>> the dma_length field.

and what wrong with that?

Christoph, probably typo here? "tha" needs to be "that"

>> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
>> ---
>>   drivers/infiniband/ulp/srp/ib_srp.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c
>> b/drivers/infiniband/ulp/srp/ib_srp.c
>> index 32f7962..445c0a6 100644
>> --- a/drivers/infiniband/ulp/srp/ib_srp.c
>> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
>> @@ -1520,6 +1520,9 @@ static int srp_map_idb(struct srp_rdma_ch *ch,
>> struct srp_request *req,
>>                 state.sg_nents = 1;
>>                 sg_set_buf(idb_sg, req->indirect_desc, idb_len);
>>                 idb_sg->dma_address = req->indirect_dma_addr; /* hack! */
>> +#ifdef CONFIG_NEED_SG_DMA_LENGTH
>> +               idb_sg->dma_length = idb_sg->length;          /* hack^2 */
>> +#endif
>
>
> :)
>
> We should really get this properly map/unmap per IO at some point.
> Probably do it in both code paths...

Sagi, can you please elaborate a little further on the problem, srpt
WA, what do we do in isert and what is the proposed not WA solution?

> Having said that,
> Looks fine,
> Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ib_srp: initialize dma_length in srp_map_idb
  2015-11-15 21:10     ` Or Gerlitz
@ 2015-11-16  9:50       ` Sagi Grimberg
  0 siblings, 0 replies; 7+ messages in thread
From: Sagi Grimberg @ 2015-11-16  9:50 UTC (permalink / raw)
  To: Or Gerlitz, Nicholas A. Bellinger
  Cc: Christoph Hellwig, Bart Van Assche, linux-scsi@vger.kernel.org,
	linux-rdma@vger.kernel.org



On 15/11/2015 23:10, Or Gerlitz wrote:
> On Sun, Nov 15, 2015, Sagi Grimberg <sagig@dev.mellanox.co.il> wrote:
>> On 15/11/2015 19:59, Christoph Hellwig wrote:
>
>>> Without this sg_dma_len will return 0 on architectures tha have
>>> the dma_length field.
>
> and what wrong with that?

Because it's not length 0. It's because I did a (documented) hack
with the new memory registration API. I hope we can fix it soon.

>
> Christoph, probably typo here? "tha" needs to be "that"
>
>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>> ---
>>>    drivers/infiniband/ulp/srp/ib_srp.c | 3 +++
>>>    1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c
>>> b/drivers/infiniband/ulp/srp/ib_srp.c
>>> index 32f7962..445c0a6 100644
>>> --- a/drivers/infiniband/ulp/srp/ib_srp.c
>>> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
>>> @@ -1520,6 +1520,9 @@ static int srp_map_idb(struct srp_rdma_ch *ch,
>>> struct srp_request *req,
>>>                  state.sg_nents = 1;
>>>                  sg_set_buf(idb_sg, req->indirect_desc, idb_len);
>>>                  idb_sg->dma_address = req->indirect_dma_addr; /* hack! */
>>> +#ifdef CONFIG_NEED_SG_DMA_LENGTH
>>> +               idb_sg->dma_length = idb_sg->length;          /* hack^2 */
>>> +#endif
>>
>>
>> :)
>>
>> We should really get this properly map/unmap per IO at some point.
>> Probably do it in both code paths...
>
> Sagi, can you please elaborate a little further on the problem, srpt
> WA,

It's srp initiator. This falls in the case where srp sends an indirect
buffer descriptor to the target (which is registered). For this
descriptor it uses a pre-dma-mapped buffer, so in order to fit it into
the new memory registration scheme (which works on SG lists), I hacked
a single entry SG and used the pre-dma-mapped address. What was missing
is the dma_length setting (because we didn't dma mapped the SG).

The proper fix is doing correct map/unmap per IO.

> what do we do in isert and what is the proposed not WA solution?

iser does not have indirect buffer descriptors, only a single rkey
(per-direction).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ib_srp: initialize dma_length in srp_map_idb
       [not found] ` <1447610393-2899-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
@ 2015-11-16 17:16   ` Bart Van Assche
  2015-11-16 17:22     ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2015-11-16 17:16 UTC (permalink / raw)
  To: Christoph Hellwig, Bart Van Assche
  Cc: sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 11/15/2015 09:59 AM, Christoph Hellwig wrote:
> Without this sg_dma_len will return 0 on architectures tha have
> the dma_length field.
>
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> ---
>   drivers/infiniband/ulp/srp/ib_srp.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 32f7962..445c0a6 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -1520,6 +1520,9 @@ static int srp_map_idb(struct srp_rdma_ch *ch, struct srp_request *req,
>   		state.sg_nents = 1;
>   		sg_set_buf(idb_sg, req->indirect_desc, idb_len);
>   		idb_sg->dma_address = req->indirect_dma_addr; /* hack! */
> +#ifdef CONFIG_NEED_SG_DMA_LENGTH
> +		idb_sg->dma_length = idb_sg->length;	      /* hack^2 */
> +#endif
>   		ret = srp_map_finish_fr(&state, ch);
>   		if (ret < 0)
>   			return ret;
>

Hello Christoph,

How about adding "Cc: stable" to this patch such that it not only will 
be integrated in kernel v4.4 but also in kernel v4.3.1 or later ?

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ib_srp: initialize dma_length in srp_map_idb
  2015-11-16 17:16   ` Bart Van Assche
@ 2015-11-16 17:22     ` Christoph Hellwig
  2015-11-16 17:52       ` Bart Van Assche
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2015-11-16 17:22 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Christoph Hellwig, sagig, linux-scsi, linux-rdma

Hi Bart,

the code in this area changed enough since 4.3 that it won't easily
apply.  But a backport would still be very useful!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ib_srp: initialize dma_length in srp_map_idb
  2015-11-16 17:22     ` Christoph Hellwig
@ 2015-11-16 17:52       ` Bart Van Assche
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2015-11-16 17:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: sagig@dev.mellanox.co.il, linux-scsi@vger.kernel.org,
	linux-rdma@vger.kernel.org

On 11/16/2015 09:22 AM, Christoph Hellwig wrote:
> the code in this area changed enough since 4.3 that it won't easily
> apply.  But a backport would still be very useful!

In that case:

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-16 17:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-15 17:59 [PATCH] ib_srp: initialize dma_length in srp_map_idb Christoph Hellwig
2015-11-15 18:20 ` Sagi Grimberg
     [not found]   ` <5648CD03.4000206-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-11-15 21:10     ` Or Gerlitz
2015-11-16  9:50       ` Sagi Grimberg
     [not found] ` <1447610393-2899-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-11-16 17:16   ` Bart Van Assche
2015-11-16 17:22     ` Christoph Hellwig
2015-11-16 17:52       ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).