patch 'event/cnxk: fix burst timer arm' has been queued to stable release 21.11.4
Kevin Traynor
ktraynor at redhat.com
Thu Feb 23 16:05:29 CET 2023
Hi,
FYI, your patch has been queued to stable release 21.11.4
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/28/23. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/45fb6a4f8af322609d5d41d95dbe2c38c9e7b38e
Thanks.
Kevin
---
>From 45fb6a4f8af322609d5d41d95dbe2c38c9e7b38e Mon Sep 17 00:00:00 2001
From: Pavan Nikhilesh <pbhagavatula at marvell.com>
Date: Thu, 2 Feb 2023 13:40:24 +0530
Subject: [PATCH] event/cnxk: fix burst timer arm
[ upstream commit d8ae421431312a966e924a3064fdc43a92b3264e ]
Fix timer burst arm routine writing improper updates to the bucket.
Fixes: 5f644e1bd14c ("event/cnxk: add timer arm timeout burst")
Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
---
drivers/event/cnxk/cnxk_tim_worker.h | 91 ++++++++++++++--------------
1 file changed, 47 insertions(+), 44 deletions(-)
diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h
index 2a6aa9eab2..24088ca05b 100644
--- a/drivers/event/cnxk/cnxk_tim_worker.h
+++ b/drivers/event/cnxk/cnxk_tim_worker.h
@@ -270,5 +270,6 @@ __retry:
#endif
- if (!(hbt_state & BIT_ULL(34))) {
+ if (!(hbt_state & BIT_ULL(34)) ||
+ !(hbt_state & GENMASK(31, 0))) {
cnxk_tim_bkt_dec_lock(bkt);
goto __retry;
@@ -352,5 +353,6 @@ __retry:
#endif
- if (!(hbt_state & BIT_ULL(34))) {
+ if (!(hbt_state & BIT_ULL(34)) ||
+ !(hbt_state & GENMASK(31, 0))) {
cnxk_tim_bkt_dec_lock(bkt);
goto __retry;
@@ -449,8 +451,8 @@ cnxk_tim_add_entry_brst(struct cnxk_tim_ring *const tim_ring,
struct cnxk_tim_bkt *mirr_bkt;
struct cnxk_tim_bkt *bkt;
- uint16_t chunk_remainder;
+ int16_t chunk_remainder;
uint16_t index = 0;
uint64_t lock_sema;
- int16_t rem, crem;
+ int16_t rem;
uint8_t lock_cnt;
@@ -460,7 +462,38 @@ __retry:
/* Only one thread beyond this. */
lock_sema = cnxk_tim_bkt_inc_lock(bkt);
+
+ /* Bucket related checks. */
+ if (unlikely(cnxk_tim_bkt_get_hbt(lock_sema))) {
+ if (cnxk_tim_bkt_get_nent(lock_sema) != 0) {
+ uint64_t hbt_state;
+#ifdef RTE_ARCH_ARM64
+ asm volatile(PLT_CPU_FEATURE_PREAMBLE
+ " ldxr %[hbt], [%[w1]] \n"
+ " tbz %[hbt], 33, dne%= \n"
+ " sevl \n"
+ "rty%=: wfe \n"
+ " ldxr %[hbt], [%[w1]] \n"
+ " tbnz %[hbt], 33, rty%= \n"
+ "dne%=: \n"
+ : [hbt] "=&r"(hbt_state)
+ : [w1] "r"((&bkt->w1))
+ : "memory");
+#else
+ do {
+ hbt_state = __atomic_load_n(&bkt->w1,
+ __ATOMIC_RELAXED);
+ } while (hbt_state & BIT_ULL(33));
+#endif
+
+ if (!(hbt_state & BIT_ULL(34)) ||
+ !(hbt_state & GENMASK(31, 0))) {
+ cnxk_tim_bkt_dec_lock(bkt);
+ goto __retry;
+ }
+ }
+ }
+
lock_cnt = (uint8_t)((lock_sema >> TIM_BUCKET_W1_S_LOCK) &
TIM_BUCKET_W1_M_LOCK);
-
if (lock_cnt) {
cnxk_tim_bkt_dec_lock(bkt);
@@ -486,42 +519,11 @@ __retry:
}
- /* Bucket related checks. */
- if (unlikely(cnxk_tim_bkt_get_hbt(lock_sema))) {
- if (cnxk_tim_bkt_get_nent(lock_sema) != 0) {
- uint64_t hbt_state;
-#ifdef RTE_ARCH_ARM64
- asm volatile(PLT_CPU_FEATURE_PREAMBLE
- " ldxr %[hbt], [%[w1]] \n"
- " tbz %[hbt], 33, dne%= \n"
- " sevl \n"
- "rty%=: wfe \n"
- " ldxr %[hbt], [%[w1]] \n"
- " tbnz %[hbt], 33, rty%= \n"
- "dne%=: \n"
- : [hbt] "=&r"(hbt_state)
- : [w1] "r"((&bkt->w1))
- : "memory");
-#else
- do {
- hbt_state = __atomic_load_n(&bkt->w1,
- __ATOMIC_RELAXED);
- } while (hbt_state & BIT_ULL(33));
-#endif
-
- if (!(hbt_state & BIT_ULL(34))) {
- cnxk_tim_bkt_dec_lock(bkt);
- goto __retry;
- }
- }
- }
-
chunk_remainder = cnxk_tim_bkt_fetch_rem(lock_sema);
rem = chunk_remainder - nb_timers;
if (rem < 0) {
- crem = tim_ring->nb_chunk_slots - chunk_remainder;
- if (chunk_remainder && crem) {
+ if (chunk_remainder > 0) {
chunk = ((struct cnxk_tim_ent *)
mirr_bkt->current_chunk) +
- crem;
+ tim_ring->nb_chunk_slots - chunk_remainder;
index = cnxk_tim_cpy_wrk(index, chunk_remainder, chunk,
@@ -537,16 +539,17 @@ __retry:
if (unlikely(chunk == NULL)) {
- cnxk_tim_bkt_dec_lock(bkt);
+ cnxk_tim_bkt_dec_lock_relaxed(bkt);
rte_errno = ENOMEM;
tim[index]->state = RTE_EVENT_TIMER_ERROR;
- return crem;
+ return index;
}
*(uint64_t *)(chunk + tim_ring->nb_chunk_slots) = 0;
mirr_bkt->current_chunk = (uintptr_t)chunk;
- cnxk_tim_cpy_wrk(index, nb_timers, chunk, tim, ents, bkt);
+ index = cnxk_tim_cpy_wrk(index, nb_timers, chunk, tim, ents,
+ bkt) -
+ index;
- rem = nb_timers - chunk_remainder;
- cnxk_tim_bkt_set_rem(bkt, tim_ring->nb_chunk_slots - rem);
- cnxk_tim_bkt_add_nent(bkt, rem);
+ cnxk_tim_bkt_set_rem(bkt, tim_ring->nb_chunk_slots - index);
+ cnxk_tim_bkt_add_nent(bkt, index);
} else {
chunk = (struct cnxk_tim_ent *)mirr_bkt->current_chunk;
--
2.39.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2023-02-23 14:46:24.750212279 +0000
+++ 0038-event-cnxk-fix-burst-timer-arm.patch 2023-02-23 14:46:23.759235928 +0000
@@ -1 +1 @@
-From d8ae421431312a966e924a3064fdc43a92b3264e Mon Sep 17 00:00:00 2001
+From 45fb6a4f8af322609d5d41d95dbe2c38c9e7b38e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d8ae421431312a966e924a3064fdc43a92b3264e ]
+
@@ -9 +10,0 @@
-Cc: stable at dpdk.org
@@ -17 +18 @@
-index 16909ef06d..5fa1acca90 100644
+index 2a6aa9eab2..24088ca05b 100644
@@ -20 +21 @@
-@@ -273,5 +273,6 @@ __retry:
+@@ -270,5 +270,6 @@ __retry:
@@ -28 +29 @@
-@@ -355,5 +356,6 @@ __retry:
+@@ -352,5 +353,6 @@ __retry:
@@ -36 +37 @@
-@@ -452,8 +454,8 @@ cnxk_tim_add_entry_brst(struct cnxk_tim_ring *const tim_ring,
+@@ -449,8 +451,8 @@ cnxk_tim_add_entry_brst(struct cnxk_tim_ring *const tim_ring,
@@ -47 +48 @@
-@@ -463,7 +465,38 @@ __retry:
+@@ -460,7 +462,38 @@ __retry:
@@ -87 +88 @@
-@@ -489,42 +522,11 @@ __retry:
+@@ -486,42 +519,11 @@ __retry:
@@ -132 +133 @@
-@@ -540,16 +542,17 @@ __retry:
+@@ -537,16 +539,17 @@ __retry:
More information about the stable
mailing list