Skip to contentSkip to conversation

common/cnxk: use atomic load acquire in batch ops

PATCH Superseded Nawal Kishor 4 participants 5 messages Aug 23, 2024 – Jan 23, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/cnxk: use atomic load acquire in batch ops

In roc batch alloc wait code, __ATOMIC_RELAXED is changed to __ATOMIC_ACQUIRE in order to avoid potential out of order loads.

---
 .mailmap                      | 1 +
 drivers/common/cnxk/roc_npa.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
.mailmap +1 -0
index 4a508bafad..14226ccd2d 100644
@@ -1046,6 +1046,7 @@ Natanael Copa <[email protected]>
 Nathan Brown <[email protected]>
 Nathan Law <[email protected]>
 Nathan Skrzypczak <[email protected]>
+Nawal Kishor <[email protected]>
 Neel Patel <[email protected]> <[email protected]>
 Neil Horman <[email protected]>
 Nelio Laranjeiro <[email protected]>
drivers/common/cnxk/roc_npa.h +1 -1
index 4ad5f044b5..ebc2a62536 100644
@@ -247,7 +247,7 @@ roc_npa_batch_alloc_wait(uint64_t *cache_line, unsigned int wait_us)
 	/* Batch alloc status code is updated in bits [5:6] of the first word
 	 * of the 128 byte cache line.
 	 */
