From bbe3668811f56b652559b2dd70cf39d25bee61b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sun, 13 Feb 2022 11:28:10 +0100 Subject: [PATCH] - disable broken autodetection of CPU features (misdetecs on ix86) - disable assembly on ix86 (broken detection, no asm there) - fix json time_t parsing code (it's long int on ix86) - merge x32 patch into types, these are just bad assumptions needing casting --- ceph.spec | 19 +++++-- ix86-no-asm.patch | 12 +++++ long-int-time_t.patch | 23 ++++++++ types.patch | 74 ++++++++++++++++++++++++++ use-provided-cpu-flag-values.patch | 37 +++++++++++++ x32.patch | 85 ------------------------------ 6 files changed, 162 insertions(+), 88 deletions(-) create mode 100644 ix86-no-asm.patch create mode 100644 long-int-time_t.patch create mode 100644 use-provided-cpu-flag-values.patch delete mode 100644 x32.patch diff --git a/ceph.spec b/ceph.spec index 80e8def..9b9e972 100644 --- a/ceph.spec +++ b/ceph.spec @@ -49,7 +49,9 @@ Patch3: string-includes.patch Patch4: no-virtualenvs.patch Patch5: system-zstd.patch Patch6: types.patch -Patch7: x32.patch +Patch7: use-provided-cpu-flag-values.patch +Patch8: ix86-no-asm.patch +Patch9: long-int-time_t.patch URL: https://ceph.io/ %{?with_accelio:BuildRequires: accelio-devel} %{?with_babeltrace:BuildRequires: babeltrace-devel} @@ -276,14 +278,25 @@ uruchamiania demonów. %patch4 -p1 %patch5 -p1 %patch6 -p1 -%ifarch x32 %patch7 -p1 -%endif +%patch8 -p1 +%patch9 -p1 %build install -d build cd build %cmake .. \ +%ifarch %{x8664} %{ix86} x32 + -DHAVE_INTEL_SSE=1 \ +%endif +%ifarch %{x8664} x32 + -DHAVE_INTEL_SSE2=1 \ + -DHAVE_INTEL_SSE3=1 \ + -DHAVE_INTEL_SSSE3=1 \ + -DHAVE_INTEL_PCLMUL=1 \ + -DHAVE_INTEL_SSE4_1=1 \ + -DHAVE_INTEL_SSE4_2=1 \ +%endif -DALLOCATOR="%{?with_tcmalloc:tcmalloc}%{!?with_tcmalloc:libc}" \ -DFIO_INCLUDE_DIR=/usr/include/fio \ -DWITH_PYTHON3=%{py3_ver} \ diff --git a/ix86-no-asm.patch b/ix86-no-asm.patch new file mode 100644 index 0000000..70b72c3 --- /dev/null +++ b/ix86-no-asm.patch @@ -0,0 +1,12 @@ +--- ceph-16.2.7/cmake/modules/CheckNasm.cmake~ 2021-12-07 17:15:49.000000000 +0100 ++++ ceph-16.2.7/cmake/modules/CheckNasm.cmake 2022-02-12 19:19:51.463245367 +0100 +@@ -10,6 +10,9 @@ + set(CMAKE_REQUIRED_QUIET true) + include(CheckCXXSourceCompiles) + check_cxx_source_compiles(" ++ #if !defined(__x86_64__) ++ #error ix86 ++ #endif + #if defined(__x86_64__) && defined(__ILP32__) + #error x32 + #endif diff --git a/long-int-time_t.patch b/long-int-time_t.patch new file mode 100644 index 0000000..7fba0d2 --- /dev/null +++ b/long-int-time_t.patch @@ -0,0 +1,23 @@ +--- /home/users/baggins/devel/PLD/rpm/BUILD/ceph-16.2.7/src/json_spirit/json_spirit_value.h.orig 2021-12-07 17:15:49.000000000 +0100 ++++ /home/users/baggins/devel/PLD/rpm/BUILD/ceph-16.2.7/src/json_spirit/json_spirit_value.h 2022-02-13 10:26:48.023109513 +0100 +@@ -51,6 +51,7 @@ + Value_impl( const Array& value ); + Value_impl( bool value ); + Value_impl( int value ); ++ Value_impl( long int value ); + Value_impl( boost::int64_t value ); + Value_impl( boost::uint64_t value ); + Value_impl( double value ); +@@ -294,6 +295,12 @@ + : v_( static_cast< boost::int64_t >( value ) ) + { + } ++ ++ template< class Config > ++ Value_impl< Config >::Value_impl( long int value ) ++ : v_( static_cast< boost::int64_t >( value ) ) ++ { ++ } + + template< class Config > + Value_impl< Config >::Value_impl( boost::int64_t value ) diff --git a/types.patch b/types.patch index 42f061c..8f518c1 100644 --- a/types.patch +++ b/types.patch @@ -28,3 +28,77 @@ { d(5) << size << dendl; +--- ceph-16.2.7/src/common/buffer.cc~ 2021-12-07 17:15:49.000000000 +0100 ++++ ceph-16.2.7/src/common/buffer.cc 2022-02-12 19:45:24.576619502 +0100 +@@ -2272,7 +2272,7 @@ + + void ceph::buffer::list::page_aligned_appender::_refill(size_t len) { + const size_t alloc = \ +- std::max((size_t)min_alloc, (len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK); ++ std::max((size_t)min_alloc, (size_t)((len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK)); + auto new_back = \ + ptr_node::create(buffer::create_page_aligned(alloc)); +--- ceph-16.2.7/src/os/bluestore/BlueFS.cc~ 2021-12-07 17:15:49.000000000 +0100 ++++ ceph-16.2.7/src/os/bluestore/BlueFS.cc 2022-02-12 21:40:54.182516511 +0100 +@@ -3799,7 +3799,7 @@ + if (dist_to_alignment >= len) + return; + len -= dist_to_alignment; +- total += p2align(len, alloc_size); ++ total += p2align((uint64_t)len, alloc_size); + }; + if (alloc[dev]) { + alloc[dev]->dump(iterated_allocation); +--- ceph-16.2.7/src/s3select/include/s3select_functions.h~ 2020-06-23 03:08:18.000000000 +0200 ++++ ceph-16.2.7/src/s3select/include/s3select_functions.h 2022-02-12 22:04:21.710093616 +0100 +@@ -585,7 +585,7 @@ + { + boost::gregorian::date_period dp = + boost::gregorian::date_period( val_dt1.timestamp()->date(), val_dt2.timestamp()->date()); +- result->set_value( dp.length().days() ); ++ result->set_value( (int64_t)dp.length().days() ); + } + else if (strcmp(val_date_part.str(), "hours") == 0) + { +--- ceph-16.2.7/src/librbd/object_map/DiffRequest.cc.orig 2021-12-07 17:15:49.000000000 +0100 ++++ ceph-16.2.7/src/librbd/object_map/DiffRequest.cc 2022-02-12 22:17:55.163378523 +0100 +@@ -187,7 +187,7 @@ + m_object_map.resize(m_object_diff_state->size()); + } + +- uint64_t overlap = std::min(m_object_map.size(), prev_object_diff_state_size); ++ uint64_t overlap = std::min(m_object_map.size(), (uint64_t)prev_object_diff_state_size); + auto it = m_object_map.begin(); + auto overlap_end_it = it + overlap; + auto diff_it = m_object_diff_state->begin(); +--- ceph-16.2.7/src/tools/neorados.cc~ 2021-12-07 17:15:49.000000000 +0100 ++++ ceph-16.2.7/src/tools/neorados.cc 2022-02-12 22:23:25.836643956 +0100 +@@ -205,7 +205,7 @@ + + std::size_t off = 0; + ceph::buffer::list bl; +- while (auto toread = std::max(len - off, io_size)) { ++ while (auto toread = std::max(len - off, (uint64_t)io_size)) { + R::ReadOp op; + op.read(off, toread, &bl); + r.execute(obj, pool, std::move(op), nullptr, y[ec]); +--- ceph-16.2.7/src/tools/cephfs_mirror/FSMirror.cc.orig 2021-12-07 17:15:49.000000000 +0100 ++++ ceph-16.2.7/src/tools/cephfs_mirror/FSMirror.cc 2022-02-12 22:30:46.487298972 +0100 +@@ -345,7 +345,7 @@ + std::scoped_lock locker(m_lock); + m_directories.emplace(dir_path); + m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY, +- m_directories.size()); ++ (uint64_t)m_directories.size()); + + for (auto &[peer, peer_replayer] : m_peer_replayers) { + dout(10) << ": peer=" << peer << dendl; +@@ -363,7 +363,7 @@ + if (it != m_directories.end()) { + m_directories.erase(it); + m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY, +- m_directories.size()); ++ (uint64_t)m_directories.size()); + for (auto &[peer, peer_replayer] : m_peer_replayers) { + dout(10) << ": peer=" << peer << dendl; + peer_replayer->remove_directory(dir_path); diff --git a/use-provided-cpu-flag-values.patch b/use-provided-cpu-flag-values.patch new file mode 100644 index 0000000..55c82b0 --- /dev/null +++ b/use-provided-cpu-flag-values.patch @@ -0,0 +1,37 @@ +diff --git a/cmake/modules/SIMDExt.cmake b/cmake/modules/SIMDExt.cmake +index 5330835aa1..a4dd881e34 100644 +--- a/cmake/modules/SIMDExt.cmake ++++ b/cmake/modules/SIMDExt.cmake +@@ -76,32 +76,25 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64") + set(HAVE_INTEL 1) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64") +- CHECK_C_COMPILER_FLAG(-msse HAVE_INTEL_SSE) + if(HAVE_INTEL_SSE) + set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse") + endif() + if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64") +- CHECK_C_COMPILER_FLAG(-msse2 HAVE_INTEL_SSE2) + if(HAVE_INTEL_SSE2) + set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2") + endif() +- CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3) + if(HAVE_INTEL_SSE3) + set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3") + endif() +- CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3) + if(HAVE_INTEL_SSSE3) + set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3") + endif() +- CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL) + if(HAVE_INTEL_PCLMUL) + set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul") + endif() +- CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1) + if(HAVE_INTEL_SSE4_1) + set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1") + endif() +- CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2) + if(HAVE_INTEL_SSE4_2) + set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2") + endif() diff --git a/x32.patch b/x32.patch deleted file mode 100644 index cb6376b..0000000 --- a/x32.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- ceph-16.2.7/src/common/buffer.cc~ 2021-12-07 17:15:49.000000000 +0100 -+++ ceph-16.2.7/src/common/buffer.cc 2022-02-12 19:45:24.576619502 +0100 -@@ -2272,7 +2272,7 @@ - - void ceph::buffer::list::page_aligned_appender::_refill(size_t len) { - const size_t alloc = \ -- std::max((size_t)min_alloc, (len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK); -+ std::max((size_t)min_alloc, (size_t)((len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK)); - auto new_back = \ - ptr_node::create(buffer::create_page_aligned(alloc)); ---- ceph-16.2.7/src/os/bluestore/BlueFS.cc~ 2021-12-07 17:15:49.000000000 +0100 -+++ ceph-16.2.7/src/os/bluestore/BlueFS.cc 2022-02-12 21:40:54.182516511 +0100 -@@ -3799,7 +3799,7 @@ - if (dist_to_alignment >= len) - return; - len -= dist_to_alignment; -- total += p2align(len, alloc_size); -+ total += p2align((uint64_t)len, alloc_size); - }; - if (alloc[dev]) { - alloc[dev]->dump(iterated_allocation); ---- ceph-16.2.7/src/s3select/include/s3select_functions.h~ 2020-06-23 03:08:18.000000000 +0200 -+++ ceph-16.2.7/src/s3select/include/s3select_functions.h 2022-02-12 22:04:21.710093616 +0100 -@@ -585,7 +585,7 @@ - { - boost::gregorian::date_period dp = - boost::gregorian::date_period( val_dt1.timestamp()->date(), val_dt2.timestamp()->date()); -- result->set_value( dp.length().days() ); -+ result->set_value( (int64_t)dp.length().days() ); - } - else if (strcmp(val_date_part.str(), "hours") == 0) - { ---- ceph-16.2.7/src/librbd/object_map/DiffRequest.cc.orig 2021-12-07 17:15:49.000000000 +0100 -+++ ceph-16.2.7/src/librbd/object_map/DiffRequest.cc 2022-02-12 22:17:55.163378523 +0100 -@@ -187,7 +187,7 @@ - m_object_map.resize(m_object_diff_state->size()); - } - -- uint64_t overlap = std::min(m_object_map.size(), prev_object_diff_state_size); -+ uint64_t overlap = std::min(m_object_map.size(), (uint64_t)prev_object_diff_state_size); - auto it = m_object_map.begin(); - auto overlap_end_it = it + overlap; - auto diff_it = m_object_diff_state->begin(); ---- ceph-16.2.7/src/tools/neorados.cc~ 2021-12-07 17:15:49.000000000 +0100 -+++ ceph-16.2.7/src/tools/neorados.cc 2022-02-12 22:23:25.836643956 +0100 -@@ -205,7 +205,7 @@ - - std::size_t off = 0; - ceph::buffer::list bl; -- while (auto toread = std::max(len - off, io_size)) { -+ while (auto toread = std::max(len - off, (uint64_t)io_size)) { - R::ReadOp op; - op.read(off, toread, &bl); - r.execute(obj, pool, std::move(op), nullptr, y[ec]); ---- ceph-16.2.7/src/tools/cephfs_mirror/FSMirror.cc~ 2021-12-07 17:15:49.000000000 +0100 -+++ ceph-16.2.7/src/tools/cephfs_mirror/FSMirror.cc 2022-02-12 22:28:42.717060249 +0100 -@@ -345,7 +345,7 @@ - std::scoped_lock locker(m_lock); - m_directories.emplace(dir_path); - m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY, -- m_directories.size()); -+ (uint64_t)m_directories.size()); - - for (auto &[peer, peer_replayer] : m_peer_replayers) { - dout(10) << ": peer=" << peer << dendl; ---- ceph-16.2.7/src/tools/cephfs_mirror/FSMirror.cc.orig 2021-12-07 17:15:49.000000000 +0100 -+++ ceph-16.2.7/src/tools/cephfs_mirror/FSMirror.cc 2022-02-12 22:30:46.487298972 +0100 -@@ -345,7 +345,7 @@ - std::scoped_lock locker(m_lock); - m_directories.emplace(dir_path); - m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY, -- m_directories.size()); -+ (uint64_t)m_directories.size()); - - for (auto &[peer, peer_replayer] : m_peer_replayers) { - dout(10) << ": peer=" << peer << dendl; -@@ -363,7 +363,7 @@ - if (it != m_directories.end()) { - m_directories.erase(it); - m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY, -- m_directories.size()); -+ (uint64_t)m_directories.size()); - for (auto &[peer, peer_replayer] : m_peer_replayers) { - dout(10) << ": peer=" << peer << dendl; - peer_replayer->remove_directory(dir_path); -- 2.44.0