DPDK patches and discussions
 help / color / mirror / Atom feed
* getting rid of type argument to rte_malloc().
@ 2024-04-24  4:08 Stephen Hemminger
  2024-04-24 10:29 ` Ferruh Yigit
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2024-04-24  4:08 UTC (permalink / raw)
  To: dev

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: getting rid of type argument to rte_malloc().
  2024-04-24  4:08 getting rid of type argument to rte_malloc() Stephen Hemminger
@ 2024-04-24 10:29 ` Ferruh Yigit
  2024-04-24 16:23   ` Stephen Hemminger
  2024-04-24 19:06   ` Stephen Hemminger
  0 siblings, 2 replies; 7+ messages in thread
From: Ferruh Yigit @ 2024-04-24 10:29 UTC (permalink / raw)
  To: Stephen Hemminger, dev

On 4/24/2024 5:08 AM, Stephen Hemminger wrote:
> 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: getting rid of type argument to rte_malloc().
  2024-04-24 10:29 ` Ferruh Yigit
@ 2024-04-24 16:23   ` Stephen Hemminger
  2024-04-24 16:23     ` Stephen Hemminger
  2024-04-24 17:09     ` Morten Brørup
  2024-04-24 19:06   ` Stephen Hemminger
  1 sibling, 2 replies; 7+ messages in thread
From: Stephen Hemminger @ 2024-04-24 16:23 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

On Wed, 24 Apr 2024 11:29:51 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 4/24/2024 5:08 AM, Stephen Hemminger wrote:
> > 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.
> 

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: getting rid of type argument to rte_malloc().
  2024-04-24 16:23   ` Stephen Hemminger
@ 2024-04-24 16:23     ` Stephen Hemminger
  2024-04-24 17:09     ` Morten Brørup
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2024-04-24 16:23 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

On Wed, 24 Apr 2024 11:29:51 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 4/24/2024 5:08 AM, Stephen Hemminger wrote:
> > 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.
> 

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: getting rid of type argument to rte_malloc().
  2024-04-24 16:23   ` Stephen Hemminger
  2024-04-24 16:23     ` Stephen Hemminger
@ 2024-04-24 17:09     ` Morten Brørup
  2024-04-24 19:05       ` Stephen Hemminger
  1 sibling, 1 reply; 7+ messages in thread
From: Morten Brørup @ 2024-04-24 17:09 UTC (permalink / raw)
  To: Stephen Hemminger, Ferruh Yigit; +Cc: dev

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Wednesday, 24 April 2024 18.24
> 
> On Wed, 24 Apr 2024 11:29:51 +0100
> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
> > On 4/24/2024 5:08 AM, Stephen Hemminger wrote:
> > > 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.
> >
> 
> 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?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: getting rid of type argument to rte_malloc().
  2024-04-24 17:09     ` Morten Brørup
@ 2024-04-24 19:05       ` Stephen Hemminger
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2024-04-24 19:05 UTC (permalink / raw)
  To: Morten Brørup; +Cc: Ferruh Yigit, dev

On Wed, 24 Apr 2024 19:09:24 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:

> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Wednesday, 24 April 2024 18.24
> > 
> > On Wed, 24 Apr 2024 11:29:51 +0100
> > Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> >   
> > > On 4/24/2024 5:08 AM, Stephen Hemminger wrote:  
> > > > 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.
> > >  
> > 
> > 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.

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

Not really.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: getting rid of type argument to rte_malloc().
  2024-04-24 10:29 ` Ferruh Yigit
  2024-04-24 16:23   ` Stephen Hemminger
@ 2024-04-24 19:06   ` Stephen Hemminger
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2024-04-24 19:06 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

On Wed, 24 Apr 2024 11:29:51 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 4/24/2024 5:08 AM, Stephen Hemminger wrote:
> > 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.
> 


Something like this script, and fix up the result.

From 13ec14dff523f6e896ab55a17a3c66b45bd90bbc Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 devtools/cocci/malloc-type.cocci | 33 ++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 devtools/cocci/malloc-type.cocci

diff --git a/devtools/cocci/malloc-type.cocci b/devtools/cocci/malloc-type.cocci
new file mode 100644
index 0000000000..cd74797ecb
--- /dev/null
+++ b/devtools/cocci/malloc-type.cocci
@@ -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)
+)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-24 19:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24  4:08 getting rid of type argument to rte_malloc() Stephen Hemminger
2024-04-24 10:29 ` Ferruh Yigit
2024-04-24 16:23   ` Stephen Hemminger
2024-04-24 16:23     ` Stephen Hemminger
2024-04-24 17:09     ` Morten Brørup
2024-04-24 19:05       ` Stephen Hemminger
2024-04-24 19:06   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).