DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] devtools: stop compiler atomics with no C11 equivalent
@ 2023-03-20 16:22 Tyler Retzlaff
  2023-03-22 18:08 ` Tyler Retzlaff
  2023-04-04  0:21 ` [PATCH v2] " Tyler Retzlaff
  0 siblings, 2 replies; 8+ messages in thread
From: Tyler Retzlaff @ 2023-03-20 16:22 UTC (permalink / raw)
  To: dev; +Cc: thomas, Tyler Retzlaff

Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
to ease future adoption of C11 standard atomics.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 1dee094..1ed6d51 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using __atomic_{add,and,nand,or,sub,xor}_fetch' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# forbid use of __reserved which is a reserved keyword in Windows system headers
 	awk -v FOLDERS="lib drivers app examples" \
 		-v EXPRESSIONS='\\<__reserved\\>' \
-- 
1.8.3.1


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

* Re: [PATCH] devtools: stop compiler atomics with no C11 equivalent
  2023-03-20 16:22 [PATCH] devtools: stop compiler atomics with no C11 equivalent Tyler Retzlaff
@ 2023-03-22 18:08 ` Tyler Retzlaff
  2023-03-22 18:25   ` Morten Brørup
  2023-04-04  0:21 ` [PATCH v2] " Tyler Retzlaff
  1 sibling, 1 reply; 8+ messages in thread
From: Tyler Retzlaff @ 2023-03-22 18:08 UTC (permalink / raw)
  To: dev; +Cc: thomas, mb, Honnappa.Nagarahalli, david.marchand

adding a few more people to cc for attention

On Mon, Mar 20, 2023 at 09:22:01AM -0700, Tyler Retzlaff wrote:
> Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> to ease future adoption of C11 standard atomics.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  devtools/checkpatches.sh | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index 1dee094..1ed6d51 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
>  		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
>  		"$1" || res=1
>  
> +	# refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> +	awk -v FOLDERS="lib drivers app examples" \
> +		-v EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
> +		-v RET_ON_FAIL=1 \
> +		-v MESSAGE='Using __atomic_{add,and,nand,or,sub,xor}_fetch' \
> +		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> +		"$1" || res=1
> +
>  	# forbid use of __reserved which is a reserved keyword in Windows system headers
>  	awk -v FOLDERS="lib drivers app examples" \
>  		-v EXPRESSIONS='\\<__reserved\\>' \
> -- 
> 1.8.3.1

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

* RE: [PATCH] devtools: stop compiler atomics with no C11 equivalent
  2023-03-22 18:08 ` Tyler Retzlaff
@ 2023-03-22 18:25   ` Morten Brørup
  2023-03-22 21:00     ` Tyler Retzlaff
  0 siblings, 1 reply; 8+ messages in thread
From: Morten Brørup @ 2023-03-22 18:25 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: thomas, Honnappa.Nagarahalli, david.marchand

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 22 March 2023 19.08
> 
> adding a few more people to cc for attention
> 
> On Mon, Mar 20, 2023 at 09:22:01AM -0700, Tyler Retzlaff wrote:
> > Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> > to ease future adoption of C11 standard atomics.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  devtools/checkpatches.sh | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> > index 1dee094..1ed6d51 100755
> > --- a/devtools/checkpatches.sh
> > +++ b/devtools/checkpatches.sh
> > @@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
> >  		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk
> \
> >  		"$1" || res=1
> >
> > +	# refrain from using compiler
> __atomic_{add,and,nand,or,sub,xor}_fetch()
> > +	awk -v FOLDERS="lib drivers app examples" \
> > +		-v
> EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
> > +		-v RET_ON_FAIL=1 \
> > +		-v MESSAGE='Using __atomic_{add,and,nand,or,sub,xor}_fetch'
> \

Suggest that you expand the error message with a solution for the developer: "... use __atomic_fetch_op() instead of __atomic_op_fetch()"

> > +		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk
> \
> > +		"$1" || res=1
> > +
> >  	# forbid use of __reserved which is a reserved keyword in Windows
> system headers
> >  	awk -v FOLDERS="lib drivers app examples" \
> >  		-v EXPRESSIONS='\\<__reserved\\>' \
> > --
> > 1.8.3.1


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

