diff mbox series

[ovs-dev,dpdk-latest] sparse: Fix build with DPDK v23.11-rc1.

Message ID 20230831073223.2737842-1-david.marchand@redhat.com
State Accepted
Headers show
Series [ovs-dev,dpdk-latest] sparse: Fix build with DPDK v23.11-rc1. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

David Marchand Aug. 31, 2023, 7:32 a.m. UTC
After DPDK started relying on compiler intrinsics in rte_cycles.h,
sparse raises the following warning:

libtool: compile:  env REAL_CC=gcc "CHECK=sparse -Wsparse-error
	-I ../../include/sparse -I ../../include -m64
	-I /usr/local/include -I /usr/include/x86_64-linux-gnu
	" cgcc -target=x86_64 -target=host_os_specs -D__MMX__=1
	-D__SSE2_MATH__=1 -D__SSE_MATH__=1 -D__SSE2__=1 -D__SSE__=1
	-DHAVE_CONFIG_H -I. -I../.. -I ../../include -I ./include
	-I ../../lib -I ./lib -Wstrict-prototypes -Wall -Wextra
	-Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security
	-Wswitch-enum -Wunused-parameter -Wbad-function-cast
	-Wcast-align -Wstrict-prototypes -Wold-style-definition
	-Wmissing-prototypes -Wmissing-field-initializers
	-fno-strict-aliasing -Wswitch-bool -Wlogical-not-parentheses
	-Wsizeof-array-argument -Wbool-compare -Wshift-negative-value
	-Wduplicated-cond -Wshadow -Wmultistatement-macros
	-Wcast-align=strict -mssse3 -include rte_config.h -mrtm
	-I/home/runner/work/ovs/ovs/dpdk-dir/include -Werror
	-D_FILE_OFFSET_BITS=64 -g -O2 -MT lib/netdev-dpdk.lo -MD -MP
	-MF lib/.deps/netdev-dpdk.Tpo -c ../../lib/netdev-dpdk.c
	-o lib/netdev-dpdk.o
../../lib/netdev-dpdk.c: note: in included file (through
	/usr/lib/gcc/x86_64-linux-gnu/9//include/x86intrin.h,
	/home/runner/work/ovs/ovs/dpdk-dir/include/rte_cycles.h,
	/home/runner/work/ovs/ovs/dpdk-dir/include/rte_spinlock.h, ...):
/usr/lib/gcc/x86_64-linux-gnu/9//include/ia32intrin.h:114:10: error:
	undefined identifier '__builtin_ia32_rdtsc'

Provide an empty implementation of __builtin_ia32_rdtsc() builtin.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Note: I am sending this early, but please wait before merging this in
dpdk-latest as v23.11-rc1 is far from being ready.
I am expecting more changes in EAL headers and I'll update this patch
if hitting more issues.

---
 include/sparse/automake.mk  |  1 +
 include/sparse/ia32intrin.h | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 include/sparse/ia32intrin.h

Comments

Simon Horman Sept. 1, 2023, 12:19 p.m. UTC | #1
On Thu, Aug 31, 2023 at 09:32:23AM +0200, David Marchand wrote:
> After DPDK started relying on compiler intrinsics in rte_cycles.h,
> sparse raises the following warning:
> 
> libtool: compile:  env REAL_CC=gcc "CHECK=sparse -Wsparse-error
> 	-I ../../include/sparse -I ../../include -m64
> 	-I /usr/local/include -I /usr/include/x86_64-linux-gnu
> 	" cgcc -target=x86_64 -target=host_os_specs -D__MMX__=1
> 	-D__SSE2_MATH__=1 -D__SSE_MATH__=1 -D__SSE2__=1 -D__SSE__=1
> 	-DHAVE_CONFIG_H -I. -I../.. -I ../../include -I ./include
> 	-I ../../lib -I ./lib -Wstrict-prototypes -Wall -Wextra
> 	-Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security
> 	-Wswitch-enum -Wunused-parameter -Wbad-function-cast
> 	-Wcast-align -Wstrict-prototypes -Wold-style-definition
> 	-Wmissing-prototypes -Wmissing-field-initializers
> 	-fno-strict-aliasing -Wswitch-bool -Wlogical-not-parentheses
> 	-Wsizeof-array-argument -Wbool-compare -Wshift-negative-value
> 	-Wduplicated-cond -Wshadow -Wmultistatement-macros
> 	-Wcast-align=strict -mssse3 -include rte_config.h -mrtm
> 	-I/home/runner/work/ovs/ovs/dpdk-dir/include -Werror
> 	-D_FILE_OFFSET_BITS=64 -g -O2 -MT lib/netdev-dpdk.lo -MD -MP
> 	-MF lib/.deps/netdev-dpdk.Tpo -c ../../lib/netdev-dpdk.c
> 	-o lib/netdev-dpdk.o
> ../../lib/netdev-dpdk.c: note: in included file (through
> 	/usr/lib/gcc/x86_64-linux-gnu/9//include/x86intrin.h,
> 	/home/runner/work/ovs/ovs/dpdk-dir/include/rte_cycles.h,
> 	/home/runner/work/ovs/ovs/dpdk-dir/include/rte_spinlock.h, ...):
> /usr/lib/gcc/x86_64-linux-gnu/9//include/ia32intrin.h:114:10: error:
> 	undefined identifier '__builtin_ia32_rdtsc'
> 
> Provide an empty implementation of __builtin_ia32_rdtsc() builtin.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Note: I am sending this early, but please wait before merging this in
> dpdk-latest as v23.11-rc1 is far from being ready.
> I am expecting more changes in EAL headers and I'll update this patch
> if hitting more issues.

