diff --git a/0000-build_flags.patch b/0000-build_flags.patch deleted file mode 100644 index 19eced7055aab6293934ff7b4253af7c5c4c6660..0000000000000000000000000000000000000000 --- a/0000-build_flags.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- libhugetlbfs-2.20/tests/Makefile 2018-04-10 02:00:33.613966578 +0200 -+++ libhugetlbfs-2.20/tests/Makefile 2015-12-04 03:04:07.000000000 +0100 -@@ -33,8 +33,8 @@ - HELPER_LIBS = libheapshrink.so - BADTOOLCHAIN = bad-toolchain.sh - --CFLAGS = -O2 -Wall -g --CPPFLAGS = -I.. -+CFLAGS ?= -O2 -Wall -g -+CPPFLAGS += -I.. - STATIC_LIBHUGE = -Wl,--whole-archive -lhugetlbfs -Wl,--no-whole-archive - STATIC_LDLIBS = -Wl,--no-as-needed -lpthread - LDLIBS = $(STATIC_LDLIBS) -ldl -lhugetlbfs_privutils diff --git a/libhugetlbfs-2.23-sw.patch b/0001-add-support-sw64.patch old mode 100755 new mode 100644 similarity index 65% rename from libhugetlbfs-2.23-sw.patch rename to 0001-add-support-sw64.patch index 23290797760ef1161ddf46bcca3db79a3e5d7491..b25fe5500c4d5b1e0dc9eaa1fa56ccf8f41df63e --- a/libhugetlbfs-2.23-sw.patch +++ b/0001-add-support-sw64.patch @@ -1,7 +1,22 @@ -diff -Naur libhugetlbfs-2.23.org/Makefile libhugetlbfs-2.23.sw/Makefile ---- libhugetlbfs-2.23.org/Makefile 2022-03-14 06:37:11.798814120 +0000 -+++ libhugetlbfs-2.23.sw/Makefile 2022-03-14 07:21:44.178814120 +0000 -@@ -63,6 +63,12 @@ +From 206ee484953757ce62dc6364cb70d16a59a6b45b Mon Sep 17 00:00:00 2001 +From: liweigang +Date: Mon, 6 May 2024 09:38:25 +0000 +Subject: [PATCH] add support sw64 + +--- + Makefile.in | 7 ++++++ + ld.hugetlbfs | 4 +-- + sys-sw_64elf.S | 36 +++++++++++++++++++++++++++ + tests/icache-hygiene.c | 4 +-- + tests/mremap-expand-slice-collision.c | 2 +- + 5 files changed, 48 insertions(+), 5 deletions(-) + create mode 100644 sys-sw_64elf.S + +diff --git a/Makefile.in b/Makefile.in +index 65ae5a4..dfaeaca 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -67,6 +67,12 @@ TMPLIB32 = lib ELF32 += armelf_linux_eabi CUSTOM_LDSCRIPTS = no else @@ -14,18 +29,19 @@ diff -Naur libhugetlbfs-2.23.org/Makefile libhugetlbfs-2.23.sw/Makefile ifneq (,$(findstring aarch64,$(ARCH))) CC64 = $(CC) ELF64 = aarch64elf -@@ -121,6 +127,7 @@ +@@ -141,6 +147,7 @@ endif endif endif endif +endif - endif - endif - endif -diff -Naur libhugetlbfs-2.23.org/ld.hugetlbfs libhugetlbfs-2.23.sw/ld.hugetlbfs ---- libhugetlbfs-2.23.org/ld.hugetlbfs 2022-03-14 06:37:11.798814120 +0000 -+++ libhugetlbfs-2.23.sw/ld.hugetlbfs 2022-03-14 06:45:05.998814120 +0000 -@@ -117,7 +117,7 @@ + + ifdef CC32 + OBJDIRS += obj32 +diff --git a/ld.hugetlbfs b/ld.hugetlbfs +index 5e4e497..d828f8b 100755 +--- a/ld.hugetlbfs ++++ b/ld.hugetlbfs +@@ -117,7 +117,7 @@ elf64ppc|elf64lppc) fi ;; elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; @@ -34,7 +50,7 @@ diff -Naur libhugetlbfs-2.23.org/ld.hugetlbfs libhugetlbfs-2.23.sw/ld.hugetlbfs hpage_kb=$(cat /proc/meminfo | grep Hugepagesize: | awk '{print $2}') HPAGE_SIZE=$((hpage_kb * 1024)) SLICE_SIZE=$HPAGE_SIZE ;; -@@ -130,7 +130,7 @@ +@@ -130,7 +130,7 @@ if [ "$HTLB_ALIGN" == "slice" ]; then # targeting the ARM platform one needs to explicitly set the text segment offset # otherwise it will be NULL. case "$EMU" in @@ -43,9 +59,11 @@ diff -Naur libhugetlbfs-2.23.org/ld.hugetlbfs libhugetlbfs-2.23.sw/ld.hugetlbfs printf -v TEXTADDR "%x" "$SLICE_SIZE" HTLBOPTS="$HTLBOPTS -Ttext-segment=$TEXTADDR" ;; elf_i386) HTLBOPTS="$HTLBOPTS -Ttext-segment=0x08000000" ;; -diff -Naur libhugetlbfs-2.23.org/sys-sw_64elf.S libhugetlbfs-2.23.sw/sys-sw_64elf.S ---- libhugetlbfs-2.23.org/sys-sw_64elf.S 1970-01-01 00:00:00.000000000 +0000 -+++ libhugetlbfs-2.23.sw/sys-sw_64elf.S 2022-03-15 01:26:09.058814120 +0000 +diff --git a/sys-sw_64elf.S b/sys-sw_64elf.S +new file mode 100644 +index 0000000..78e0adf +--- /dev/null ++++ b/sys-sw_64elf.S @@ -0,0 +1,36 @@ +/* + * libhugetlbfs - Easy use of Linux hugepages @@ -83,10 +101,11 @@ diff -Naur libhugetlbfs-2.23.org/sys-sw_64elf.S libhugetlbfs-2.23.sw/sys-sw_64el +#if defined(__linux__) && defined(__ELF__) + .section .note.GNU-stack,"",%progbits +#endif -diff -Naur libhugetlbfs-2.23.org/tests/icache-hygiene.c libhugetlbfs-2.23.sw/tests/icache-hygiene.c ---- libhugetlbfs-2.23.org/tests/icache-hygiene.c 2022-03-14 06:37:11.808814120 +0000 -+++ libhugetlbfs-2.23.sw/tests/icache-hygiene.c 2022-03-14 06:42:41.098814120 +0000 -@@ -54,7 +54,7 @@ +diff --git a/tests/icache-hygiene.c b/tests/icache-hygiene.c +index 6f0e417..2e872fe 100644 +--- a/tests/icache-hygiene.c ++++ b/tests/icache-hygiene.c +@@ -54,7 +54,7 @@ static void cacheflush(void *p) { #if defined(__powerpc__) asm volatile("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r"(p)); @@ -95,19 +114,20 @@ diff -Naur libhugetlbfs-2.23.org/tests/icache-hygiene.c libhugetlbfs-2.23.sw/tes __clear_cache(p, p + COPY_SIZE); #endif } -@@ -88,7 +88,7 @@ +@@ -88,7 +88,7 @@ static void sig_handler(int signum, siginfo_t *si, void *uc) { #if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \ defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \ -- defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) -+ defined(__aarch64__) || defined(__sw_64__) || (defined(__riscv) && __riscv_xlen == 64) +- defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64 || __loongarch64) ++ defined(__aarch64__) || defined(__sw_64__) || (defined(__riscv) && __riscv_xlen == 64 || __loongarch64) /* On powerpc, ia64, s390 and Aarch64, 0 bytes are an illegal * instruction, so, if the icache is cleared properly, we SIGILL * as soon as we jump into the cleared page */ -diff -Naur libhugetlbfs-2.23.org/tests/mremap-expand-slice-collision.c libhugetlbfs-2.23.sw/tests/mremap-expand-slice-collision.c ---- libhugetlbfs-2.23.org/tests/mremap-expand-slice-collision.c 2022-03-14 06:37:11.808814120 +0000 -+++ libhugetlbfs-2.23.sw/tests/mremap-expand-slice-collision.c 2022-03-14 06:43:36.328814120 +0000 -@@ -38,7 +38,7 @@ +diff --git a/tests/mremap-expand-slice-collision.c b/tests/mremap-expand-slice-collision.c +index 78c11f2..dc2133c 100644 +--- a/tests/mremap-expand-slice-collision.c ++++ b/tests/mremap-expand-slice-collision.c +@@ -38,7 +38,7 @@ void init_slice_boundary(int fd) unsigned long slice_size; void *p, *heap; int i, rc; @@ -116,3 +136,6 @@ diff -Naur libhugetlbfs-2.23.org/tests/mremap-expand-slice-collision.c libhugetl /* powerpc: 1TB slices starting at 1 TB */ slice_boundary = 0x10000000000; slice_size = 0x10000000000; +-- +2.45.0 + diff --git a/Disable-hugepage-backed-malloc-if-__morecore-is-not-.patch b/Disable-hugepage-backed-malloc-if-__morecore-is-not-.patch deleted file mode 100644 index f996f53376a4f9cffb6d8edd7d890d9249a61c48..0000000000000000000000000000000000000000 --- a/Disable-hugepage-backed-malloc-if-__morecore-is-not-.patch +++ /dev/null @@ -1,261 +0,0 @@ -From 959d74fd0fbbff310943096e15024a84e8f5cba4 Mon Sep 17 00:00:00 2001 -From: Matheus Castanho -Date: Thu, 12 Aug 2021 16:38:46 -0300 -Subject: [PATCH] Disable hugepage-backed malloc if __morecore is not available - -Starting with glibc 2.32, __morecore hook has been marked as deprecated, and was -completely removed on glibc 2.34, which causes an undefined symbol error during -the build of libhugetlbfs. - -Greater changes are needed in order to keep providing the same functionality -with future versions of glibc (see issue #52). Meanwhile, we can disable -hugepage-backed malloc setup if __morecore is not available so users can at -least keep using the other features provided by the library. Related tests are -also conditionally disabled, and will show as SKIPPED if __morecore is not -available. - -Tested on powerpc64le and x86_64 with glibc 2.34 and olders. - -Signed-off-by: Matheus Castanho ---- - Makefile | 6 +++++ - morecore.c | 8 ++++++ - tests/run_tests.py | 67 +++++++++++++++++++++++++++++++++++++++------- - 3 files changed, 71 insertions(+), 10 deletions(-) - -diff --git a/Makefile b/Makefile -index 8b73523..35e53e7 100644 ---- a/Makefile -+++ b/Makefile -@@ -192,6 +192,12 @@ endif - endif - endif - -+# glibc 2.34 removed __morecore, so it may not be available with recent versions -+HAS_MORECORE := $(shell /bin/echo -e '\#include \nvoid * morecore_exists() { return &__morecore; }' | $(CC) -c -xc -o /dev/null - &> /dev/null && /bin/echo yes || /bin/echo no) -+ifeq ($(HAS_MORECORE),yes) -+CFLAGS += -DHAS_MORECORE -+endif -+ - HEADERDIR = $(PREFIX)/include - LIBDIR32 = $(PREFIX)/$(LIB32) - LIBDIR64 = $(PREFIX)/$(LIB64) -diff --git a/morecore.c b/morecore.c -index 6563bbd..405c566 100644 ---- a/morecore.c -+++ b/morecore.c -@@ -33,6 +33,13 @@ - - #include "libhugetlbfs_internal.h" - -+#ifndef HAS_MORECORE -+void hugetlbfs_setup_morecore(void) -+{ -+ INFO("Not setting up morecore because it's not available (see issue #52).\n"); -+} -+#else -+ - static int heap_fd; - - static void *heapbase; -@@ -381,3 +388,4 @@ void hugetlbfs_setup_morecore(void) - * to mmap() if we run out of hugepages. */ - mallopt(M_MMAP_MAX, 0); - } -+#endif /* HAS_MORECORE */ -diff --git a/tests/run_tests.py b/tests/run_tests.py -index 018264d..871d04d 100755 ---- a/tests/run_tests.py -+++ b/tests/run_tests.py -@@ -60,7 +60,7 @@ def snapshot_pool_state(): - l.append((d, tuple(substate))) - return tuple(l) - --def run_test_prog(bits, pagesize, cmd, **env): -+def run_test_prog(bits, pagesize, cmd, output='stdout', **env): - if paranoid_pool_check: - beforepool = snapshot_pool_state() - print("Pool state: %s" % str(beforepool)) -@@ -73,15 +73,17 @@ def run_test_prog(bits, pagesize, cmd, **env): - % (bits, bits, local_env.get("LD_LIBRARY_PATH", "")) - local_env["HUGETLB_DEFAULT_PAGE_SIZE"] = repr(pagesize) - -+ popen_args = {'env' : local_env, output : subprocess.PIPE} -+ - try: -- p = subprocess.Popen(cmd, env=local_env, stdout=subprocess.PIPE) -+ p = subprocess.Popen(cmd, **popen_args) - rc = p.wait() - except KeyboardInterrupt: - # Abort and mark this a strange test result - return (None, "") - except OSError as e: - return (-e.errno, "") -- out = p.stdout.read().decode().strip() -+ out = getattr(p, output).read().decode().strip() - - if paranoid_pool_check: - afterpool = snapshot_pool_state() -@@ -309,6 +311,33 @@ def check_linkhuge_tests(): - okbits.add(bits) - return okbits - -+def check_morecore_disabled(): -+ """ -+ Check if support for morecore is available. -+ -+ Newer glibc versions (>= 2.34) removed the __morecore malloc hook, so tests -+ relying on that functionality will not work as expected, and should be -+ disabled. -+ """ -+ global morecore_disabled, wordsizes, pagesizes -+ -+ # Quick and dirty way to get a word and page size. Which one doesn't really -+ # matter in this case. -+ for wsz in wordsizes: -+ b = wsz -+ break -+ for psz in pagesizes: -+ p = psz -+ break -+ -+ # Run an arbitrary program and check stderr for the "morecore disabled" -+ # message -+ (rc, out) = run_test_prog(b, p, "gethugepagesize", output='stderr', -+ HUGETLB_MORECORE="yes", -+ HUGETLB_VERBOSE="3") -+ -+ morecore_disabled = "Not setting up morecore" in out -+ - def print_cmd(pagesize, bits, cmd, env): - if env: - print(' '.join(['%s=%s' % (k, v) for k, v in env.items()]), end=" ") -@@ -357,14 +386,17 @@ def skip_test(pagesize, bits, cmd, **env): - print_cmd(pagesize, bits, cmd, env) - print("SKIPPED") - --def do_test(cmd, bits=None, **env): -+def do_test(cmd, bits=None, skip=False, **env): - """ - Run a test case, testing each page size and each indicated word size. - """ - if bits == None: bits = wordsizes - for p in pagesizes: - for b in (set(bits) & wordsizes_by_pagesize[p]): -- run_test(p, b, cmd, **env) -+ if skip: -+ skip_test(p, b, cmd, **env) -+ else: -+ run_test(p, b, cmd, **env) - - def do_test_with_rlimit(rtype, limit, cmd, bits=None, **env): - """ -@@ -375,7 +407,7 @@ def do_test_with_rlimit(rtype, limit, cmd, bits=None, **env): - do_test(cmd, bits, **env) - resource.setrlimit(rtype, oldlimit) - --def do_test_with_pagesize(pagesize, cmd, bits=None, **env): -+def do_test_with_pagesize(pagesize, cmd, bits=None, skip=False, **env): - """ - Run a test case, testing with a specified huge page size and - each indicated word size. -@@ -383,7 +415,10 @@ def do_test_with_pagesize(pagesize, cmd, bits=None, **env): - if bits == None: - bits = wordsizes - for b in (set(bits) & wordsizes_by_pagesize[pagesize]): -- run_test(pagesize, b, cmd, **env) -+ if skip: -+ skip_test(pagesize, b, cmd, **env) -+ else: -+ run_test(pagesize, b, cmd, **env) - - def do_elflink_test(cmd, **env): - """ -@@ -533,7 +568,7 @@ def functional_tests(): - """ - Run the set of functional tests. - """ -- global linkhuge_wordsizes -+ global linkhuge_wordsizes, morecore_disabled - - # Kernel background tests not requiring hugepage support - do_test("zero_filesize_segment") -@@ -598,19 +633,24 @@ def functional_tests(): - do_test("fork-cow") - do_test("direct") - do_test_with_pagesize(system_default_hpage_size, "malloc") -+ - do_test_with_pagesize(system_default_hpage_size, "malloc", -+ skip=morecore_disabled, - LD_PRELOAD="libhugetlbfs.so", - HUGETLB_MORECORE="yes") - do_test_with_pagesize(system_default_hpage_size, "malloc", -+ skip=morecore_disabled, - LD_PRELOAD="libhugetlbfs.so", - HUGETLB_MORECORE="yes", - HUGETLB_RESTRICT_EXE="unknown:none") - do_test_with_pagesize(system_default_hpage_size, "malloc", -+ skip=morecore_disabled, - LD_PRELOAD="libhugetlbfs.so", - HUGETLB_MORECORE="yes", - HUGETLB_RESTRICT_EXE="unknown:malloc") - do_test_with_pagesize(system_default_hpage_size, "malloc_manysmall") - do_test_with_pagesize(system_default_hpage_size, "malloc_manysmall", -+ skip=morecore_disabled, - LD_PRELOAD="libhugetlbfs.so", - HUGETLB_MORECORE="yes") - -@@ -630,26 +670,32 @@ def functional_tests(): - do_test_with_pagesize(system_default_hpage_size, "heapshrink", - GLIBC_TUNABLES="glibc.malloc.tcache_count=0", - LD_PRELOAD="libheapshrink.so") -+ - do_test_with_pagesize(system_default_hpage_size, "heapshrink", -+ skip=morecore_disabled, - GLIBC_TUNABLES="glibc.malloc.tcache_count=0", - LD_PRELOAD="libhugetlbfs.so", - HUGETLB_MORECORE="yes") - do_test_with_pagesize(system_default_hpage_size, "heapshrink", -+ skip=morecore_disabled, - GLIBC_TUNABLES="glibc.malloc.tcache_count=0", - LD_PRELOAD="libhugetlbfs.so libheapshrink.so", - HUGETLB_MORECORE="yes") - do_test_with_pagesize(system_default_hpage_size, "heapshrink", -+ skip=morecore_disabled, - GLIBC_TUNABLES="glibc.malloc.tcache_count=0", - LD_PRELOAD="libheapshrink.so", - HUGETLB_MORECORE="yes", - HUGETLB_MORECORE_SHRINK="yes") - do_test_with_pagesize(system_default_hpage_size, "heapshrink", -+ skip=morecore_disabled, - GLIBC_TUNABLES="glibc.malloc.tcache_count=0", - LD_PRELOAD="libhugetlbfs.so libheapshrink.so", - HUGETLB_MORECORE="yes", - HUGETLB_MORECORE_SHRINK="yes") - -- do_test("heap-overflow", HUGETLB_VERBOSE="1", HUGETLB_MORECORE="yes") -+ do_test("heap-overflow", skip=morecore_disabled, HUGETLB_VERBOSE="1", -+ HUGETLB_MORECORE="yes") - - # Run the remapping tests' up-front checks - linkhuge_wordsizes = check_linkhuge_tests() -@@ -747,7 +793,7 @@ def print_help(): - - def main(): - global wordsizes, pagesizes, dangerous, paranoid_pool_check, system_default_hpage_size -- global custom_ldscripts -+ global custom_ldscripts, morecore_disabled - testsets = set() - env_override = {"QUIET_TEST": "1", "HUGETLBFS_MOUNTS": "", - "HUGETLB_ELFMAP": None, "HUGETLB_MORECORE": None} -@@ -802,6 +848,7 @@ def main(): - return 1 - - check_hugetlbfs_path() -+ check_morecore_disabled() - - if "func" in testsets: functional_tests() - if "stress" in testsets: stress_tests() --- -2.23.0.windows.1 - diff --git a/add-loongarch-support.patch b/add-loongarch-support.patch deleted file mode 100644 index e314df9c6cfc31ebe5e97e57c12c4629f54ed08b..0000000000000000000000000000000000000000 --- a/add-loongarch-support.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff --git a/Makefile b/Makefile -index 6ab7ae2..7c0ca79 100644 ---- a/Makefile -+++ b/Makefile -@@ -123,6 +123,12 @@ ELF64 = elf_riscv64 - TMPLIB64 = lib64 - CUSTOM_LDSCRIPTS = no - else -+ifeq ($(ARCH),loongarch64) -+CC64 = $(CC) -+ELF64 = elf_loongarch -+TMPLIB64 = lib64 -+CUSTOM_LDSCRIPTS = no -+else - $(error "Unrecognized architecture ($(ARCH))") - endif - endif -@@ -137,6 +143,7 @@ endif - endif - endif - endif -+endif - - ifdef CC32 - OBJDIRS += obj32 -diff --git a/sys-elf_loongarch.S b/sys-elf_loongarch.S -new file mode 100644 -index 0000000..47fde55 ---- /dev/null -+++ b/sys-elf_loongarch.S -@@ -0,0 +1,20 @@ -+/* -+ * libhugetlbfs - direct system call for LoongArch -+ * -+ * Author(s): Wenlong Zhang -+ */ -+ .text -+ -+ .globl direct_syscall -+direct_syscall: -+ move $a7, $a0 -+ move $a0, $a1 -+ move $a1, $a2 -+ move $a2, $a3 -+ move $a3, $a4 -+ syscall 0 -+ jr $ra -+ -+#if defined(__linux__) && defined(__ELF__) -+ .section .note.GNU-stack,"",%progbits -+#endif -diff --git a/tests/icache-hygiene.c b/tests/icache-hygiene.c -index 5b4b8db..98522bb 100644 ---- a/tests/icache-hygiene.c -+++ b/tests/icache-hygiene.c -@@ -88,7 +88,8 @@ static void sig_handler(int signum, siginfo_t *si, void *uc) - { - #if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \ - defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \ -- defined(__aarch64__) || defined(__sw_64__) || (defined(__riscv) && __riscv_xlen == 64) -+ defined(__aarch64__) || defined(__sw_64__) || (defined(__riscv) && __riscv_xlen == 64) || \ -+ defined(__loongarch__) - /* On powerpc, ia64, s390 and Aarch64, 0 bytes are an illegal - * instruction, so, if the icache is cleared properly, we SIGILL - * as soon as we jump into the cleared page */ diff --git a/libhugetlbfs-2.16-remap_segments_with_MAP_SHARED-2.patch b/libhugetlbfs-2.16-remap_segments_with_MAP_SHARED-2.patch deleted file mode 100644 index 625296a2dbbf77b8accd3978c42b5ecaabc3b40f..0000000000000000000000000000000000000000 --- a/libhugetlbfs-2.16-remap_segments_with_MAP_SHARED-2.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff -Naur libhugetlbfs-2.16/elflink.c libhugetlbfs-2.16.new//elflink.c ---- libhugetlbfs-2.16/elflink.c 2017-11-09 20:30:38.000000000 -0500 -+++ libhugetlbfs-2.16.new//elflink.c 2017-11-09 22:36:56.000000000 -0500 -@@ -1131,7 +1131,10 @@ - start = ALIGN_DOWN((unsigned long)seg[i].vaddr, hpage_size); - offset = (unsigned long)(seg[i].vaddr - start); - mapsize = ALIGN(offset + seg[i].memsz, hpage_size); -- mmap_flags = MAP_SHARED|MAP_FIXED; -+ if(__hugetlb_opts.share_mapping) -+ mmap_flags = MAP_SHARED|MAP_FIXED; -+ else -+ mmap_flags = MAP_PRIVATE|MAP_FIXED; - - /* If requested, make no reservations */ - if (__hugetlb_opts.no_reserve) -diff -Naur libhugetlbfs-2.16/hugeutils.c libhugetlbfs-2.16.new//hugeutils.c ---- libhugetlbfs-2.16/hugeutils.c 2013-03-09 21:59:52.000000000 -0500 -+++ libhugetlbfs-2.16.new//hugeutils.c 2017-11-09 22:36:45.000000000 -0500 -@@ -387,6 +387,12 @@ - env = getenv("HUGETLB_NO_RESERVE"); - if (env && !strcasecmp(env, "yes")) - __hugetlb_opts.no_reserve = true; -+ -+ /* Determine if data segment share memory mapping */ -+ __hugetlb_opts.share_mapping = false; -+ env = getenv("HUGETLB_SHAREMAPPING"); -+ if (env && !strcasecmp(env, "yes")) -+ __hugetlb_opts.share_mapping = true; - } - - void hugetlbfs_setup_kernel_page_size() -diff -Naur libhugetlbfs-2.16/libhugetlbfs_internal.h libhugetlbfs-2.16.new//libhugetlbfs_internal.h ---- libhugetlbfs-2.16/libhugetlbfs_internal.h 2013-03-09 21:59:52.000000000 -0500 -+++ libhugetlbfs-2.16.new//libhugetlbfs_internal.h 2017-11-09 22:35:53.000000000 -0500 -@@ -73,6 +73,7 @@ - char *def_page_size; - char *morecore; - char *heapbase; -+ bool share_mapping; - }; - - /* diff --git a/libhugetlbfs-2.16-remap_segments_with_MAP_SHARED.patch b/libhugetlbfs-2.16-remap_segments_with_MAP_SHARED.patch deleted file mode 100644 index 0bee1e7c945868f76c11540e9240cbd0d396befe..0000000000000000000000000000000000000000 --- a/libhugetlbfs-2.16-remap_segments_with_MAP_SHARED.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7c371e7de53554166711e0bcc37df94d0a78edd3 Mon Sep 17 00:00:00 2001 -From: sangyan -Date: Fri, 21 Apr 2017 14:35:03 +0800 -Subject: [PATCH] elflink.c: remap segments with MAP_SHARED flag - -Mmapping segment with MAP_PRIVATE will create a private -copy-on-write mapping, as a result updates to the mapping -will cost extra pages. It will cost double number of pages -in the worst case, so we change to MAP_SHARED flag. - -It is also safe to mmap a unlinked file or a read-only file. ---- - elflink.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/elflink.c b/elflink.c -index b746b26..8187ee0 100644 ---- a/elflink.c -+++ b/elflink.c -@@ -1131,7 +1131,7 @@ static void remap_segments(struct seg_info *seg, int num) - start = ALIGN_DOWN((unsigned long)seg[i].vaddr, hpage_size); - offset = (unsigned long)(seg[i].vaddr - start); - mapsize = ALIGN(offset + seg[i].memsz, hpage_size); -- mmap_flags = MAP_PRIVATE|MAP_FIXED; -+ mmap_flags = MAP_SHARED|MAP_FIXED; - - /* If requested, make no reservations */ - if (__hugetlb_opts.no_reserve) --- -1.8.3.1 - diff --git a/libhugetlbfs-2.23.tar.gz b/libhugetlbfs-2.23.tar.gz deleted file mode 100644 index 63a34f50e18384b7c452206d965d828fa7336e79..0000000000000000000000000000000000000000 Binary files a/libhugetlbfs-2.23.tar.gz and /dev/null differ diff --git a/libhugetlbfs-2.24.tar.gz b/libhugetlbfs-2.24.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..7185deea277e17f05f6e0e404b7666347105517c Binary files /dev/null and b/libhugetlbfs-2.24.tar.gz differ diff --git a/libhugetlbfs-fix-max-segment-cannot-adopt-the-x86.patch b/libhugetlbfs-fix-max-segment-cannot-adopt-the-x86.patch deleted file mode 100644 index 82dcb0cdf59330b5f850f0c0896a3ba3627b075a..0000000000000000000000000000000000000000 --- a/libhugetlbfs-fix-max-segment-cannot-adopt-the-x86.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 09972e4b31efed122c8747c2840bea4fa6615c6c Mon Sep 17 00:00:00 2001 -From: wuxu -Date: Sun, 9 Aug 2020 15:54:55 +0000 -Subject: [PATCH] libhugetlbfs: fix max segment cannot adopt the x86 - -Signed-off-by: wuxu - -diff --git a/elflink.c b/elflink.c -index 2e71522..0f3c228 100644 ---- a/elflink.c -+++ b/elflink.c -@@ -158,7 +158,7 @@ static void unmapped_abort(const char *fmt, ...) - /* The directory to use for sharing readonly segments */ - static char share_readonly_path[PATH_MAX+1]; - --#define MAX_HTLB_SEGS 3 -+#define MAX_HTLB_SEGS 4 - #define MAX_SEGS 10 - - struct seg_info { --- -1.8.3.1 - diff --git a/libhugetlbfs-make-cflags.patch b/libhugetlbfs-make-cflags.patch deleted file mode 100644 index 344b85ea093501f42467872d9b4f2f2cfad31b4e..0000000000000000000000000000000000000000 --- a/libhugetlbfs-make-cflags.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/Makefile b/Makefile -index 73ebad7..3735440 100644 ---- a/Makefile -+++ b/Makefile -@@ -30,8 +30,8 @@ INSTALL = install - - LDFLAGS += -ldl - CFLAGS ?= -O2 -g --CFLAGS += -Wall -fPIC --CPPFLAGS += -D__LIBHUGETLBFS__ -+CFLAGS += -Wall -fPIC -fstack-protector-strong -+CPPFLAGS += -D__LIBHUGETLBFS__ -DFORTIFY_SOURCE - - ARCH ?= $(shell uname -m | sed -e s/i.86/i386/) - CC ?= gcc diff --git a/libhugetlbfs.spec b/libhugetlbfs.spec index 780bcf25f456c14ed9eee9de2926c236b9c0eae9..f5379f62bdde581a2d917279ae6134d85712946d 100644 --- a/libhugetlbfs.spec +++ b/libhugetlbfs.spec @@ -1,22 +1,14 @@ %global ldscriptdir %{_datadir}/%{name}/ldscripts Name: libhugetlbfs -Version: 2.23 -Release: 3 +Version: 2.24 +Release: 1 Summary: A library which provides easy access to huge pages of memory License: LGPLv2+ URL: https://github.com/libhugetlbfs/libhugetlbfs Source0: https://github.com/libhugetlbfs/libhugetlbfs/releases/download/%{version}/%{name}-%{version}.tar.gz -Patch0: 0000-build_flags.patch -Patch1: Disable-hugepage-backed-malloc-if-__morecore-is-not-.patch -Patch2: libhugetlbfs-2.23-sw.patch -Patch3: add-loongarch-support.patch - -#Patch9000:libhugetlbfs-2.16-remap_segments_with_MAP_SHARED.patch -#Patch9001:libhugetlbfs-2.16-remap_segments_with_MAP_SHARED-2.patch -Patch9002:libhugetlbfs-make-cflags.patch -#Patch9003:libhugetlbfs-fix-max-segment-cannot-adopt-the-x86.patch +Patch2: 0001-add-support-sw64.patch BuildRequires: gcc glibc-devel glibc-static @@ -45,6 +37,8 @@ Userspace utilities for configuring the hugepage environment %build %set_build_flags +./autogen.sh +%{configure} make BUILDTYPE=NATIVEONLY %install @@ -62,8 +56,8 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/security/limits.d/hugepages.conf %{_libdir}/libhugetlbfs.so* %{_datadir}/%{name}/ %ghost %config(noreplace) %{_sysconfdir}/security/limits.d/hugepages.conf -%exclude %{_libdir}/libhugetlbfs_privutils.so -%exclude %{_libdir}/*.a +%{_libdir}/libhugetlbfs_privutils.so +%{_libdir}/*.a %files devel %{_includedir}/hugetlbfs.h @@ -74,10 +68,6 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/security/limits.d/hugepages.conf %{_bindir}/hugectl %{_bindir}/pagesize %{_bindir}/huge_page_setup_helper.py -%exclude %{_bindir}/cpupcstat -%exclude %{_bindir}/oprofile_map_events.pl -%exclude %{_bindir}/oprofile_start.sh -%exclude %{_libdir}/perl5/TLBC %files help %doc README HOWTO NEWS @@ -88,6 +78,9 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/security/limits.d/hugepages.conf %changelog +* Tue May 07 2024 liweigang - 2.24-1 +- upgrade to version 2.24 + * Fri Dec 2 2022 huajingyun - 2.23-3 - add loongarch support