* Re: [PATCH] devtools: stop compiler atomics with no C11 equivalent
  2023-03-22 18:25   ` Morten Brørup
@ 2023-03-22 21:00     ` Tyler Retzlaff
  2023-03-22 21:48       ` Morten Brørup
  0 siblings, 1 reply; 8+ messages in thread
From: Tyler Retzlaff @ 2023-03-22 21:00 UTC (permalink / raw)
  To: Morten Brørup; +Cc: dev, thomas, Honnappa.Nagarahalli, david.marchand

On Wed, Mar 22, 2023 at 07:25:09PM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 22 March 2023 19.08
> > 
> > adding a few more people to cc for attention
> > 
> > On Mon, Mar 20, 2023 at 09:22:01AM -0700, Tyler Retzlaff wrote:
> > > Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> > > to ease future adoption of C11 standard atomics.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > >  devtools/checkpatches.sh | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > >
> > > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> > > index 1dee094..1ed6d51 100755
> > > --- a/devtools/checkpatches.sh
> > > +++ b/devtools/checkpatches.sh
> > > @@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
> > >  		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk
> > \
> > >  		"$1" || res=1
> > >
> > > +	# refrain from using compiler
> > __atomic_{add,and,nand,or,sub,xor}_fetch()
> > > +	awk -v FOLDERS="lib drivers app examples" \
> > > +		-v
> > EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
> > > +		-v RET_ON_FAIL=1 \
> > > +		-v MESSAGE='Using __atomic_{add,and,nand,or,sub,xor}_fetch'
> > \
> 
> Suggest that you expand the error message with a solution for the developer: "... use __atomic_fetch_op() instead of __atomic_op_fetch()"

if awk could expand captures i would do that but it can't.

or do you mean literally use 'op' instead of {add,and,nand,or,sub,xor}
in the message?

> 
> > > +		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk
> > \
> > > +		"$1" || res=1
> > > +
> > >  	# forbid use of __reserved which is a reserved keyword in Windows
> > system headers
> > >  	awk -v FOLDERS="lib drivers app examples" \
> > >  		-v EXPRESSIONS='\\<__reserved\\>' \
> > > --
> > > 1.8.3.1

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

* RE: [PATCH] devtools: stop compiler atomics with no C11 equivalent
  2023-03-22 21:00     ` Tyler Retzlaff
@ 2023-03-22 21:48       ` Morten Brørup
  0 siblings, 0 replies; 8+ messages in thread
From: Morten Brørup @ 2023-03-22 21:48 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, thomas, Honnappa.Nagarahalli, david.marchand

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 22 March 2023 22.00
> 
> On Wed, Mar 22, 2023 at 07:25:09PM +0100, Morten Brørup wrote:
> > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > Sent: Wednesday, 22 March 2023 19.08
> > >
> > > adding a few more people to cc for attention
> > >
> > > On Mon, Mar 20, 2023 at 09:22:01AM -0700, Tyler Retzlaff wrote:
> > > > Refrain from using compiler
> __atomic_{add,and,nand,or,sub,xor}_fetch()
> > > > to ease future adoption of C11 standard atomics.
> > > >
> > > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > ---
> > > >  devtools/checkpatches.sh | 8 ++++++++
> > > >  1 file changed, 8 insertions(+)
> > > >
> > > > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> > > > index 1dee094..1ed6d51 100755
> > > > --- a/devtools/checkpatches.sh
> > > > +++ b/devtools/checkpatches.sh
> > > > @@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
> > > >  		-f $(dirname $(readlink -f $0))/check-forbidden-
> tokens.awk
> > > \
> > > >  		"$1" || res=1
> > > >
> > > > +	# refrain from using compiler
> > > __atomic_{add,and,nand,or,sub,xor}_fetch()
> > > > +	awk -v FOLDERS="lib drivers app examples" \
> > > > +		-v
> > > EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
> > > > +		-v RET_ON_FAIL=1 \
> > > > +		-v MESSAGE='Using
> __atomic_{add,and,nand,or,sub,xor}_fetch'
> > > \
> >
> > Suggest that you expand the error message with a solution for the
> developer: "... use __atomic_fetch_op() instead of __atomic_op_fetch()"
> 
> if awk could expand captures i would do that but it can't.
> 
> or do you mean literally use 'op' instead of {add,and,nand,or,sub,xor}
> in the message?

I didn't think about expansion, so literally using "op" in the solution part of the message is exactly what I meant. But please keep the existing part of the message as is.

Alternatively, you can also use "{add,and,nand,or,sub,xor}" instead of "op" in the solution part of the message. Whatever you prefer.

The message could be even more verbose by also adding the reason why __atomic_op_fetch() is prohibited, such as: "... in order to prepare for conversion to C11 stdatomics, where atomic_{add,and,nand,or,sub,xor}_fetch() is unavailable."

> 
> >
> > > > +		-f $(dirname $(readlink -f $0))/check-forbidden-
> tokens.awk
> > > \
> > > > +		"$1" || res=1
> > > > +
> > > >  	# forbid use of __reserved which is a reserved keyword in
> Windows
> > > system headers
> > > >  	awk -v FOLDERS="lib drivers app examples" \
> > > >  		-v EXPRESSIONS='\\<__reserved\\>' \
> > > > --
> > > > 1.8.3.1


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

* [PATCH v2] devtools: stop compiler atomics with no C11 equivalent
  2023-03-20 16:22 [PATCH] devtools: stop compiler atomics with no C11 equivalent Tyler Retzlaff
  2023-03-22 18:08 ` Tyler Retzlaff