Hi David,

It seems appropriate to mark this as deffered in patchwork,
so I have done so.

Patch looks find to me.

Acked-by: Simon Horman <horms@ovn.org>
David Marchand Sept. 1, 2023, 12:48 p.m. UTC | #2
Hello Simon,

On Fri, Sep 1, 2023 at 2:20 PM Simon Horman <horms@ovn.org> wrote:
> > Note: I am sending this early, but please wait before merging this in
> > dpdk-latest as v23.11-rc1 is far from being ready.
> > I am expecting more changes in EAL headers and I'll update this patch
> > if hitting more issues.
>
> Hi David,
>
> It seems appropriate to mark this as deffered in patchwork,
> so I have done so.

Ok for me.
I'll send a new revision if needed, or change the status to NEW in
patchwork otherwise.

>
> Patch looks find to me.
>
> Acked-by: Simon Horman <horms@ovn.org>

Thanks.
Kevin Traynor Oct. 27, 2023, 8:57 a.m. UTC | #3
On 01/09/2023 13:19, Simon Horman wrote:
> On Thu, Aug 31, 2023 at 09:32:23AM +0200, David Marchand wrote:
>> After DPDK started relying on compiler intrinsics in rte_cycles.h,
>> sparse raises the following warning:
>>
>> libtool: compile:  env REAL_CC=gcc "CHECK=sparse -Wsparse-error
>> 	-I ../../include/sparse -I ../../include -m64
>> 	-I /usr/local/include -I /usr/include/x86_64-linux-gnu
>> 	" cgcc -target=x86_64 -target=host_os_specs -D__MMX__=1
>> 	-D__SSE2_MATH__=1 -D__SSE_MATH__=1 -D__SSE2__=1 -D__SSE__=1
>> 	-DHAVE_CONFIG_H -I. -I../.. -I ../../include -I ./include
>> 	-I ../../lib -I ./lib -Wstrict-prototypes -Wall -Wextra
>> 	-Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security
>> 	-Wswitch-enum -Wunused-parameter -Wbad-function-cast
>> 	-Wcast-align -Wstrict-prototypes -Wold-style-definition
>> 	-Wmissing-prototypes -Wmissing-field-initializers
>> 	-fno-strict-aliasing -Wswitch-bool -Wlogical-not-parentheses
>> 	-Wsizeof-array-argument -Wbool-compare -Wshift-negative-value
>> 	-Wduplicated-cond -Wshadow -Wmultistatement-macros
>> 	-Wcast-align=strict -mssse3 -include rte_config.h -mrtm
>> 	-I/home/runner/work/ovs/ovs/dpdk-dir/include -Werror
>> 	-D_FILE_OFFSET_BITS=64 -g -O2 -MT lib/netdev-dpdk.lo -MD -MP
>> 	-MF lib/.deps/netdev-dpdk.Tpo -c ../../lib/netdev-dpdk.c
>> 	-o lib/netdev-dpdk.o
>> ../../lib/netdev-dpdk.c: note: in included file (through
>> 	/usr/lib/gcc/x86_64-linux-gnu/9//include/x86intrin.h,
>> 	/home/runner/work/ovs/ovs/dpdk-dir/include/rte_cycles.h,
>> 	/home/runner/work/ovs/ovs/dpdk-dir/include/rte_spinlock.h, ...):
>> /usr/lib/gcc/x86_64-linux-gnu/9//include/ia32intrin.h:114:10: error:
>> 	undefined identifier '__builtin_ia32_rdtsc'
>>
>> Provide an empty implementation of __builtin_ia32_rdtsc() builtin.
>>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>> ---
>> Note: I am sending this early, but please wait before merging this in
>> dpdk-latest as v23.11-rc1 is far from being ready.
>> I am expecting more changes in EAL headers and I'll update this patch
>> if hitting more issues.
> 
> Hi David,
> 
> It seems appropriate to mark this as deffered in patchwork,
> so I have done so.
> 
> Patch looks find to me.
> 
> Acked-by: Simon Horman <horms@ovn.org>
> 

Thanks David and Simon.

Updated title of the commit to "sparse: Add some compiler intrinsics for 
DPDK build." after talking to David, as there was a (now fixed) 
unrelated build issue at the time of DPDK v23.11-rc1.

Rebased dpdk-latest branch and applied this commit there.

Kevin.
diff mbox series

Patch

diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk
index e966371192..c1229870bb 100644
--- a/include/sparse/automake.mk
+++ b/include/sparse/automake.mk
@@ -4,6 +4,7 @@  noinst_HEADERS += \
         include/sparse/arpa/inet.h \
         include/sparse/bits/floatn.h \
         include/sparse/assert.h \
+        include/sparse/ia32intrin.h \
         include/sparse/math.h \
         include/sparse/numa.h \
         include/sparse/netinet/in.h \
diff --git a/include/sparse/ia32intrin.h b/include/sparse/ia32intrin.h
new file mode 100644
index 0000000000..5045bf38d9
--- /dev/null
+++ b/include/sparse/ia32intrin.h
@@ -0,0 +1,23 @@ 
+/* Copyright (c) 2023 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CHECKER__
+#error "Use this header only with sparse.  It is not a correct implementation."
+#endif
+
+#define __builtin_ia32_rdtsc() (unsigned long long) 0
+
+/* Get actual <ia32intrin.h> definitions for us to annotate and build on. */
+#include_next <ia32intrin.h>