Skip to contentSkip to conversation

getting rid of type argument to rte_malloc().

DISCUSSION Stephen Hemminger 3 participants 6 messages Apr 24, 2024

lore
Share & tools
lore
#0 lore raw

For the 24.11 release, I want to remove the unused type string argument that shows up in rte_malloc() and related functions, then percolates down through. It was a idea in the 1.0 release of DPDK, never implemented and never removed. Yes it will cause API breakage, a large sweeping change; probably easily scripted with coccinelle.

Maybe doing ABI version now?

#1 lore raw
Quoted 8 lines · Stephen Hemminger

For the 24.11 release, I want to remove the unused type string argument that shows up in rte_malloc() and related functions, then percolates down through. It was a idea in the 1.0 release of DPDK, never implemented and never removed. Yes it will cause API breakage, a large sweeping change; probably easily scripted with coccinelle.

Maybe doing ABI version now?

Won't this impact many applications, is there big enough motivation to force many DPDK applications to update their code, living with it looks simpler.

#2 lore raw
Quoted 7 lines · On Wed, 24 Apr 2024 11:29:51 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 6 lines · Stephen Hemminger

For the 24.11 release, I want to remove the unused type string argument that shows up in rte_malloc() and related functions, then percolates down through. It was a idea in the 1.0 release of DPDK, never implemented and never removed. Yes it will cause API breakage, a large sweeping change; probably easily scripted with coccinelle.

Quoted 7 lines
Quoted 2 lines

Maybe doing ABI version now?

Won't this impact many applications, is there big enough motivation to force many DPDK applications to update their code, living with it looks simpler.

Yeah, probably too big an impact but at least:
- change the documentation to say "do not use" should be NULL
- add script to remove all usage inside of DPDK
- get rid of places where useless arg is passed around inside of the allocator internals.

#3 lore raw
Quoted 23 lines

From: Stephen Hemminger [mailto:[email protected]]
Sent: Wednesday, 24 April 2024 18.24

Quoted 2 lines · On Wed, 24 Apr 2024 11:29:51 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 1 line · Stephen Hemminger

For the 24.11 release, I want to remove the unused type string

argument

Quoted 1 line
Quoted 1 line

that shows up in rte_malloc() and related functions, then percolates

down

Quoted 1 line
Quoted 1 line

through. It was a idea in the 1.0 release of DPDK, never

implemented and

Quoted 1 line
Quoted 1 line

never removed. Yes it will cause API breakage, a large sweeping

change;

Quoted 7 lines
Quoted 4 lines

probably easily scripted with coccinelle.

Maybe doing ABI version now?

Won't this impact many applications, is there big enough motivation to force many DPDK applications to update their code, living with it

looks

Quoted 8 lines
Quoted 2 lines

simpler.

Yeah, probably too big an impact but at least:
- change the documentation to say "do not use" should be NULL
- add script to remove all usage inside of DPDK
- get rid of places where useless arg is passed around inside of the allocator internals.

For the sake of discussion:
Do we want to get rid of the "name" parameter to the memzone allocation functions too? It's somewhat weird that they differ.

Or are rte_memzone allocations considered init and control path, while rte_malloc allocations are considered fast path?

#4 lore raw
Quoted 26 lines · On Wed, 24 Apr 2024 19:09:24 +0200 Morten Brørup <[email protected]>…
Quoted 26 lines

From: Stephen Hemminger [mailto:[email protected]]
Sent: Wednesday, 24 April 2024 18.24

Quoted 2 lines · On Wed, 24 Apr 2024 11:29:51 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 1 line · Stephen Hemminger

For the 24.11 release, I want to remove the unused type string

argument

Quoted 1 line
Quoted 1 line

that shows up in rte_malloc() and related functions, then percolates

down

Quoted 1 line
Quoted 1 line

through. It was a idea in the 1.0 release of DPDK, never

implemented and

Quoted 1 line
Quoted 1 line

never removed. Yes it will cause API breakage, a large sweeping

change;

Quoted 7 lines
Quoted 4 lines

probably easily scripted with coccinelle.

Maybe doing ABI version now?

Won't this impact many applications, is there big enough motivation to force many DPDK applications to update their code, living with it

looks

Quoted 2 lines

simpler.

Quoted 8 lines
Quoted 5 lines

Yeah, probably too big an impact but at least:
- change the documentation to say "do not use" should be NULL
- add script to remove all usage inside of DPDK
- get rid of places where useless arg is passed around inside of the allocator internals.

For the sake of discussion:
Do we want to get rid of the "name" parameter to the memzone allocation functions too? It's somewhat weird that they differ.

The name is used by memzone lookup for secondary process etc.

Quoted 3 lines

Or are rte_memzone allocations considered init and control path, while rte_malloc allocations are considered fast path?

Not really.

#5 lore raw
In reply to Ferruh Yigit
Quoted 7 lines · On Wed, 24 Apr 2024 11:29:51 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 6 lines · Stephen Hemminger

For the 24.11 release, I want to remove the unused type string argument that shows up in rte_malloc() and related functions, then percolates down through. It was a idea in the 1.0 release of DPDK, never implemented and never removed. Yes it will cause API breakage, a large sweeping change; probably easily scripted with coccinelle.

Quoted 7 lines
Quoted 2 lines

Maybe doing ABI version now?

Won't this impact many applications, is there big enough motivation to force many DPDK applications to update their code, living with it looks simpler.

Something like this script, and fix up the result.

From 13ec14dff523f6e896ab55a17a3c66b45bd90bbc Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <[email protected]>
Date: Wed, 24 Apr 2024 09:39:27 -0700
Subject: [PATCH] devtools/cocci: add script to find unnecessary malloc type

The malloc type argument is unused and should be NULL. This script finds and fixes those places.

---
 devtools/cocci/malloc-type.cocci | 33 ++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 devtools/cocci/malloc-type.cocci
devtools/cocci/malloc-type.cocci new file +33 -0
new file mode 100644
index 0000000000..cd74797ecb
@@ -0,0 +1,33 @@
+//
+// The Ting type field in malloc routines was never
+// implemented and should be NULL
+//
+@@
+expression T != NULL;
+expression num, socket, size, align;
+@@
+(
+- rte_malloc(T, size, align)
++ rte_malloc(NULL, size, align)
+|
+- rte_zmalloc(T, size, align)
++ rte_zmalloc(NULL,  size, align)
+|
+- rte_calloc(T, num, size, align)
++ rte_calloc(NULL, num, size, align)
+|
+- rte_realloc(T, size, align)
++ rte_realloc(NULL, size, align)
+|
+- rte_realloc_socket(T, size, align, socket)
++ rte_realloc_socket(NULL, size, align, socket)
+|
+- rte_malloc_socket(T, size, align, socket)
++ rte_malloc_socket(NULL, size, align, socket)
+|
+- rte_zmalloc_socket(T, size, align, socket)
++ rte_zmalloc_socket(NULL, size, align, socket)
+|
+- rte_calloc_socket(T, num, size, align, socket)
++ rte_calloc_socket(NULL, num, size, align, socket)
+)
Signature · 1 line
2.43.0