-	while (((__atomic_load_n(cache_line, __ATOMIC_RELAXED) >> 5) & 0x3) ==
+	while (((__atomic_load_n(cache_line, __ATOMIC_ACQUIRE) >> 5) & 0x3) ==
 	       ALLOC_CCODE_INVAL)
 		if (wait_us && (plt_tsc_cycles() - start) >= ticks)
 			break;

--
2.34.1

#1 lore raw
Quoted 5 lines · Nawal Kishor

In roc batch alloc wait code, __ATOMIC_RELAXED is changed to __ATOMIC_ACQUIRE in order to avoid potential out of order loads.

Could you add Fixes:

And change subject to common/cnxk: fix ...

#2 lore raw

PATCH v2 1/1 common/cnxk: fix atomic load in batch ops

In reply to Nawal Kishor

In roc batch alloc wait code, __ATOMIC_RELAXED is changed to __ATOMIC_ACQUIRE in order to avoid potential out of order loads.

Fixes 50d08d3934ec ("common/cnxk: fix batch alloc completion poll logic")

---
v2: Fixed review comments

 drivers/common/cnxk/roc_npa.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/cnxk/roc_npa.h +1 -1
index f7cb4460e7..8525038810 100644
@@ -255,7 +255,7 @@ roc_npa_batch_alloc_wait(uint64_t *cache_line, unsigned int wait_us)
 	/* Batch alloc status code is updated in bits [5:6] of the first word
 	 * of the 128 byte cache line.
 	 */
-	while (((__atomic_load_n(cache_line, __ATOMIC_RELAXED) >> 5) & 0x3) ==
+	while (((__atomic_load_n(cache_line, __ATOMIC_ACQUIRE) >> 5) & 0x3) ==
 	       ALLOC_CCODE_INVAL)
 		if (wait_us && (plt_tsc_cycles() - start) >= ticks)
 			break;
Signature · 1 line
2.34.1
#3 lore raw

RE: [PATCH v2] common/cnxk: fix atomic load in batch ops

Quoted 13 lines

-----Original Message-----
From: Nawal Kishor <[email protected]>
Sent: Monday, December 2, 2024 10:28 PM
To: [email protected]; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Sunil Kumar Kori <[email protected]>; Satha Koteswara Rao Kottidi <[email protected]>; Harman Kalra <[email protected]>; Ashwin Sekhar T K <[email protected]>; Jerin Jacob <[email protected]>
Cc: Nawal Kishor <[email protected]>
Subject: [PATCH v2] common/cnxk: fix atomic load in batch ops

Quoted 6 lines

In roc batch alloc wait code, __ATOMIC_RELAXED is changed to __ATOMIC_ACQUIRE in order to avoid potential out of order loads.

Fixes 50d08d3934ec ("common/cnxk: fix batch alloc completion poll logic")

Fixed the following issues and applied to dpdk-next-net-mrvl/for-main. Thanks

Is it candidate for Cc: [email protected] backport?
common/cnxk: fix atomic load in batch ops
Contributor name/email mismatch with .mailmap:
Nawal Kishor <[email protected]> is unknown in .mailmap

Quoted 24 lines

---
v2: Fixed review comments

 drivers/common/cnxk/roc_npa.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/cnxk/roc_npa.h +0 -1
index f7cb4460e7..8525038810 100644
@@ -255,7 +255,7 @@ roc_npa_batch_alloc_wait(uint64_t *cache_line,
 unsigned int wait_us)
 	/* Batch alloc status code is updated in bits [5:6] of the first word
 	 * of the 128 byte cache line.
 	 */
-	while (((__atomic_load_n(cache_line, __ATOMIC_RELAXED) >> 5) &

0x3) ==

drivers/common/cnxk/roc_npa.h +1 -0
+	while (((__atomic_load_n(cache_line, __ATOMIC_ACQUIRE) >> 5) &

0x3) ==

drivers/common/cnxk/roc_npa.h +0 -1
 	       ALLOC_CCODE_INVAL)
 		if (wait_us && (plt_tsc_cycles() - start) >= ticks)
 			break;
--

2.34.1

#4 lore raw

RE: [PATCH v2] common/cnxk: fix atomic load in batch ops

Yes. It is a candidate for backport.

Thanks
Ashwin

Quoted 66 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Wednesday, January 22, 2025 10:31 PM
To: Nawal Kishor <[email protected]>; [email protected]; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Sunil Kumar Kori <[email protected]>; Satha Koteswara Rao Kottidi <[email protected]>; Harman Kalra <[email protected]>; Ashwin Sekhar T K <[email protected]>
Cc: Nawal Kishor <[email protected]>
Subject: RE: [PATCH v2] common/cnxk: fix atomic load in batch ops

Quoted 11 lines

-----Original Message-----
From: Nawal Kishor <[email protected]>
Sent: Monday, December 2, 2024 10:28 PM
To: [email protected]; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Sunil Kumar Kori <[email protected]>; Satha Koteswara Rao Kottidi <[email protected]>; Harman Kalra <[email protected]>; Ashwin Sekhar T K <[email protected]>; Jerin Jacob <[email protected]>
Cc: Nawal Kishor <[email protected]>
Subject: [PATCH v2] common/cnxk: fix atomic load in batch ops

Quoted 7 lines

In roc batch alloc wait code, __ATOMIC_RELAXED is changed to __ATOMIC_ACQUIRE in order to avoid potential out of order loads.

Fixes 50d08d3934ec ("common/cnxk: fix batch alloc completion poll

logic")

Fixed the following issues and applied to dpdk-next-net-mrvl/for-main. Thanks

Is it candidate for Cc: [email protected] backport?
common/cnxk: fix atomic load in batch ops Contributor name/email
mismatch with .mailmap:
Nawal Kishor <[email protected]> is unknown in .mailmap

Quoted 8 lines

---
v2: Fixed review comments

 drivers/common/cnxk/roc_npa.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/common/cnxk/roc_npa.h index f7cb4460e7..8525038810

100644

Quoted 16 lines
drivers/common/cnxk/roc_npa.h +0 -1
@@ -255,7 +255,7 @@ roc_npa_batch_alloc_wait(uint64_t *cache_line,
 unsigned int wait_us)
 	/* Batch alloc status code is updated in bits [5:6] of the first word
 	 * of the 128 byte cache line.
 	 */
-	while (((__atomic_load_n(cache_line, __ATOMIC_RELAXED) >> 5) &

0x3) ==

drivers/common/cnxk/roc_npa.h +1 -0
+	while (((__atomic_load_n(cache_line, __ATOMIC_ACQUIRE) >> 5) &

0x3) ==

drivers/common/cnxk/roc_npa.h +0 -1
 	       ALLOC_CCODE_INVAL)
 		if (wait_us && (plt_tsc_cycles() - start) >= ticks)
 			break;
--

2.34.1