sys-libs/libomp: Perform PDS checks only for relevant kernel versions
authorMichał Górny <mgorny@gentoo.org>
Tue, 30 Jan 2018 19:29:00 +0000 (20:29 +0100)
committerMichał Górny <mgorny@gentoo.org>
Tue, 30 Jan 2018 19:31:21 +0000 (20:31 +0100)
Update the PDS check logic to apply only when running the Linux kernel,
versions between 4.13 and 4.15. That covers the range of -pf kernels
that have the broken PDS version, and I think we can reasonably assume
users will not be updating the patch along with the kernel.

Also, perform the check only once in pkg_pretend. There is really
no point in repeating it as packages do not alter kernel configuration.

Closes: https://bugs.gentoo.org/638410

sys-libs/libomp/libomp-4.0.1.ebuild
sys-libs/libomp/libomp-5.0.1.ebuild
sys-libs/libomp/libomp-6.0.9999.ebuild
sys-libs/libomp/libomp-9999.ebuild

index 9e63a2165167905697d3d5c163bd0e98c51db72d..7b78f15ca8dd4620026baa257f30b7b4a4e8d3a6 100644 (file)
@@ -21,7 +21,7 @@ SRC_URI="https://releases.llvm.org/${PV/_//}/openmp-${PV/_/}.src.tar.xz"
 LICENSE="|| ( UoI-NCSA MIT ) MIT LLVM-Grant"
 SLOT="0"
 KEYWORDS="amd64 ~arm64 x86"
-IUSE="hwloc ompt test"
+IUSE="hwloc kernel_linux ompt test"
 RESTRICT="!test? ( test )"
 
 RDEPEND="hwloc? ( sys-apps/hwloc:0=[${MULTILIB_USEDEP}] )"
@@ -42,22 +42,28 @@ S=${WORKDIR}/openmp-${PV/_/}.src
 # least intrusive of all
 CMAKE_BUILD_TYPE=RelWithDebInfo
 
-CONFIG_CHECK="~!SCHED_PDS"
-ERROR_SCHED_PDS="PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels
->= 4.13-pf11 < 4.14-pf9) do not implement sched_yield() call which
-may result in horrible performance problems with libomp. If you are using one
-of the specified kernel versions, you may want to disable the PDS scheduler."
-
 python_check_deps() {
        has_version "dev-python/lit[${PYTHON_USEDEP}]"
 }
 
+kernel_pds_check() {
+       if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then
+               local CONFIG_CHECK="~!SCHED_PDS"
+               local ERROR_SCHED_PDS="\
+PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels >= 4.13-pf11
+< 4.14-pf9) do not implement sched_yield() call which may result in horrible
+performance problems with libomp. If you are using one of the specified
+kernel versions, you may want to disable the PDS scheduler."
+
+               check_extra_config
+       fi
+}
+
 pkg_pretend() {
-       linux-info_pkg_setup
+       kernel_pds_check
 }
 
 pkg_setup() {
-       linux-info_pkg_setup
        use test && python-any-r1_pkg_setup
 }
 
index c3c4114ff60515053f75a817e5b19cf2722afbed..6c5b2b9c352cece42db5d3d7177d2a1ccdf7154b 100644 (file)
@@ -21,7 +21,7 @@ SRC_URI="https://releases.llvm.org/${PV/_//}/openmp-${PV/_/}.src.tar.xz"
 LICENSE="|| ( UoI-NCSA MIT ) MIT LLVM-Grant"
 SLOT="0"
 KEYWORDS="amd64 ~arm64 x86"
-IUSE="hwloc ompt test"
+IUSE="hwloc kernel_linux ompt test"
 RESTRICT="!test? ( test )"
 
 RDEPEND="hwloc? ( sys-apps/hwloc:0=[${MULTILIB_USEDEP}] )"
@@ -42,22 +42,28 @@ S=${WORKDIR}/openmp-${PV/_/}.src
 # least intrusive of all
 CMAKE_BUILD_TYPE=RelWithDebInfo
 
-CONFIG_CHECK="~!SCHED_PDS"
-ERROR_SCHED_PDS="PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels
->= 4.13-pf11 < 4.14-pf9) do not implement sched_yield() call which
-may result in horrible performance problems with libomp. If you are using one
-of the specified kernel versions, you may want to disable the PDS scheduler."
-
 python_check_deps() {
        has_version "dev-python/lit[${PYTHON_USEDEP}]"
 }
 
