RDMA/siw: Trim size of page array to max size needed
Subsystems (2)
PATCH 1/1 RDMA/siw: Trim size of page array to max size needed
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page array. The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected siw_tx_hdt() functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
--- drivers/infiniband/sw/siw/siw_qp_tx.c | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/infiniband/sw/siw/siw_qp_tx.c +16 -13
@@ -432,7 +432,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)struct siw_wqe *wqe = &c_tx->wqe_active;struct siw_sge *sge = &wqe->sqe.sge[c_tx->sge_idx];struct kvec iov[MAX_ARRAY ]; -struct page *page_array[MAX_ARRAY ]; +struct page *page_array[MAX_ARRAY -2 ];struct msghdr msg = { .msg_flags =MSG_DONTWAIT |MSG_EOR };int seg =0 , do_crc = c_tx->do_crc, is_kva =0 , rv;
@@ -491,7 +491,6 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)while (sge_len) {size_t plen =min ((int )PAGE_SIZE - fp_off, sge_len); -void *kaddr;if (!is_kva) {struct page *p;
@@ -503,14 +502,12 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s) rv = -EFAULT ; goto done_crc; } - page_array[seg] = p; -if (!c_tx->use_sendpage) { -void *kaddr =kmap_local_page (p); +void *pa =kmap_local_page (p);/* Remember for later kunmap() */ kmap_mask |=BIT (seg); - iov[seg].iov_base = kaddr + fp_off; + iov[seg].iov_base = pa + fp_off; iov[seg].iov_len = plen;if (do_crc)
@@ -518,12 +515,17 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s) c_tx->mpa_crc_hd, iov[seg].iov_base, plen); - }else if (do_crc) { - kaddr =kmap_local_page (p); -crypto_shash_update (c_tx->mpa_crc_hd, - kaddr + fp_off, - plen); -kunmap_local (kaddr); + }else { + page_array[seg] = p; +if (do_crc) { +void *pa =kmap_local_page (p); + +crypto_shash_update ( + c_tx->mpa_crc_hd, + pa + fp_off, + plen); +kunmap_local (pa); + } } }else {/*
@@ -545,7 +547,8 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s) data_len -= plen; fp_off =0 ; -if (++seg >= (int )MAX_ARRAY ) { +if (++seg >= (int )MAX_ARRAY || + (c_tx->use_sendpage && seg >= (int )MAX_ARRAY -2 )) {siw_dbg_qp (tx_qp (c_tx),"to many fragments\n" );siw_unmap_pages (iov, kmap_mask, seg-1 ); wqe->processed -= c_tx->bytes_unsent;
Signature · 1 line
2.38.1
Hi Bernard,
Quoted 9 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page array. The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:
Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
I saw similar warning in my ubuntu 22.04 VM which has below gcc.
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame size of 1440 bytes is larger than 1024 bytes [-Wframe-larger-than=] 665 | } | ^
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am ./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx Applying: RDMA/siw: Trim size of page array to max size needed root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame size of 1408 bytes is larger than 1024 bytes [-Wframe-larger-than=] 668 | } | ^
However with gcc-13.1, I can't see the warning with or without the patch.
Thanks,
Guoqing
Quoted 28 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Tuesday, January 23, 2024 3:43 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array to max size neededHi Bernard,
Quoted 9 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page array. The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]I saw similar warning in my ubuntu 22.04 VM which has below gcc.
Quoted 9 lines
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame size of 1440 bytes is larger than 1024 bytes [-Wframe-larger-than=] 665 | } | ^
Whew.. that is quite substantially off the target!
How come different compilers making so much of a difference. Guoqing, can you check if the macro computing the maximum number of fragments is broken, i.e., computes different values in the cases you refer?
Thanks a lot!
Bernard
Quoted 22 lines
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am ./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx Applying: RDMA/siw: Trim size of page array to max size needed root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame size of 1408 bytes is larger than 1024 bytes [-Wframe-larger-than=] 668 | } | ^However with gcc-13.1, I can't see the warning with or without the patch.
Thanks,
Guoqing
Hi Bernard,
Quoted 34 lines · Bernard Metzler
Quoted 25 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Tuesday, January 23, 2024 3:43 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array to max size neededHi Bernard,
Quoted 9 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page array. The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]I saw similar warning in my ubuntu 22.04 VM which has below gcc.
Quoted 9 lines
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame size of 1440 bytes is larger than 1024 bytes [-Wframe-larger-than=] 665 | } | ^
Quoted 5 lines
Whew.. that is quite substantially off the target!
How come different compilers making so much of a difference. Guoqing, can you check if the macro computing the maximum number of fragments is broken, i.e., computes different values in the cases you refer?
Sorry, I was wrong 😅.
The warning is not relevant with compiler, and it also appears with gcc-13.1 after enable KASAN which is used to find out-of-bounds bugs. Also, there are lots of -Wframe-larger-than warning from other places as well.
Quoted 18 lines
Thanks a lot!
BernardQuoted 16 lines
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am ./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx Applying: RDMA/siw: Trim size of page array to max size needed root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame size of 1408 bytes is larger than 1024 bytes [-Wframe-larger-than=] 668 | } | ^
The patch actually reduced the frame size from 1440 to 1408 though it is still larger than 1024.
Thanks,
Guoqing
Quoted 79 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Thursday, January 25, 2024 1:15 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array to max size neededHi Bernard,
Quoted 6 lines · Bernard Metzler
Quoted 6 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Tuesday, January 23, 2024 3:43 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array tomax
Quoted 14 lines
Quoted 14 lines
size needed
Hi Bernard,
Quoted 9 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page array. The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Quoted 7 lines
Quoted 7 lines
I saw similar warning in my ubuntu 22.04 VM which has below gcc.
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame sizeof
Quoted 9 lines
Quoted 4 lines
1440 bytes is larger than 1024 bytes [-Wframe-larger-than=]
665 | }
| ^Whew.. that is quite substantially off the target!
How come different compilers making so much of a difference. Guoqing, can you check if the macro computing the maximum number of fragments is broken, i.e., computes different values in the cases you refer?Sorry, I was wrong 😅.
The warning is not relevant with compiler, and it also appears with gcc- 13.1
after enable KASAN which is used to find out-of-bounds bugs. Also, there are lots of -Wframe-larger-than warning from other places as well.Quoted 9 lines
Thanks a lot!
BernardQuoted 7 lines
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx
Quoted 6 lines
Quoted 6 lines
Applying: RDMA/siw: Trim size of page array to max size needed
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame size
Quoted 8 lines
of
Quoted 3 lines
Quoted 3 lines
1408 bytes is larger than 1024 bytes [-Wframe-larger-than=]
668 | }
| ^The patch actually reduced the frame size from 1440 to 1408 though it is still larger than 1024.
So in your opinion, does this patch fix the issue of having a frame size larger than 1024 bytes for a typical build? I am sure we do not want to optimize the driver for building with KASAN debug options enabled.
The original bug report claimed a frame size of 1040 bytes for a build w/o KASAN, being larger than 1024 bytes by 16 bytes. I think this patch fixes the reported issue.
Thanks a lot,
Bernard.
Quoted 2 lines
Thanks,
Guoqing
Quoted 78 lines · Bernard Metzler
Quoted 78 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Thursday, January 25, 2024 1:15 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array to max size neededHi Bernard,
Quoted 6 lines · Bernard Metzler
Quoted 6 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Tuesday, January 23, 2024 3:43 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array tomax
Quoted 14 lines
Quoted 14 lines
size needed
Hi Bernard,
Quoted 9 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page array. The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Quoted 7 lines
Quoted 7 lines
I saw similar warning in my ubuntu 22.04 VM which has below gcc.
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame sizeof
Quoted 9 lines
Quoted 4 lines
1440 bytes is larger than 1024 bytes [-Wframe-larger-than=]
665 | }
| ^Whew.. that is quite substantially off the target!
How come different compilers making so much of a difference. Guoqing, can you check if the macro computing the maximum number of fragments is broken, i.e., computes different values in the cases you refer?Sorry, I was wrong 😅.
The warning is not relevant with compiler, and it also appears with gcc- 13.1
after enable KASAN which is used to find out-of-bounds bugs. Also, there are lots of -Wframe-larger-than warning from other places as well.Quoted 9 lines
Thanks a lot!
BernardQuoted 7 lines
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx
Quoted 6 lines
Quoted 6 lines
Applying: RDMA/siw: Trim size of page array to max size needed
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame sizeof
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
1408 bytes is larger than 1024 bytes [-Wframe-larger-than=]
668 | }
| ^The patch actually reduced the frame size from 1440 to 1408 though it is still larger than 1024.
So in your opinion, does this patch fix the issue of having a frame size larger than 1024 bytes for a typical build?
The warning still appears with KASAN enabled from my side.
Quoted 2 lines
I am sure we do not want to optimize the driver for building with KASAN debug options enabled.
Agreed.
Quoted 3 lines
The original bug report claimed a frame size of 1040 bytes for a build w/o KASAN, being larger than 1024 bytes by 16 bytes. I think this patch fixes the reported issue.
I am not sure about it after check the relevant bugzilla, maybe the reporter can verify it.
Thanks,
Guoqing
Quoted 84 lines · Bernard Metzler
Quoted 84 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Thursday, January 25, 2024 1:15 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array to max size neededHi Bernard,
Quoted 6 lines · Bernard Metzler
Quoted 6 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Tuesday, January 23, 2024 3:43 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array tomax
Quoted 14 lines
Quoted 14 lines
size needed
Hi Bernard,
Quoted 9 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page array. The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Quoted 7 lines
Quoted 7 lines
I saw similar warning in my ubuntu 22.04 VM which has below gcc.
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame sizeof
Quoted 9 lines
Quoted 4 lines
1440 bytes is larger than 1024 bytes [-Wframe-larger-than=]
665 | }
| ^Whew.. that is quite substantially off the target!
How come different compilers making so much of a difference. Guoqing, can you check if the macro computing the maximum number of fragments is broken, i.e., computes different values in the cases you refer?Sorry, I was wrong 😅.
The warning is not relevant with compiler, and it also appears with gcc- 13.1
after enable KASAN which is used to find out-of-bounds bugs. Also, there are lots of -Wframe-larger-than warning from other places as well.Quoted 9 lines
Thanks a lot!
BernardQuoted 7 lines
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx
Quoted 6 lines
Quoted 6 lines
Applying: RDMA/siw: Trim size of page array to max size needed
root@buk:/home/gjiang/linux-mirror# make M=drivers/infiniband/sw/siw/ -j16 W=1 CC [M] drivers/infiniband/sw/siw/siw_qp_tx.o drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’: drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame sizeof
Quoted 3 lines
Quoted 3 lines
1408 bytes is larger than 1024 bytes [-Wframe-larger-than=]
668 | }
| ^
Quoted 8 lines
Quoted 3 lines
The patch actually reduced the frame size from 1440 to 1408 though it is still larger than 1024.
So in your opinion, does this patch fix the issue of having a frame size larger than 1024 bytes for a typical build? I am sure we do not want to optimize the driver for building with KASAN debug options enabled.
But this is how we are running or supposed to run kernels. In any sane regression run, KASAN is enabled.
I would speculate that most people who run SIW, use it to test their ULPs.
So I would like to see it fixed for them too.
Thanks
Quoted 12 lines
The original bug report claimed a frame size of 1040 bytes for a build w/o KASAN, being larger than 1024 bytes by 16 bytes. I think this patch fixes the reported issue.
Thanks a lot,
Bernard.Quoted 2 lines
Thanks,
Guoqing
Quoted 112 lines
-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Friday, January 26, 2024 12:06 PM
To: Bernard Metzler <[email protected]>
Cc: Guoqing Jiang <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: Re: [PATCH] RDMA/siw: Trim size of page array to max size neededQuoted 8 lines · Bernard Metzler
Quoted 8 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Thursday, January 25, 2024 1:15 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array tomax
Quoted 12 lines
Quoted 12 lines
size needed
Hi Bernard,
Quoted 6 lines · Bernard Metzler
Quoted 6 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Tuesday, January 23, 2024 3:43 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array tomax
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
size needed
Hi Bernard,
Quoted 3 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page
array.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Quoted 3 lines
Quoted 3 lines
I saw similar warning in my ubuntu 22.04 VM which has below gcc.
root@buk:/home/gjiang/linux-mirror# makeM=drivers/infiniband/sw/siw/
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
-j16 W=1
CC [M]drivers/infiniband/sw/siw/siw_qp_tx.odrivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’:drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame sizeof
Quoted 9 lines
Quoted 4 lines
1440 bytes is larger than 1024 bytes [-Wframe-larger-than=]
665 | }
| ^Whew.. that is quite substantially off the target!
How come different compilers making so much of a difference. Guoqing, can you check if the macro computing the maximum number of fragments is broken, i.e., computes different values in the cases you refer?Quoted 3 lines
Quoted 3 lines
Sorry, I was wrong 😅.
The warning is not relevant with compiler, and it also appears with
gcc-
Quoted 2 lines
Quoted 2 lines
13.1
after enable KASAN which is used to find out-of-bounds bugs. Also,there
Quoted 7 lines
Quoted 7 lines
are lots of -Wframe-larger-than warning from other places as well.
Quoted 5 lines
Thanks a lot!
BernardQuoted 3 lines
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx
Quoted 2 lines
Quoted 2 lines
Applying: RDMA/siw: Trim size of page array to max size needed
root@buk:/home/gjiang/linux-mirror# makeM=drivers/infiniband/sw/siw/
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
-j16 W=1
CC [M]drivers/infiniband/sw/siw/siw_qp_tx.odrivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’:drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame sizeof
Quoted 3 lines
Quoted 3 lines
1408 bytes is larger than 1024 bytes [-Wframe-larger-than=]
668 | }
| ^The patch actually reduced the frame size from 1440 to 1408 though it
is
Quoted 7 lines
Quoted 2 lines
still larger than 1024.
So in your opinion, does this patch fix the issue of having a frame size larger than 1024 bytes for a typical build? I am sure we do not want to optimize the driver for building with KASAN debug options enabled.
Quoted 6 lines
But this is how we are running or supposed to run kernels. In any sane regression run, KASAN is enabled.
I would speculate that most people who run SIW, use it to test their ULPs.
So I would like to see it fixed for them too.
Understood. I propose to take the patch as I sent for now as a fix of the problem under the conditions reported. I'll look into restructuring the transmit path to squeeze its size below 1024 even for KASAN builds. It will require some time.
Kernel builds with KASAN enabled emit lots of similar compile time warnings reporting frame sizes above 1024 bytes. Our core/nldev.c alone spills 13 of those. Any action needed? ;)
Best,
Bernard
Quoted 15 lines
Thanks
Quoted 12 lines
The original bug report claimed a frame size of 1040 bytes for a build w/o KASAN, being larger than 1024 bytes by 16 bytes. I think this patch fixes the reported issue.
Thanks a lot,
Bernard.Quoted 2 lines
Thanks,
Guoqing
Quoted 119 lines · Bernard Metzler
Quoted 112 lines
-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Friday, January 26, 2024 12:06 PM
To: Bernard Metzler <[email protected]>
Cc: Guoqing Jiang <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: Re: [PATCH] RDMA/siw: Trim size of page array to max size neededQuoted 8 lines · Bernard Metzler
Quoted 8 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Thursday, January 25, 2024 1:15 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array tomax
Quoted 12 lines
Quoted 12 lines
size needed
Hi Bernard,
Quoted 6 lines · Bernard Metzler
Quoted 6 lines
-----Original Message-----
From: Guoqing Jiang <[email protected]>
Sent: Tuesday, January 23, 2024 3:43 AM
To: Bernard Metzler <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Trim size of page array tomax
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
size needed
Hi Bernard,
Quoted 3 lines · Bernard Metzler
siw tries sending all parts of an iWarp wire frame in one socket send operation. If user data can be send without copy, user data pages for one wire frame are referenced in an fixed size page
array.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The size of this array can be made 2 elements smaller, since it does not reference iWarp header and trailer crc. Trimming the page array reduces the affected
siw_tx_hdt()functions frame size, staying below 1024 bytes. This avoids the following compile-time warning:Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_tx_hdt':
drivers/infiniband/sw/siw/siw_qp_tx.c:677:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Quoted 3 lines
Quoted 3 lines
I saw similar warning in my ubuntu 22.04 VM which has below gcc.
root@buk:/home/gjiang/linux-mirror# makeM=drivers/infiniband/sw/siw/
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
-j16 W=1
CC [M]drivers/infiniband/sw/siw/siw_qp_tx.odrivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’:drivers/infiniband/sw/siw/siw_qp_tx.c:665:1: warning: the frame sizeof
Quoted 9 lines
Quoted 4 lines
1440 bytes is larger than 1024 bytes [-Wframe-larger-than=]
665 | }
| ^Whew.. that is quite substantially off the target!
How come different compilers making so much of a difference. Guoqing, can you check if the macro computing the maximum number of fragments is broken, i.e., computes different values in the cases you refer?Quoted 3 lines
Quoted 3 lines
Sorry, I was wrong 😅.
The warning is not relevant with compiler, and it also appears with
gcc-
Quoted 2 lines
Quoted 2 lines
13.1
after enable KASAN which is used to find out-of-bounds bugs. Also,there
Quoted 7 lines
Quoted 7 lines
are lots of -Wframe-larger-than warning from other places as well.
Quoted 5 lines
Thanks a lot!
BernardQuoted 3 lines
# gcc --version gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
And it still appears after apply this patch on top of 6.8-rc1.
root@buk:/home/gjiang/linux-mirror# git am./20240119_bmt_rdma_siw_trim_size_of_page_array_to_max_size_needed.mbx
Quoted 2 lines
Quoted 2 lines
Applying: RDMA/siw: Trim size of page array to max size needed
root@buk:/home/gjiang/linux-mirror# makeM=drivers/infiniband/sw/siw/
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
-j16 W=1
CC [M]drivers/infiniband/sw/siw/siw_qp_tx.odrivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’:drivers/infiniband/sw/siw/siw_qp_tx.c:668:1: warning: the frame sizeof
Quoted 3 lines
Quoted 3 lines
1408 bytes is larger than 1024 bytes [-Wframe-larger-than=]
668 | }
| ^The patch actually reduced the frame size from 1440 to 1408 though it
is
Quoted 7 lines
Quoted 2 lines
still larger than 1024.
So in your opinion, does this patch fix the issue of having a frame size larger than 1024 bytes for a typical build? I am sure we do not want to optimize the driver for building with KASAN debug options enabled.
Quoted 6 lines
But this is how we are running or supposed to run kernels. In any sane regression run, KASAN is enabled.
I would speculate that most people who run SIW, use it to test their ULPs.
So I would like to see it fixed for them too.
Quoted 8 lines
Understood. I propose to take the patch as I sent for now as a fix of the problem under the conditions reported. I'll look into restructuring the transmit path to squeeze its size below 1024 even for KASAN builds. It will require some time.
Kernel builds with KASAN enabled emit lots of similar compile time warnings reporting frame sizes above 1024 bytes. Our
core/nldev.calone spills 13 of those. Any action needed? ;)
Yes, report them to ML and someone will fix them :).
Thanks
Quoted 18 lines
Best,
BernardQuoted 15 lines
Thanks
Quoted 12 lines
The original bug report claimed a frame size of 1040 bytes for a build w/o KASAN, being larger than 1024 bytes by 16 bytes. I think this patch fixes the reported issue.
Thanks a lot,
Bernard.Quoted 2 lines
Thanks,
Guoqing