[v2] sched: fix for incorrect alignment of bitmap, pipe and queue structs in subport

Message ID 20230207061008.773757-1-megha.ajmera@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] sched: fix for incorrect alignment of bitmap, pipe and queue structs in subport |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build fail github build: failed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Ajmera, Megha Feb. 7, 2023, 6:10 a.m. UTC
  Big structures like bitmap, pipes and queues in subport are addressed
using offset of 'memory' field in subport structures. This means no other
variable should be added after 'memory' variable or else addressing of such
structs like bitmap etc. become incorrect.

Realigned tc_ov_enabled variable in subport structure.

Fixes: f5e60154ade ("sched: enable traffic class oversubscription conditionally")

Signed-off-by: Megha Ajmera <megha.ajmera@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/sched/rte_sched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Thomas Monjalon Feb. 19, 2023, 10:40 p.m. UTC | #1
07/02/2023 07:10, Megha Ajmera:
> Big structures like bitmap, pipes and queues in subport are addressed
> using offset of 'memory' field in subport structures. This means no other
> variable should be added after 'memory' variable or else addressing of such
> structs like bitmap etc. become incorrect.
> 
> Realigned tc_ov_enabled variable in subport structure.
> 
> Fixes: f5e60154ade ("sched: enable traffic class oversubscription conditionally")
> 
> Signed-off-by: Megha Ajmera <megha.ajmera@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

I bet the impact is wrongly explained, but I don't want to look deeper.
Applied.
  
Thomas Monjalon Feb. 19, 2023, 10:43 p.m. UTC | #2
19/02/2023 23:40, Thomas Monjalon:
> 07/02/2023 07:10, Megha Ajmera:
> > Big structures like bitmap, pipes and queues in subport are addressed
> > using offset of 'memory' field in subport structures. This means no other
> > variable should be added after 'memory' variable or else addressing of such
> > structs like bitmap etc. become incorrect.
> > 
> > Realigned tc_ov_enabled variable in subport structure.
> > 
> > Fixes: f5e60154ade ("sched: enable traffic class oversubscription conditionally")
> > 
> > Signed-off-by: Megha Ajmera <megha.ajmera@intel.com>
> > Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> 
> I bet the impact is wrongly explained, but I don't want to look deeper.
> Applied.

And I've added Cc: stable@dpdk.org that David and Cristian asked for.
  

Patch

diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index c91697131d..eaecd7ceb4 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -202,6 +202,9 @@  struct rte_sched_subport {
 	uint32_t qsize_add[RTE_SCHED_QUEUES_PER_PIPE];
 	uint32_t qsize_sum;
 
+	/* TC oversubscription activation */
+	int tc_ov_enabled;
+
 	struct rte_sched_pipe *pipe;
 	struct rte_sched_queue *queue;
 	struct rte_sched_queue_extra *queue_extra;
@@ -210,8 +213,6 @@  struct rte_sched_subport {
 	struct rte_mbuf **queue_array;
 	uint8_t memory[0] __rte_cache_aligned;
 
-	/* TC oversubscription activation */
-	int tc_ov_enabled;
 } __rte_cache_aligned;
 
 struct rte_sched_port {