From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B1F34138359 for ; Wed, 9 Sep 2020 21:43:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9502E0874; Wed, 9 Sep 2020 21:43:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id ACD5EE0874 for ; Wed, 9 Sep 2020 21:43:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7CBB2340EC8 for ; Wed, 9 Sep 2020 21:43:17 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DBFE8EC for ; Wed, 9 Sep 2020 21:43:15 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1599687789.39fc2ebd4d6f9a7f866485735704745e2c1e88a9.whissi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libhugetlbfs/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-libs/libhugetlbfs/Manifest sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild X-VCS-Directories: sys-libs/libhugetlbfs/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 39fc2ebd4d6f9a7f866485735704745e2c1e88a9 X-VCS-Branch: master Date: Wed, 9 Sep 2020 21:43:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9ea6b6b8-f028-4948-9d70-8af31c3920c8 X-Archives-Hash: 21501de7cce095680b6e90d1b0024971 commit: 39fc2ebd4d6f9a7f866485735704745e2c1e88a9 Author: Thomas Deutschmann gentoo org> AuthorDate: Wed Sep 9 21:31:51 2020 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Sep 9 21:43:09 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39fc2ebd sys-libs/libhugetlbfs: bump to v2.23 Package-Manager: Portage-3.0.6, Repoman-3.0.1 Signed-off-by: Thomas Deutschmann gentoo.org> sys-libs/libhugetlbfs/Manifest | 1 + sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild | 159 +++++++++++++++++++++++++ 2 files changed, 160 insertions(+) diff --git a/sys-libs/libhugetlbfs/Manifest b/sys-libs/libhugetlbfs/Manifest index 64af61835b8..a5167aec9e3 100644 --- a/sys-libs/libhugetlbfs/Manifest +++ b/sys-libs/libhugetlbfs/Manifest @@ -1 +1,2 @@ DIST libhugetlbfs-2.22.tar.gz 175099 BLAKE2B e67a6a678065b10492d510b733b7c6e2926f4f01dd741d49f6e76cedde002fa81d7dad6a6fd8922443c6aacd527c9b3df35f84b8da7332c04e3fcf8c52e23084 SHA512 7f38f9fa576841f36c7cd5192a9ee3f79b275b7b64d7e2a838a43636489cf88627bdba3a045d6b3302a4a509cf64627972b569b4c2c3c4fe05d5aa4ae1d66fd8 +DIST libhugetlbfs-2.23.tar.gz 175459 BLAKE2B f469ff9a65364e9f0e04c11c8010c958855ebd4d50e1dd719576cda7c280586623404304be64a794907a5fb1d97bd9c0620a91d7a2492577e04fa40ff432b4c7 SHA512 fc9a7d59bcda9d3ca9c9e43a3a348f989c9cbdbbb77f21a43a06e71eacd05bbe5a7b2b51e20ae9ea00da9f1c4d1130da529bbfb702e8c9d11cab6efadd3dc168 diff --git a/sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild b/sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild new file mode 100644 index 00000000000..255bcb160f2 --- /dev/null +++ b/sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild @@ -0,0 +1,159 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7,8,9} ) + +inherit multilib toolchain-funcs python-any-r1 + +DESCRIPTION="easy hugepage access" +HOMEPAGE="https://github.com/libhugetlbfs/libhugetlbfs" +SRC_URI="https://github.com/libhugetlbfs/libhugetlbfs/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~s390 ~x86" +IUSE="static-libs test" +RESTRICT="!test? ( test )" + +DEPEND="test? ( ${PYTHON_DEPS} )" + +PATCHES=( + "${FILESDIR}"/${PN}-2.6-fixup-testsuite.patch +) + +src_prepare() { + default + sed -i \ + -e '/^PREFIX/s:/local::' \ + -e '1iBUILDTYPE = NATIVEONLY' \ + -e '1iV = 1' \ + -e '/gzip.*MANDIR/d' \ + -e "/^LIB\(32\)/s:=.*:= $(get_libdir):" \ + -e '/^CC\(32\|64\)/s:=.*:= $(CC):' \ + -e 's@^\(ARCH\) ?=@\1 =@' \ + Makefile || die "sed failed" + if [ "$(get_libdir)" == "lib64" ]; then + sed -i \ + -e "/^LIB\(32\)/s:=.*:= lib32:" \ + Makefile + fi + + # Tarballs from github don't have the version set. + # https://github.com/libhugetlbfs/libhugetlbfs/issues/7 + [[ -f version ]] || echo "${PV}" > version +} + +src_compile() { + tc-export AR + emake CC="$(tc-getCC)" libs tools +} + +src_install() { + default + use static-libs || rm -f "${ED}"/usr/$(get_libdir)/*.a +} + +src_test_alloc_one() { + hugeadm="$1" + sign="$2" + pagesize="$3" + pagecount="$4" + ${hugeadm} \ + --pool-pages-max ${pagesize}:${sign}${pagecount} \ + && \ + ${hugeadm} \ + --pool-pages-min ${pagesize}:${sign}${pagecount} + return $? +} + +# die is NOT allowed in this src_test block after the marked point, so that we +# can clean up memory allocation. You'll leak at LEAST 64MiB per run otherwise. +src_test() { + [[ $UID -eq 0 ]] || die "Need FEATURES=-userpriv to run this testsuite" + einfo "Building testsuite" + emake -j1 tests + + local hugeadm='obj/hugeadm' + local allocated='' + local rc=0 + # the testcases need 64MiB per pagesize. + local MIN_HUGEPAGE_RAM=$((64*1024*1024)) + + einfo "Planning allocation" + local PAGESIZES="$(${hugeadm} --page-sizes-all)" + + # Need to do this before we can create the mountpoints. + local pagesize pagecount + for pagesize in ${PAGESIZES} ; do + # The kernel depends on the location :-( + mkdir -p /var/lib/hugetlbfs/pagesize-${pagesize} + addwrite /var/lib/hugetlbfs/pagesize-${pagesize} + done + addwrite /proc/sys/vm/ + addwrite /proc/sys/kernel/shmall + addwrite /proc/sys/kernel/shmmax + addwrite /proc/sys/kernel/shmmni + + einfo "Checking HugeTLB mountpoints" + ${hugeadm} --create-mounts || die "Failed to set up hugetlb mountpoints." + + # ----------------------------------------------------- + # --------- die is unsafe after this point. ----------- + # ----------------------------------------------------- + + einfo "Starting allocation" + for pagesize in ${PAGESIZES} ; do + pagecount=$((${MIN_HUGEPAGE_RAM}/${pagesize})) + einfo " ${pagecount} @ ${pagesize}" + addwrite /var/lib/hugetlbfs/pagesize-${pagesize} + src_test_alloc_one "${hugeadm}" "+" "${pagesize}" "${pagecount}" + rc=$? + if [[ ${rc} -eq 0 ]]; then + allocated="${allocated} ${pagesize}:${pagecount}" + else + eerror "Failed to add ${pagecount} pages of size ${pagesize}" + fi + done + + einfo "Allocation status" + ${hugeadm} --pool-list + + if [[ -n "${allocated}" ]]; then + # All our allocations worked, so time to run. + einfo "Starting tests" + cd "${S}"/tests || die + local TESTOPTS="-t func" + case ${ARCH} in + amd64|ppc64) + TESTOPTS="${TESTOPTS} -b 64" + ;; + x86) + TESTOPTS="${TESTOPTS} -b 32" + ;; + esac + # This needs a bit of work to give a nice exit code still. + ./run_tests.py ${TESTOPTS} + rc=$? + else + eerror "Failed to make HugeTLB allocations." + rc=1 + fi + + einfo "Cleaning up memory" + cd "${S}" || die + # Cleanup memory allocation + for alloc in ${allocated} ; do + pagesize="${alloc/:*}" + pagecount="${alloc/*:}" + einfo " ${pagecount} @ ${pagesize}" + src_test_alloc_one "$hugeadm" "-" "${pagesize}" "${pagecount}" + done + + # --------------------------------------------------------- + # --------- die is safe again after this point. ----------- + # --------------------------------------------------------- + + return ${rc} +}