+kernel_pds_check() {
+       if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then
+               local CONFIG_CHECK="~!SCHED_PDS"
+               local ERROR_SCHED_PDS="\
+PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels >= 4.13-pf11
+< 4.14-pf9) do not implement sched_yield() call which may result in horrible
+performance problems with libomp. If you are using one of the specified
+kernel versions, you may want to disable the PDS scheduler."
+
+               check_extra_config
+       fi
+}
+
 pkg_pretend() {
-       linux-info_pkg_setup
+       kernel_pds_check
 }
 
 pkg_setup() {
-       linux-info_pkg_setup
        use test && python-any-r1_pkg_setup
 }
 
index 30de17ed6c2294bccaf929601a0945ec3cdac429..01d1bd791b82a98e3c3812a61dc32f7d072bbbab 100644 (file)
@@ -24,7 +24,7 @@ EGIT_BRANCH="release_60"
 LICENSE="|| ( UoI-NCSA MIT ) MIT LLVM-Grant"
 SLOT="0"
 KEYWORDS=""
-IUSE="cuda hwloc offload ompt test"
+IUSE="cuda hwloc kernel_linux offload ompt test"
 # CUDA works only with the x86_64 ABI
 REQUIRED_USE="offload? ( cuda? ( abi_x86_64 ) )"
 RESTRICT="!test? ( test )"
@@ -51,22 +51,28 @@ DEPEND="${RDEPEND}
 # least intrusive of all
 CMAKE_BUILD_TYPE=RelWithDebInfo
 
-CONFIG_CHECK="~!SCHED_PDS"
-ERROR_SCHED_PDS="PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels
->= 4.13-pf11 < 4.14-pf9) do not implement sched_yield() call which
-may result in horrible performance problems with libomp. If you are using one
-of the specified kernel versions, you may want to disable the PDS scheduler."
-
 python_check_deps() {
        has_version "dev-python/lit[${PYTHON_USEDEP}]"
 }
 
+kernel_pds_check() {
+       if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then
+               local CONFIG_CHECK="~!SCHED_PDS"
+               local ERROR_SCHED_PDS="\
+PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels >= 4.13-pf11
+< 4.14-pf9) do not implement sched_yield() call which may result in horrible
+performance problems with libomp. If you are using one of the specified
+kernel versions, you may want to disable the PDS scheduler."
+
+               check_extra_config
+       fi
+}
+
 pkg_pretend() {
-       linux-info_pkg_setup
+       kernel_pds_check
 }
 
 pkg_setup() {
-       linux-info_pkg_setup
        use test && python-any-r1_pkg_setup
 }
 
index 08c180ec17911abb1a1c331df34101b4ba01b406..75dd8476fff50b06e74c7fed64e41ad3b4d268ca 100644 (file)
@@ -23,7 +23,7 @@ EGIT_REPO_URI="https://git.llvm.org/git/openmp.git
 LICENSE="|| ( UoI-NCSA MIT ) MIT LLVM-Grant"
 SLOT="0"
 KEYWORDS=""
-IUSE="cuda hwloc offload ompt test"
+IUSE="cuda hwloc kernel_linux offload ompt test"
 # CUDA works only with the x86_64 ABI
 REQUIRED_USE="offload? ( cuda? ( abi_x86_64 ) )"
 RESTRICT="!test? ( test )"
@@ -50,22 +50,28 @@ DEPEND="${RDEPEND}
 # least intrusive of all
 CMAKE_BUILD_TYPE=RelWithDebInfo
 
-CONFIG_CHECK="~!SCHED_PDS"
-ERROR_SCHED_PDS="PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels
->= 4.13-pf11 < 4.14-pf9) do not implement sched_yield() call which
-may result in horrible performance problems with libomp. If you are using one
-of the specified kernel versions, you may want to disable the PDS scheduler."
-
 python_check_deps() {
        has_version "dev-python/lit[${PYTHON_USEDEP}]"
 }
 
+kernel_pds_check() {
+       if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then
+               local CONFIG_CHECK="~!SCHED_PDS"
+               local ERROR_SCHED_PDS="\
+PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels >= 4.13-pf11
+< 4.14-pf9) do not implement sched_yield() call which may result in horrible
+performance problems with libomp. If you are using one of the specified
+kernel versions, you may want to disable the PDS scheduler."
+
+               check_extra_config
+       fi
+}
+
 pkg_pretend() {
-       linux-info_pkg_setup
+       kernel_pds_check
 }
 
 pkg_setup() {
-       linux-info_pkg_setup
        use test && python-any-r1_pkg_setup
 }