2009-04-25 14:11:36

by Steve Wise

[permalink] [raw]
Subject: Re: [PATCH 2.6.30] xprtrdma: The frmr iova_start values are truncated by the nfs rdma client.

Trond,

There is a similar bug in the server side too. I'll repost a single
patch that fixes both.

Steve.

Steve Wise wrote:
> A bad cast causes the iova_start, which in this case is a DMA bus address,
> to be truncated on 32b systems. No cast is needed.
>
> Signed-off-by: Steve Wise <[email protected]>
> ---
>
> net/sunrpc/xprtrdma/verbs.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
> index 3b21e0c..3a374f5 100644
> --- a/net/sunrpc/xprtrdma/verbs.c
> +++ b/net/sunrpc/xprtrdma/verbs.c
> @@ -1489,7 +1489,7 @@ rpcrdma_register_frmr_external(struct rpcrdma_mr_seg *seg,
> memset(&frmr_wr, 0, sizeof frmr_wr);
> frmr_wr.opcode = IB_WR_FAST_REG_MR;
> frmr_wr.send_flags = 0; /* unsignaled */
> - frmr_wr.wr.fast_reg.iova_start = (unsigned long)seg1->mr_dma;
> + frmr_wr.wr.fast_reg.iova_start = seg1->mr_dma;
> frmr_wr.wr.fast_reg.page_list = seg1->mr_chunk.rl_mw->r.frmr.fr_pgl;
> frmr_wr.wr.fast_reg.page_list_len = i;
> frmr_wr.wr.fast_reg.page_shift = PAGE_SHIFT;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>



2009-04-27 02:17:11

by Tom Talpey

[permalink] [raw]
Subject: Re: [PATCH 2.6.30] xprtrdma: The frmr iova_start values are truncated by the nfs rdma client.

At 02:57 PM 4/26/2009, Steve Wise wrote:
>Hey Trond,
>
>Turns out the server side is fine. So this patch is good to go.

I'll ACK the patch, but I do wonder if the code will compile cleanly on all
platforms. The iova_start is a u64, whereas the mr_dma is a dma_addr_t,
which is variable sized, depending on platform. Would a (u64) cast be a
safer patch, warning-wise?

Tom.

>
>Thanks,
>
>Steve.
>
>Steve Wise wrote:
>> Trond,
>>
>> There is a similar bug in the server side too. I'll repost a single
>> patch that fixes both.
>>
>> Steve.
>>
>> Steve Wise wrote:
>>> A bad cast causes the iova_start, which in this case is a DMA bus
>>> address,
>>> to be truncated on 32b systems. No cast is needed.
>>>
>>> Signed-off-by: Steve Wise <[email protected]>
>>> ---
>>>
>>> net/sunrpc/xprtrdma/verbs.c | 2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
>>> index 3b21e0c..3a374f5 100644
>>> --- a/net/sunrpc/xprtrdma/verbs.c
>>> +++ b/net/sunrpc/xprtrdma/verbs.c
>>> @@ -1489,7 +1489,7 @@ rpcrdma_register_frmr_external(struct
>>> rpcrdma_mr_seg *seg,
>>> memset(&frmr_wr, 0, sizeof frmr_wr);
>>> frmr_wr.opcode = IB_WR_FAST_REG_MR;
>>> frmr_wr.send_flags = 0; /* unsignaled */
>>> - frmr_wr.wr.fast_reg.iova_start = (unsigned long)seg1->mr_dma;
>>> + frmr_wr.wr.fast_reg.iova_start = seg1->mr_dma;
>>> frmr_wr.wr.fast_reg.page_list =
>>> seg1->mr_chunk.rl_mw->r.frmr.fr_pgl;
>>> frmr_wr.wr.fast_reg.page_list_len = i;
>>> frmr_wr.wr.fast_reg.page_shift = PAGE_SHIFT;
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>>> the body of a message to [email protected]
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>


2009-04-26 18:57:12

by Steve Wise

[permalink] [raw]
Subject: Re: [PATCH 2.6.30] xprtrdma: The frmr iova_start values are truncated by the nfs rdma client.

Hey Trond,

Turns out the server side is fine. So this patch is good to go.

Thanks,

Steve.

Steve Wise wrote:
> Trond,
>
> There is a similar bug in the server side too. I'll repost a single
> patch that fixes both.
>
> Steve.
>
> Steve Wise wrote:
>> A bad cast causes the iova_start, which in this case is a DMA bus
>> address,
>> to be truncated on 32b systems. No cast is needed.
>>
>> Signed-off-by: Steve Wise <[email protected]>
>> ---
>>
>> net/sunrpc/xprtrdma/verbs.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
>> index 3b21e0c..3a374f5 100644
>> --- a/net/sunrpc/xprtrdma/verbs.c
>> +++ b/net/sunrpc/xprtrdma/verbs.c
>> @@ -1489,7 +1489,7 @@ rpcrdma_register_frmr_external(struct
>> rpcrdma_mr_seg *seg,
>> memset(&frmr_wr, 0, sizeof frmr_wr);
>> frmr_wr.opcode = IB_WR_FAST_REG_MR;
>> frmr_wr.send_flags = 0; /* unsignaled */
>> - frmr_wr.wr.fast_reg.iova_start = (unsigned long)seg1->mr_dma;
>> + frmr_wr.wr.fast_reg.iova_start = seg1->mr_dma;
>> frmr_wr.wr.fast_reg.page_list =
>> seg1->mr_chunk.rl_mw->r.frmr.fr_pgl;
>> frmr_wr.wr.fast_reg.page_list_len = i;
>> frmr_wr.wr.fast_reg.page_shift = PAGE_SHIFT;
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html