RDMA/rxe: Avoid -Wflex-array-member-not-at-end warnings
Subsystems (2)
PATCH v3 1/1 RDMA/rxe: Avoid -Wflex-array-member-not-at-end warnings
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new TRAILING_OVERLAP() helper to fix the following warning:
21 drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct ib_sge sge[RXE_MAX_SGE]; onto the FAM struct rxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.
The static_assert() ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.
Lastly, move the conflicting declaration struct rxe_resp_info resp; to the end of the corresponding structure.
---V2->V3: Replace struct ib_sge with struct rxe_sge
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/infiniband/sw/rxe/rxe_verbs.h +11 -7
@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */
@@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;
@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;
@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Signature · 1 line
2.39.5
Quoted 20 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.
Quoted 7 lines
Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>---
V2->V3: Replace structib_sgewith structrxe_sge
What are you doing?
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
-Gustavo
Quoted 55 lines
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +11
-7@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */ @@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Quoted 26 lines · Gustavo A. R. Silva
Quoted 23 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.
Quoted 6 lines
Quoted 4 lines
Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>---
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct rxe_sge differs from struct ib_sge, I aligned it to use the same structure.
Yanjun.Zhu
Quoted 56 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
-Gustavo
Quoted 49 lines
---
drivers/infiniband/sw/rxe/rxe_verbs.h| 18 +++++++++++-------1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +0
-0@@ -219,12 +219,6 @@ struct rxe_resp_info { u32 rkey; u32 length;- /* SRQ only */
- struct {
- struct rxe_recv_wqe wqe;
- struct ib_sge sge[RXE_MAX_SGE];
- }srq_wqe;
-
/* Responder resources. It's a circular list where the oldest
* resource is dropped first.
*/drivers/infiniband/sw/rxe/rxe_verbs.h +8
-1@@ -232,7 +226,15 @@ struct rxe_resp_info { unsigned int res_head; unsigned int res_tail; struct resp_res *res; + + /* SRQ only */ + /* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge)); struct rxe_qp { struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp { struct rxe_req_info req; struct rxe_comp_info comp; - struct rxe_resp_info resp; atomic_t ssn; atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t
state_lock; /* guard requester and completer */ struct execute_workcleanup_work;
+
+ /* Must be last as it ends in a flexible-array member. */ + struct rxe_resp_info resp;
};
enum {
Signature · 2 lines
Best Regards, Yanjun.Zhu
Quoted 28 lines · Zhu Yanjun
Quoted 26 lines · Gustavo A. R. Silva
Quoted 23 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array- member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>---
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.
Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
and please, learn how to properly submit patch series.
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
-Gustavo
Quoted 42 lines · Gustavo A. R. Silva
Quoted 28 lines · Zhu Yanjun
Quoted 26 lines · Gustavo A. R. Silva
Quoted 23 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array- member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>---
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
and please, learn how to properly submit patch series.
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
You can correct this patch by yourself.
Yanjun.Zhu
Quoted 2 lines
-Gustavo
Signature · 2 lines
Best Regards, Yanjun.Zhu
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
Quoted 6 lines
Quoted 4 lines
and please, learn how to properly submit patch series.
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
You can correct this patch by yourself.
Quoted 12 lines · Gustavo A. R. Silva
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
and please, learn how to properly submit patch series.
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
You can correct this patch by yourself.
You need to do some changes in your commit.
Yanjun.Zhu
Signature · 2 lines
Best Regards, Yanjun.Zhu
Quoted 16 lines · Zhu Yanjun
Quoted 14 lines · Gustavo A. R. Silva
Quoted 14 lines
Quoted 14 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
and please, learn how to properly submit patch series.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
You can correct this patch by yourself.
You need to do some changes in your commit.
This is what you haven't understood yet. If the original code is wrong (e.g. is currently using struct ib_sge instead of struct rxe_sge or the other way around), then _that_ code should be fixed _first_, regardless of any other patch that might be applied on top of it.
-Gustavo
Quoted 27 lines · Gustavo A. R. Silva
Quoted 24 lines · Zhu Yanjun
Quoted 21 lines · Gustavo A. R. Silva
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
Quoted 6 lines
Quoted 4 lines
and please, learn how to properly submit patch series.
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
You can correct this patch by yourself.
Quoted 6 lines
Quoted 1 line
You need to do some changes in your commit.
This is what you haven't understood yet. If the original code is wrong (e.g. is currently using struct
ib_sgeinstead of structrxe_sgeor the other way around), then _that_ code should be fixed _first_, regardless of any other patch that might be applied on top of it.
Your commit should align the 2 structs.
Thanks,
Yanjun.Zhu
Quoted 3 lines
-Gustavo
Signature · 2 lines
Best Regards, Yanjun.Zhu
Quoted 28 lines · Zhu Yanjun
Quoted 26 lines · Gustavo A. R. Silva
Quoted 23 lines · Zhu Yanjun
Quoted 20 lines · Gustavo A. R. Silva
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
Quoted 6 lines
Quoted 4 lines
and please, learn how to properly submit patch series.
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
You can correct this patch by yourself.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
You need to do some changes in your commit.
This is what you haven't understood yet. If the original code is wrong (e.g. is currently using struct
ib_sgeinstead of structrxe_sgeor the other way around), then _that_ code should be fixed _first_, regardless of any other patch that might be applied on top of it.Your commit should align the 2 structs.
No. It should not. To understand why, read my previous responses.
-Gustavo
Quoted 20 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.
Quoted 5 lines
Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>
NACK.
I didn't write this patch.
Please, don't ever submit modified patches on my behalf.
Quoted 2 lines
---
V2->V3: Replace structib_sgewith structrxe_sge
Patch granularity is a fundamental thing. Changes addressing different issues should not be mixed together. Previously existing issues (if any) must be addressed in separate patches.
-Gustavo
Quoted 55 lines
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +11
-7@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */ @@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Quoted 35 lines · Zhu Yanjun
Quoted 33 lines · Gustavo A. R. Silva
Quoted 29 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>---
V2->V3: Replace structib_sgewith structrxe_sge
Quoted 4 lines
Quoted 1 line
What are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.
Zhu,
Please submit your rxe_sge to ib_sge change as standalone patch and Gustavo will resubmit his patch later if he wants so.
Thanks
Quoted 33 lines · Gustavo A. R. Silva
Quoted 30 lines · Zhu Yanjun
Quoted 28 lines · Gustavo A. R. Silva
Quoted 24 lines · Zhu Yanjun
Quoted 12 lines · Gustavo A. R. Silva
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
V2->V3: Replace structib_sgewith structrxe_sgeWhat are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Listen, this is not how things are done upstream. Read what I previously commented:
Quoted 2 lines
Quoted 2 lines
You're making a mess of this whole thing. Please, don't make changes to my patches on your own.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
and please, learn how to properly submit patch series.
Lastly, do the changes that you want/need to implement in your code, and don't submit my patch as part of those changes again.
You can correct this patch by yourself.
https://lore.kernel.org/linux-hardening/ad8987ae-b7fe-47af- [email protected]/
You need to do some changes in your commit.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
This is what you haven't understood yet. If the original code is wrong (e.g. is currently using struct
ib_sgeinstead of structrxe_sgeor the other way around), then _that_ code should be fixed _first_, regardless of any other patch that might be applied on top of it.Your commit should align the 2 structs.
No. It should not. To understand why, read my previous responses.
There is something wrong in your commit. Please correct it. I have already pointed it out.
Yanjun.Zhu
Quoted 3 lines
-Gustavo
Quoted 33 lines · Leon Romanovsky
Quoted 32 lines · Zhu Yanjun
Quoted 31 lines · Gustavo A. R. Silva
Quoted 29 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>---
V2->V3: Replace structib_sgewith structrxe_sge
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What are you doing?
Because struct
rxe_sgediffers from structib_sge, I aligned it to use the same structure.Zhu,
Please submit your
rxe_sgetoib_sgechange as standalone patch and Gustavo will resubmit his patch later if he wants so.
OK. I will do soon.
Yanjun.Zhu
Quoted 2 lines
Thanks
Signature · 2 lines
Best Regards, Yanjun.Zhu
Quoted 24 lines · Gustavo A. R. Silva
Quoted 20 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.
Quoted 7 lines
Quoted 5 lines
Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>NACK.
Just a small reminder about community conventions: reviewers can NACK a patch, but authors generally should not NACK their own patches.
Quoted 71 lines
I didn't write this patch.
Please, don't ever submit modified patches on my behalf.
Quoted 2 lines
---
V2->V3: Replace structib_sgewith structrxe_sgePatch granularity is a fundamental thing. Changes addressing different issues should not be mixed together. Previously existing issues (if any) must be addressed in separate patches.
-Gustavo
Quoted 55 lines
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +11
-7@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */ @@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Quoted 29 lines · Greg Sword
Quoted 27 lines · Gustavo A. R. Silva
Quoted 23 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>NACK.
Just a small reminder about community conventions: reviewers can NACK a patch, but authors generally should not NACK their own patches.
It's obvious that you don't understand what's going on here.
Quoted 1 line
Quoted 1 line
I didn't write this patch.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This line should've given you a clue.
-Gustavo
Quoted 69 lines
Quoted 69 lines
Please, don't ever submit modified patches on my behalf.
Quoted 2 lines
---
V2->V3: Replace structib_sgewith structrxe_sgePatch granularity is a fundamental thing. Changes addressing different issues should not be mixed together. Previously existing issues (if any) must be addressed in separate patches.
-Gustavo
Quoted 55 lines
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +11
-7@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */ @@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Quoted 36 lines · Gustavo A. R. Silva
Quoted 32 lines · Greg Sword
Quoted 30 lines · Gustavo A. R. Silva
Quoted 25 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
NACK.
Just a small reminder about community conventions: reviewers can NACK a patch, but authors generally should not NACK their own patches.
It's obvious that you don't understand what's going on here.
I’ve read through the full discussion and understand how this evolved. Based on that, I believe there may be a misunderstanding on your side.
Quoted 78 lines
Quoted 2 lines
Quoted 2 lines
I didn't write this patch.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This line should've given you a clue.-Gustavo
Quoted 69 lines
Quoted 69 lines
Please, don't ever submit modified patches on my behalf.
Quoted 2 lines
---
V2->V3: Replace structib_sgewith structrxe_sgePatch granularity is a fundamental thing. Changes addressing different issues should not be mixed together. Previously existing issues (if any) must be addressed in separate patches.
-Gustavo
Quoted 55 lines
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +11
-7@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */ @@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Quoted 40 lines · Greg Sword
Quoted 38 lines · Gustavo A. R. Silva
Quoted 34 lines · Greg Sword
Quoted 31 lines · Gustavo A. R. Silva
Quoted 20 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Quoted 5 lines
Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>NACK.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Just a small reminder about community conventions: reviewers can NACK a patch, but authors generally should not NACK their own patches.
It's obvious that you don't understand what's going on here.
I’ve read through the full discussion and understand how this evolved. Based on that, I believe there may be a misunderstanding on your side.
Okay, thanks for your contribution then.
-Gustavo
Quoted 79 lines
Quoted 79 lines
Quoted 3 lines
Quoted 3 lines
I didn't write this patch.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This line should've given you a clue.-Gustavo
Quoted 69 lines
Quoted 69 lines
Please, don't ever submit modified patches on my behalf.
Quoted 2 lines
---
V2->V3: Replace structib_sgewith structrxe_sgePatch granularity is a fundamental thing. Changes addressing different issues should not be mixed together. Previously existing issues (if any) must be addressed in separate patches.
-Gustavo
Quoted 55 lines
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +11
-7@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */ @@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Quoted 46 lines · Gustavo A. R. Silva
Quoted 43 lines · Greg Sword
Quoted 41 lines · Gustavo A. R. Silva
Quoted 36 lines · Greg Sword
Quoted 24 lines · Gustavo A. R. Silva
Quoted 20 lines · Zhu Yanjun
From: "Gustavo A. R. Silva" <[email protected]>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Use the new
TRAILING_OVERLAP()helper to fix the following warning:21
drivers/infiniband/sw/rxe/rxe_verbs.h:271:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]This helper creates a union between a flexible-array member (FAM) and a set of MEMBERS that would otherwise follow it.
This overlays the trailing MEMBER struct
ib_sgesge[RXE_MAX_SGE]; onto the FAM structrxe_recv_wqe::dma.sge, while keeping the FAM and the start of MEMBER aligned.The
static_assert()ensures this alignment remains, and it's intentionally placed inmediately after the related structure --no blank line in between.Quoted 7 lines
Quoted 5 lines
Lastly, move the conflicting declaration struct
rxe_resp_inforesp; to the end of the corresponding structure.Reviewed-by Zhu Yanjun <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>NACK.
Just a small reminder about community conventions: reviewers can NACK a patch, but authors generally should not NACK their own patches.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
It's obvious that you don't understand what's going on here.
I’ve read through the full discussion and understand how this evolved. Based on that, I believe there may be a misunderstanding on your side.
Okay, thanks for your contribution then.
Gustavo,
A more fundamental issue than patch granularity is simply treating others with respect, even when you disagree with them.
Zhu cares about RXE, and he respected your work by trying to address your problem, not his own. RXE functions correctly without your patch, and this hardening effort does not apply to RXE at all.
So please remember that both of you want the same thing, and let's keep the discussion focused on the technical issues.
Thanks
Quoted 83 lines
-Gustavo
Quoted 79 lines
Quoted 79 lines
Quoted 3 lines
Quoted 3 lines
I didn't write this patch.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This line should've given you a clue.-Gustavo
Quoted 69 lines
Quoted 69 lines
Please, don't ever submit modified patches on my behalf.
Quoted 2 lines
---
V2->V3: Replace structib_sgewith structrxe_sgePatch granularity is a fundamental thing. Changes addressing different issues should not be mixed together. Previously existing issues (if any) must be addressed in separate patches.
-Gustavo
Quoted 55 lines
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/infiniband/sw/rxe/rxe_verbs.h +11
-7@@ -219,12 +219,6 @@ struct rxe_resp_info {u32 rkey;u32 length; -/* SRQ only */ -struct { -struct rxe_recv_wqe wqe; -struct ib_sge sge[RXE_MAX_SGE ]; - } srq_wqe; -/* Responder resources. It's a circular list where the oldest * resource is dropped first. */ @@ -232,7 +226,15 @@ struct rxe_resp_info {unsigned int res_head;unsigned int res_tail;struct resp_res *res; + +/* SRQ only */ +/* Must be last as it ends in a flexible-array member. */ + TRAILING_OVERLAP(struct rxe_recv_wqe, wqe, dma.sge, + struct rxe_sge sge[RXE_MAX_SGE]; + ) srq_wqe; }; +static_assert(offsetof(struct rxe_resp_info, srq_wqe.wqe.dma.sge) == + offsetof(struct rxe_resp_info, srq_wqe.sge));struct rxe_qp {struct ib_qp ibqp;@@ -269,7 +271,6 @@ struct rxe_qp {struct rxe_req_info req;struct rxe_comp_info comp; -struct rxe_resp_info resp;atomic_t ssn;atomic_t skb_out;@@ -289,6 +290,9 @@ struct rxe_qp {spinlock_t state_lock;/* guard requester and completer */ struct execute_work cleanup_work; + +/* Must be last as it ends in a flexible-array member. */ +struct rxe_resp_info resp; };enum {
Quoted 2 lines
So please remember that both of you want the same thing, and let's keep the discussion focused on the technical issues.
Absolutely, we all care about the same and, to me, this[1] really marked the end of this thread. So, thanks for your intervention, and thanks Zhu for addressing that issue.
On my side, I'm off the rest of the year. Enjoy some time away from the keyboard everyone, and happy holidays to those who have the chance.
-Gustavo
[1] https://lore.kernel.org/linux-rdma/20251223142055.GC11869@unreal/