@ 2023-04-04  0:21 ` Tyler Retzlaff
  2023-04-04  7:38   ` Morten Brørup
  2023-04-25  9:10   ` David Marchand
  1 sibling, 2 replies; 8+ messages in thread
From: Tyler Retzlaff @ 2023-04-04  0:21 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, thomas, mb, Honnappa.Nagarahalli, Tyler Retzlaff

Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
to ease future adoption of C11 standard atomics.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index a07bbc8..1b6841b 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using __atomic_op_fetch use __atomic_fetch_op instead' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# forbid use of __reserved which is a reserved keyword in Windows system headers
 	awk -v FOLDERS="lib drivers app examples" \
 		-v EXPRESSIONS='\\<__reserved\\>' \
-- 
1.8.3.1


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

* RE: [PATCH v2] devtools: stop compiler atomics with no C11 equivalent
  2023-04-04  0:21 ` [PATCH v2] " Tyler Retzlaff
@ 2023-04-04  7:38   ` Morten Brørup
  2023-04-25  9:10   ` David Marchand
  1 sibling, 0 replies; 8+ messages in thread
From: Morten Brørup @ 2023-04-04  7:38 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: david.marchand, thomas, Honnappa.Nagarahalli

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 4 April 2023 02.22
> 
> Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> to ease future adoption of C11 standard atomics.

Seems I forgot to ack v1 when I commented it, so:

Acked-by: Morten Brørup <mb@smartsharesystems.com>


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

* Re: [PATCH v2] devtools: stop compiler atomics with no C11 equivalent
  2023-04-04  0:21 ` [PATCH v2] " Tyler Retzlaff
  2023-04-04  7:38   ` Morten Brørup
@ 2023-04-25  9:10   ` David Marchand
  1 sibling, 0 replies; 8+ messages in thread
From: David Marchand @ 2023-04-25  9:10 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, thomas, mb, Honnappa.Nagarahalli

On Tue, Apr 4, 2023 at 2:21 AM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> to ease future adoption of C11 standard atomics.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  devtools/checkpatches.sh | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index a07bbc8..1b6841b 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
>                 -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
>                 "$1" || res=1
>
> +       # refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> +       awk -v FOLDERS="lib drivers app examples" \
> +               -v EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
> +               -v RET_ON_FAIL=1 \
> +               -v MESSAGE='Using __atomic_op_fetch use __atomic_fetch_op instead' \
> +               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> +               "$1" || res=1
> +
>         # forbid use of __reserved which is a reserved keyword in Windows system headers
>         awk -v FOLDERS="lib drivers app examples" \
>                 -v EXPRESSIONS='\\<__reserved\\>' \
> --
> 1.8.3.1

I tweaked the warning message a bit, and applied.
Thanks.


-- 
David Marchand


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

end of thread, other threads:[~2023-04-25  9:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 16:22 [PATCH] devtools: stop compiler atomics with no C11 equivalent Tyler Retzlaff
2023-03-22 18:08 ` Tyler Retzlaff
2023-03-22 18:25   ` Morten Brørup
2023-03-22 21:00     ` Tyler Retzlaff
2023-03-22 21:48       ` Morten Brørup
2023-04-04  0:21 ` [PATCH v2] " Tyler Retzlaff
2023-04-04  7:38   ` Morten Brørup
2023-04-25  9:10   ` David Marchand

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).