diff mbox

[1/5] erasure-code: conditionally build jerasure sse3/sse4 plugins

Message ID 1414434036-29313-2-git-send-email-j@jannau.net (mailing list archive)
State New, archived
Headers show

Commit Message

Janne Grunau Oct. 27, 2014, 6:20 p.m. UTC
---
 configure.ac                          | 2 ++
 src/erasure-code/jerasure/Makefile.am | 4 ++++
 src/test/erasure-code/Makefile.am     | 4 ++++
 3 files changed, 10 insertions(+)

Comments

Janne Grunau Oct. 27, 2014, 6:44 p.m. UTC | #1
On 2014-10-27 19:20:32 +0100, Janne Grunau wrote:
> ---
>  configure.ac                          | 2 ++
>  src/erasure-code/jerasure/Makefile.am | 4 ++++
>  src/test/erasure-code/Makefile.am     | 4 ++++
>  3 files changed, 10 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 7a0691d..d994712 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -539,6 +539,8 @@ AC_LANG_POP([C++])
>  
>  # Find supported SIMD / SSE extensions supported by the compiler
>  AX_INTEL_FEATURES()
> +AM_CONDITIONAL(HAVE_SSSE3, [ test "x$ax_cv_support_ssse3_ext" = "xyes"])
> +AM_CONDITIONAL(HAVE_SSE4_PCLMUL, [ test "x$ax_cv_support_pclmuldq_ext" = "xyes"])
>  
>  # kinetic osd backend?
>  AC_ARG_WITH([kinetic],
> diff --git a/src/erasure-code/jerasure/Makefile.am b/src/erasure-code/jerasure/Makefile.am
> index 86763af..142c612 100644
> --- a/src/erasure-code/jerasure/Makefile.am
> +++ b/src/erasure-code/jerasure/Makefile.am
> @@ -71,7 +71,9 @@ if LINUX
>  libec_jerasure_sse3_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
>  endif
>  
> +if HAVE_SSSE3
>  erasure_codelib_LTLIBRARIES += libec_jerasure_sse3.la
> +endif

I just realised that this is not exactly safe. While libec_jerasure_sse3 
won't have useful code if HAVE_SSSE3 is not defined, the runtime 
detection in ErasureCodePluginSelectJerasure.cc can still return "sse3".  
That would fail since the sse3 libec_jerasure plugin is not built.

I'll send an updated patch which avoids this problem later.

Janne
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 7a0691d..d994712 100644
--- a/configure.ac
+++ b/configure.ac
@@ -539,6 +539,8 @@  AC_LANG_POP([C++])
 
 # Find supported SIMD / SSE extensions supported by the compiler
 AX_INTEL_FEATURES()
+AM_CONDITIONAL(HAVE_SSSE3, [ test "x$ax_cv_support_ssse3_ext" = "xyes"])
+AM_CONDITIONAL(HAVE_SSE4_PCLMUL, [ test "x$ax_cv_support_pclmuldq_ext" = "xyes"])
 
 # kinetic osd backend?
 AC_ARG_WITH([kinetic],
diff --git a/src/erasure-code/jerasure/Makefile.am b/src/erasure-code/jerasure/Makefile.am
index 86763af..142c612 100644
--- a/src/erasure-code/jerasure/Makefile.am
+++ b/src/erasure-code/jerasure/Makefile.am
@@ -71,7 +71,9 @@  if LINUX
 libec_jerasure_sse3_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
 endif
 
+if HAVE_SSSE3
 erasure_codelib_LTLIBRARIES += libec_jerasure_sse3.la
+endif
 
 libec_jerasure_sse4_la_SOURCES = ${jerasure_sources}
 libec_jerasure_sse4_la_CFLAGS = ${AM_CFLAGS}  \
@@ -98,7 +100,9 @@  if LINUX
 libec_jerasure_sse4_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
 endif
 
+if HAVE_SSE4_PCLMUL
 erasure_codelib_LTLIBRARIES += libec_jerasure_sse4.la
+endif
 
 libec_jerasure_la_SOURCES = \
 	erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
diff --git a/src/test/erasure-code/Makefile.am b/src/test/erasure-code/Makefile.am
index 60f6ee1..958ae4d 100644
--- a/src/test/erasure-code/Makefile.am
+++ b/src/test/erasure-code/Makefile.am
@@ -74,7 +74,9 @@  libec_test_jerasure_sse4_la_CFLAGS = ${AM_CFLAGS}
 libec_test_jerasure_sse4_la_CXXFLAGS= ${AM_CXXFLAGS}
 libec_test_jerasure_sse4_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS)
 libec_test_jerasure_sse4_la_LDFLAGS = ${AM_LDFLAGS} -export-symbols-regex '.*__erasure_code_.*'
+if HAVE_SSE4_PCLMUL
 erasure_codelib_LTLIBRARIES += libec_test_jerasure_sse4.la
+endif
 
 libec_test_jerasure_sse3_la_SOURCES = test/erasure-code/TestJerasurePluginSSE3.cc
 test/erasure-code/TestJerasurePluginSSE3.cc: ./ceph_ver.h
@@ -82,7 +84,9 @@  libec_test_jerasure_sse3_la_CFLAGS = ${AM_CFLAGS}
 libec_test_jerasure_sse3_la_CXXFLAGS= ${AM_CXXFLAGS}
 libec_test_jerasure_sse3_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS)
 libec_test_jerasure_sse3_la_LDFLAGS = ${AM_LDFLAGS} -export-symbols-regex '.*__erasure_code_.*'
+if HAVE_SSSE3
 erasure_codelib_LTLIBRARIES += libec_test_jerasure_sse3.la
+endif
 
 libec_test_jerasure_generic_la_SOURCES = test/erasure-code/TestJerasurePluginGeneric.cc
 test/erasure-code/TestJerasurePluginGeneric.cc: ./ceph_ver.h