svcrdma: handle rdma read with a non-zero initial page offset
Subsystems (4)
PATCH RESEND 1/1 svcrdma: handle rdma read with a non-zero initial page offset
The server rdma_read_chunk_lcl() and rdma_read_chunk_frmr() functions were not taking into account the initial page_offset when determining the rdma read length. This resulted in a read who's starting address and length exceeded the base/bounds of the frmr.
Most work loads don't tickle this bug apparently, but one test hit it every time: building the linux kernel on a 16 core node with 'make -j 16 O=/mnt/0' where /mnt/0 is a ramdisk mounted via NFSRDMA.
This bug seems to only be tripped with devices having small fastreg page list depths. I didn't see it with mlx4, for instance.
---
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +4 -2
@@ -136,7 +136,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->read_hdr = head; pages_needed =min_t (int, pages_needed, xprt->sc_max_sge_rd); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length);for (pno =0 ; pno < pages_needed; pno++) {int len =min_t (int, rs_length,PAGE_SIZE - pg_off);
@@ -235,7 +236,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->frmr = frmr; pages_needed =min_t (int, pages_needed, xprt->sc_frmr_pg_list_len); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length); frmr->kva =page_address (rqstp->rq_arg.pages[pg_no]); frmr->direction =DMA_FROM_DEVICE ;
--
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
Quoted 11 lines · Steve Wise
The server
rdma_read_chunk_lcl()andrdma_read_chunk_frmr()functions were not taking into account the initialpage_offsetwhen determining the rdma read length. This resulted in a read who's starting address and length exceeded the base/bounds of the frmr.Most work loads don't tickle this bug apparently, but one test hit it every time: building the linux kernel on a 16 core node with 'make -j 16 O=/mnt/0' where
/mnt/0is a ramdisk mounted via NFSRDMA.This bug seems to only be tripped with devices having small fastreg page list depths. I didn't see it with mlx4, for instance.
Bruce, what's you're take on this? Do you want to push this through or would you care if I push it through my tree?
Quoted 38 lines
Fixes 0bf4828983df ('svcrdma: refactor marshalling logic')Signed-off-by Steve Wise <[email protected]>Tested-by Chuck Lever <[email protected]>---
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +4
-3@@ -136,7 +136,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->read_hdr = head; pages_needed =min_t (int, pages_needed, xprt->sc_max_sge_rd); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length);for (pno =0 ; pno < pages_needed; pno++) {int len =min_t (int, rs_length,PAGE_SIZE - pg_off);@@ -235,7 +236,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->frmr = frmr; pages_needed =min_t (int, pages_needed, xprt->sc_frmr_pg_list_len); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length); frmr->kva =page_address (rqstp->rq_arg.pages[pg_no]); frmr->direction =DMA_FROM_DEVICE ; --To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Quoted 10 lines · Doug Ledford
Quoted 9 lines · Steve Wise
The server
rdma_read_chunk_lcl()andrdma_read_chunk_frmr()functions were not taking into account the initialpage_offsetwhen determining the rdma read length. This resulted in a read who's starting address and length exceeded the base/bounds of the frmr.Most work loads don't tickle this bug apparently, but one test hit it every time: building the linux kernel on a 16 core node with 'make -j 16 O=/mnt/0' where
/mnt/0is a ramdisk mounted via NFSRDMA.
Quoted 5 lines
Quoted 2 lines
This bug seems to only be tripped with devices having small fastreg page list depths. I didn't see it with mlx4, for instance.
Bruce, what's you're take on this? Do you want to push this through or would you care if I push it through my tree?
Whoops, sorry, I meant to send a pull request for that last week. Uh, I think I'll go ahead and do that now if it's OK with you.
--b.
Quoted 31 lines
Quoted 31 lines
Fixes 0bf4828983df ('svcrdma: refactor marshalling logic')Signed-off-by Steve Wise <[email protected]>Tested-by Chuck Lever <[email protected]>---
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +4
-2@@ -136,7 +136,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->read_hdr = head; pages_needed =min_t (int, pages_needed, xprt->sc_max_sge_rd); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length);for (pno =0 ; pno < pages_needed; pno++) {int len =min_t (int, rs_length,PAGE_SIZE - pg_off);@@ -235,7 +236,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->frmr = frmr; pages_needed =min_t (int, pages_needed, xprt->sc_frmr_pg_list_len); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length);
Quoted 15 lines
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +0
-1frmr->kva =page_address (rqstp->rq_arg.pages[pg_no]); frmr->direction =DMA_FROM_DEVICE ; --To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
--
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
Quoted 11 lines · J. Bruce Fields
Quoted 10 lines · Doug Ledford
Quoted 9 lines · Steve Wise
The server
rdma_read_chunk_lcl()andrdma_read_chunk_frmr()functions were not taking into account the initialpage_offsetwhen determining the rdma read length. This resulted in a read who's starting address and length exceeded the base/bounds of the frmr.Most work loads don't tickle this bug apparently, but one test hit it every time: building the linux kernel on a 16 core node with 'make -j 16 O=/mnt/0' where
/mnt/0is a ramdisk mounted via NFSRDMA.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
This bug seems to only be tripped with devices having small fastreg page list depths. I didn't see it with mlx4, for instance.
Bruce, what's you're take on this? Do you want to push this through or would you care if I push it through my tree?
Whoops, sorry, I meant to send a pull request for that last week. Uh, I think I'll go ahead and do that now if it's OK with you.
Fine with me. I was just trying to make sure it didn't get forgotten ;-)
Quoted 50 lines
--b.
Quoted 46 lines
Quoted 39 lines
Fixes 0bf4828983df ('svcrdma: refactor marshalling logic')Signed-off-by Steve Wise <[email protected]>Tested-by Chuck Lever <[email protected]>---
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +4
-3@@ -136,7 +136,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->read_hdr = head; pages_needed =min_t (int, pages_needed, xprt->sc_max_sge_rd); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length);for (pno =0 ; pno < pages_needed; pno++) {int len =min_t (int, rs_length,PAGE_SIZE - pg_off);@@ -235,7 +236,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->frmr = frmr; pages_needed =min_t (int, pages_needed, xprt->sc_frmr_pg_list_len); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length); frmr->kva =page_address (rqstp->rq_arg.pages[pg_no]); frmr->direction =DMA_FROM_DEVICE ; --To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Quoted 15 lines · Doug Ledford
Quoted 14 lines · J. Bruce Fields
Quoted 13 lines · Doug Ledford
Quoted 11 lines · Steve Wise
The server
rdma_read_chunk_lcl()andrdma_read_chunk_frmr()functions were not taking into account the initialpage_offsetwhen determining the rdma read length. This resulted in a read who's starting address and length exceeded the base/bounds of the frmr.Most work loads don't tickle this bug apparently, but one test hit it every time: building the linux kernel on a 16 core node with 'make -j 16 O=/mnt/0' where
/mnt/0is a ramdisk mounted via NFSRDMA.This bug seems to only be tripped with devices having small fastreg page list depths. I didn't see it with mlx4, for instance.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Bruce, what's you're take on this? Do you want to push this through or would you care if I push it through my tree?
Whoops, sorry, I meant to send a pull request for that last week. Uh, I think I'll go ahead and do that now if it's OK with you.
Fine with me. I was just trying to make sure it didn't get forgotten ;-)
Understood, thanks! I've sent the pull request.--b.
Quoted 37 lines
Quoted 37 lines
--b.
Quoted 34 lines
Quoted 34 lines
Fixes 0bf4828983df ('svcrdma: refactor marshalling logic')Signed-off-by Steve Wise <[email protected]>Tested-by Chuck Lever <[email protected]>---
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +4
-2@@ -136,7 +136,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->read_hdr = head; pages_needed =min_t (int, pages_needed, xprt->sc_max_sge_rd); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length);for (pno =0 ; pno < pages_needed; pno++) {int len =min_t (int, rs_length,PAGE_SIZE - pg_off);@@ -235,7 +236,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, ctxt->direction =DMA_FROM_DEVICE ; ctxt->frmr = frmr; pages_needed =min_t (int, pages_needed, xprt->sc_frmr_pg_list_len); - read =min_t (int, pages_needed <<PAGE_SHIFT , rs_length); + read =min_t (int, (pages_needed <<PAGE_SHIFT ) - *page_offset, + rs_length); frmr->kva =page_address (rqstp->rq_arg.pages[pg_no]); frmr->direction =DMA_FROM_DEVICE ;
Quoted 21 lines
Quoted 14 lines
Quoted 12 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDDSignature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html