On 6/23/22 15:33, Van Haaren, Harry wrote:
>> -----Original Message-----
>> From: dev <[email protected]> On Behalf Of Ales Musil
>> Sent: Thursday, June 23, 2022 1:41 PM
>> To: [email protected]
>> Cc: [email protected]
>> Subject: [ovs-dev] [PATCH] cpu.c: Build cpu.c without any assumptions about
>> CPU flags
>>
>> The cpu.c was built with multiple feature flags that might
>> not be available on all hosts. It manifested itself as
>> Illegal instruction with crashing on "shlx" instruction
>> which is part of the bmi2 extension, that might not be available
>> on all CPU that openvswitch runs on.
>>
>> Move the cpu.c and cpu.h to lib_libopenvswitch_la_SOURCES which
>> should build it without any assumptions about CPU capabilities.
>
> Although this seems a good solution, the CI shows a linking failure;
> https://mail.openvswitch.org/pipermail/ovs-build/2022-June/022795.html
>
> I think the root cause might be that the avx512 library does not depend on the
> vswitch one, resulting in symbols not being found at link time for avx512 lib?
>
> One solution might be to create a standalone library for cpu.c, and then link
> that in to both avx512 and vswitch libraries? Or there might be alternative
> methods to expose the cpu.c "has_cpu_isa" function to the avx512 library?
libopenvswitch.a is already linked with libopenvswitchavx512.a together
when building binaries, but since cpu.h is an internal header, the
'cpu_has_isa' is not exported, so can not be found while linking.
The easiest solution would be to move the cpu.h into include/openvswitch/
adding appropriate 'extern "C"' declarations. This way it should
be visible during the linking.
Ales, you need to build with CFLAGS='-msse4.2' in order to reproduce the
issue, otherwise avx512 code is mostly skipped during the build.
Best regards, Ilya Maximets.
>
>
>> Fixes: b366fa2f494 ("dpif-netdev: Call cpuid for x86 isa availability. ")
>> Reported-at: https://bugzilla.redhat.com/2100393
>> Signed-off-by: Ales Musil <[email protected]>
>> ---
>> lib/automake.mk | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/automake.mk b/lib/automake.mk
>> index cb50578eb..f082eb75a 100644
>> --- a/lib/automake.mk
>> +++ b/lib/automake.mk
>> @@ -36,8 +36,6 @@ lib_libopenvswitchavx512_la_CFLAGS = \
>> -fPIC \
>> $(AM_CFLAGS)
>> lib_libopenvswitchavx512_la_SOURCES = \
>> - lib/cpu.c \
>> - lib/cpu.h \
>> lib/dpif-netdev-avx512.c
>> if HAVE_AVX512BW
>> lib_libopenvswitchavx512_la_CFLAGS += \
>> @@ -98,6 +96,8 @@ lib_libopenvswitch_la_SOURCES = \
>> lib/csum.h \
>> lib/ct-dpif.c \
>> lib/ct-dpif.h \
>> + lib/cpu.c \
>> + lib/cpu.h \
'p' goes after 'o'.
>> lib/daemon.c \
>> lib/daemon.h \
>> lib/daemon-private.h \
>> --
>> 2.35.3
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev