Hello community, here is the log from the commit of package libhugetlbfs for openSUSE:Factory checked in at 2013-01-29 10:48:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libhugetlbfs (Old) and /work/SRC/openSUSE:Factory/.libhugetlbfs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libhugetlbfs", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/libhugetlbfs/libhugetlbfs.changes 2012-07-12 10:46:43.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libhugetlbfs.new/libhugetlbfs.changes 2013-01-29 10:48:12.000000000 +0100 @@ -1,0 +2,17 @@ +Wed Jan 23 10:34:58 UTC 2013 - [email protected] + +- Update to version 2.15 + Features: + * Some System z functionality went into 2.15 + * Updated man pages + * Added basic events for core_i7 to oprofile_map_events + + Fixes: + * Disable Unable to verify address range warning when offset < page_size + * Remove sscanf in library setup to avoid heap allocation before _morecore + override + * Revert heap exhaustion patch + * hugectl no longer clips LD_LIBRARY_PATH variable + * Fix clean on failure code to avoid closing stdout + +------------------------------------------------------------------- Old: ---- libhugetlbfs-2.13.tar.gz New: ---- libhugetlbfs-2.15.tar.gz libhugetlbfs_fix_tests.patch libhugetlbfs_ia64_fix_missing_test.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libhugetlbfs.spec ++++++ --- /var/tmp/diff_new_pack.bA1TlL/_old 2013-01-29 10:48:14.000000000 +0100 +++ /var/tmp/diff_new_pack.bA1TlL/_new 2013-01-29 10:48:14.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package libhugetlbfs # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,7 @@ # + Name: libhugetlbfs %if 0%{?suse_version} > 1140 @@ -31,7 +32,7 @@ Obsoletes: libhugetlbfs-64bit %endif # -Version: 2.13 +Version: 2.15 Release: 0 Url: http://libhugetlbfs.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -43,6 +44,8 @@ Patch1: libhugetlbfs.ia64-libdir.patch Patch2: libhugetlbfs.s390.patch Patch4: libhugetlbfs.tests-malloc.patch +Patch7: libhugetlbfs_ia64_fix_missing_test.patch +Patch8: libhugetlbfs_fix_tests.patch %description The libhugetlbfs package interacts with the Linux hugetlbfs to @@ -61,6 +64,8 @@ %patch1 -p1 %patch2 -p1 %patch4 -p1 +%patch7 -p1 +%patch8 -p1 %build make %{my_make_flags} @@ -69,6 +74,7 @@ tests= %ifarch ppc ppc64 %ix86 x86_64 tests=install-tests +make %{my_make_flags} install $tests %endif make \ %ifarch sparc sparcv9 ++++++ libhugetlbfs-2.13.tar.gz -> libhugetlbfs-2.15.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/HOWTO new/libhugetlbfs-2.15/HOWTO --- old/libhugetlbfs-2.13/HOWTO 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/HOWTO 2012-12-08 18:15:26.000000000 +0100 @@ -43,13 +43,14 @@ ---------------------- You will need a CPU with some sort of hugepage support, which is -handled by your kernel. The covers recent x86, AMD64 and 64-bit -PowerPC(R) (POWER4, PPC970 and later) CPUs. +handled by your kernel. This covers recent x86, AMD64, 64-bit +PowerPC(R) (POWER4, PPC970 and later), and IBM System z CPUs. Currently, only x86, AMD64 and PowerPC are fully supported by libhugetlbfs. IA64 and Sparc64 have a working malloc, and SH64 should also but it has not been tested. IA64, Sparc64, and SH64 -do not support segment remapping at this time. +do not support segment remapping at this time. IBM System z supports +malloc and also segment remapping with --hugetlbfs-align. Kernel prerequisites -------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/Makefile new/libhugetlbfs-2.15/Makefile --- old/libhugetlbfs-2.13/Makefile 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/Makefile 2012-12-08 18:15:26.000000000 +0100 @@ -11,9 +11,10 @@ INSTALL_HELPER = huge_page_setup_helper.py INSTALL_PERLMOD = DataCollect.pm OpCollect.pm PerfCollect.pm Report.pm INSTALL_HEADERS = hugetlbfs.h -INSTALL_MAN1 = pagesize.1 -INSTALL_MAN3 = get_huge_pages.3 get_hugepage_region.3 \ - gethugepagesizes.3 getpagesizes.3 +INSTALL_MAN1 = ld.hugetlbfs.1 pagesize.1 +INSTALL_MAN3 = get_huge_pages.3 get_hugepage_region.3 gethugepagesize.3 \ + gethugepagesizes.3 getpagesizes.3 hugetlbfs_find_path.3 \ + hugetlbfs_test_path.3 hugetlbfs_unlinked_fd.3 INSTALL_MAN7 = libhugetlbfs.7 INSTALL_MAN8 = hugectl.8 hugeedit.8 hugeadm.8 cpupcstat.8 LDSCRIPT_TYPES = B BDT @@ -33,6 +34,8 @@ ARCH = $(shell uname -m | sed -e s/i.86/i386/) +CUSTOM_LDSCRIPTS = yes + ifeq ($(ARCH),ppc64) CC64 = gcc -m64 ELF64 = elf64ppc @@ -76,9 +79,11 @@ ifeq ($(ARCH),s390x) CC64 = gcc -m64 CC32 = gcc -m31 +ELF32 = elf_s390 +ELF64 = elf64_s390 TMPLIB64 = lib64 TMPLIB32 = lib -CFLAGS += -DNO_ELFLINK +CUSTOM_LDSCRIPTS = no else $(error "Unrecognized architecture ($(ARCH))") endif @@ -127,6 +132,10 @@ endif endif +ifeq ($(CUSTOM_LDSCRIPTS),yes) +TEST_LDSCRIPTS = -l +endif + # If TMPLIB64 is set, then sure we are not resolving LIB32 and LIB64 to the # same place ifdef TMPLIB64 @@ -186,6 +195,7 @@ export ELF64 export LIBDIR32 export LIBDIR64 +export CUSTOM_LDSCRIPTS all: libs tests tools @@ -202,16 +212,16 @@ tools: $(foreach file,$(INSTALL_BIN),$(BIN_OBJ_DIR)/$(file)) check: all - cd tests; ./run_tests.py + cd tests; ./run_tests.py $(TEST_LDSCRIPTS) checkv: all - cd tests; ./run_tests.py -vV + cd tests; ./run_tests.py -vV $(TEST_LDSCRIPTS) func: all - cd tests; ./run_tests.py -t func + cd tests; ./run_tests.py -t func $(TEST_LDSCRIPTS) funcv: all - cd tests; ./run_tests.py -t func -vV + cd tests; ./run_tests.py -t func -vV $(TEST_LDSCRIPTS) stress: all cd tests; ./run_tests.py -t stress @@ -364,7 +374,7 @@ objscript.%: % @$(VECHO) OBJSCRIPT $* - sed "s!### SET DEFAULT LDSCRIPT PATH HERE ###!HUGETLB_LDSCRIPT_PATH=$(LDSCRIPTDIR)!" < $< > $@ + sed "s!### SET DEFAULT LDSCRIPT PATH HERE ###!HUGETLB_LDSCRIPT_PATH=$(LDSCRIPTDIR)!;s!### SET CUSTOM_LDSCRIPTS HERE ###!CUSTOM_LDSCRIPTS=\"$(CUSTOM_LDSCRIPTS)\"!" < $< > $@ install-libs: libs $(OBJDIRS:%=%/install) $(INSTALL_OBJSCRIPT:%=objscript.%) $(INSTALL) -d $(DESTDIR)$(HEADERDIR) @@ -392,8 +402,12 @@ done rm -f $(DESTDIR)$(MANDIR3)/free_huge_pages.3.gz rm -f $(DESTDIR)$(MANDIR3)/free_hugepage_region.3.gz + rm -f $(DESTDIR)$(MANDIR3)/hugetlbfs_unlinked_fd_for_size.3.gz + rm -f $(DESTDIR)$(MANDIR3)/hugetlbfs_find_path_for_size.3.gz ln -s get_huge_pages.3.gz $(DESTDIR)$(MANDIR3)/free_huge_pages.3.gz ln -s get_hugepage_region.3.gz $(DESTDIR)$(MANDIR3)/free_hugepage_region.3.gz + ln -s hugetlbfs_unlinked_fd.3.gz $(DESTDIR)$(MANDIR3)/hugetlbfs_unlinked_fd_for_size.3.gz + ln -s hugetlbfs_find_path.3.gz $(DESTDIR)$(MANDIR3)/hugetlbfs_find_path_for_size.3.gz for x in $(INSTALL_MAN7); do \ $(INSTALL) -m 444 man/$$x $(DESTDIR)$(MANDIR7); \ gzip -f $(DESTDIR)$(MANDIR7)/$$x; \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/NEWS new/libhugetlbfs-2.15/NEWS --- old/libhugetlbfs-2.13/NEWS 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/NEWS 2012-12-08 18:15:26.000000000 +0100 @@ -1,3 +1,36 @@ +libhugetlbfs 2.15 "Minature Panda" +====================================================================== +New Features +* Add variable in Makefile to disable using deprecated linker scripts +* s390 support + +Bug Fixes +* Disable Unable to verify address range warning when offset < page_size +* Remove sscanf in library setup to avoid heap allocation before _morecore + override +* Revert heap exhaustion patch +* hugectl no longer clips LD_LIBRARY_PATH variable + + +Test Suite +* Fix mremap-expand-slice-collision expanding anon shm +* mremap-expand-slice-collision now asks kernel for availble slices +* Make 4GB boundary tests only fail when allocation fails on free slice +* Link 4GB test cases with --static so libraries are not placed in the way + +libhugetlbfs 2.14 "The White Album" +====================================================================== +New Features +* Updated man pages +* Added basic events for core_i7 to oprofile_map_events + +Bug Fixes +* Fix clean on failure code to avoid closing stdout + +Test Suite +* Fixed readahead, malloc, and hugepagesizes tests +* Avoid core dumps on stack_grow_into_huge test + libhugetlbfs 2.13 "Insert Clever Title Here" ====================================================================== New Features diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/elflink.c new/libhugetlbfs-2.15/elflink.c --- old/libhugetlbfs-2.13/elflink.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/elflink.c 2012-12-08 18:15:26.000000000 +0100 @@ -872,7 +872,7 @@ */ end = (void *) ALIGN((unsigned long)seg->vaddr + seg->memsz, page_size); new_end = (void *) ALIGN((unsigned long)end, hpage_size); - if (offset) + if (ALIGN_DOWN(offset, page_size)) check_range_empty(start, ALIGN_DOWN(offset, page_size)); if (end != new_end) check_range_empty(end, new_end - end); @@ -1321,7 +1321,7 @@ "%d\n", i); /* Close files we have already prepared */ - for (; i >= 0; i--) + for (i--; i >= 0; i--) close(htlb_seg_table[i].fd); return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/hugectl.c new/libhugetlbfs-2.15/hugectl.c --- old/libhugetlbfs-2.13/hugectl.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/hugectl.c 2012-12-08 18:15:26.000000000 +0100 @@ -271,7 +271,7 @@ void library_path(char *path) { - char val[NAME_MAX] = ""; + char val[PATH_MAX] = ""; char *env; env = getenv("LD_LIBRARY_PATH"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/hugeutils.c new/libhugetlbfs-2.15/hugeutils.c --- old/libhugetlbfs-2.13/hugeutils.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/hugeutils.c 2012-12-08 18:15:26.000000000 +0100 @@ -623,7 +623,9 @@ char path[PATH_MAX+1]; char line[LINE_MAXLEN + 1]; char *eol; - int bytes, err, dummy; + char *match; + char *end; + int bytes; off_t offset; fd = open("/proc/mounts", O_RDONLY); @@ -652,18 +654,21 @@ offset = bytes - (eol + 1 - line); lseek(fd, -offset, SEEK_CUR); - /* - * Match only hugetlbfs filesystems. - * Subtle: sscanf returns the number of input items matched - * and assigned. To force sscanf to match the literal - * "hugetlbfs" string we include a 'dummy' input item - * following that string. - */ - err = sscanf(line, "%*s %" stringify(PATH_MAX) "s hugetlbfs " - "%*s %d", path, &dummy); - if ((err == 2) && (hugetlbfs_test_path(path) == 1) && - !(access(path, R_OK | W_OK | X_OK))) - add_hugetlbfs_mount(path, 0); + /* Match only hugetlbfs filesystems. */ + match = strstr(line, " hugetlbfs "); + if (match) { + match = strchr(line, '/'); + if (!match) + continue; + end = strchr(match, ' '); + if (!end) + continue; + + strncpy(path, match, end - match); + if ((hugetlbfs_test_path(path) == 1) && + !(access(path, R_OK | W_OK | X_OK))) + add_hugetlbfs_mount(path, 0); + } } close(fd); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/kernel-features.c new/libhugetlbfs-2.15/kernel-features.c --- old/libhugetlbfs-2.13/kernel-features.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/kernel-features.c 2012-12-08 18:15:26.000000000 +0100 @@ -67,39 +67,67 @@ static int str_to_ver(const char *str, struct kernel_version *ver) { - int err; - int nr_chars; - char extra[4]; + char *start; + char *end; /* Clear out version struct */ ver->major = ver->minor = ver->release = ver->post = ver->pre = 0; - /* The kernel always starts x.y.z */ - err = sscanf(str, "%u.%u.%u%n", &ver->major, &ver->minor, &ver->release, - &nr_chars); /* - * The sscanf man page says that %n may or may not affect the return - * value so make sure it is at least 3 to cover the three kernel - * version variables and assume nr_chars will be correctly assigned. + * The kernel always starts x.y.z + * + * Note: strtol is used in place of sscanf because when heap override is + * used this step happens before the _morecore replacement and sscanf + * does an internal heap allocation. This mean that the next allocation + * from the heap would be on small pages until the first block allocated + * by _morecore is exhausted */ - if (err < 3) { + errno = 0; + ver->major = strtol(str, &end, 10); + if (!ver->major && errno == EINVAL) { ERROR("Unable to determine base kernel version: %s\n", strerror(errno)); return -1; } - /* Advance the str by the number of characters indicated by sscanf */ - str += nr_chars; + start = end + 1; + errno = 0; + ver->minor = strtol(start, &end, 10); + if (!ver->minor && errno == EINVAL) { + ERROR("Unable to determine base kernel version: %s\n", + strerror(errno)); + return -1; + } + + start = end + 1; + errno = 0; + ver->release = strtol(start, &end, 10); + if (!ver->release && errno == EINVAL) { + ERROR("Unable to determine base kernel version: %s\n", + strerror(errno)); + return -1; + } /* Try to match a post/stable version */ - err = sscanf(str, ".%u", &ver->post); - if (err == 1) - return 0; + start = end + 1; + if (*end == '.') { + ver->post = strtol(start, &end, 10); + if (!ver->post && errno == EINVAL) + return 0; + } /* Try to match a preN/rcN version */ - err = sscanf(str, "-%3[^0-9]%u", extra, &ver->pre); - if (err != 2 || (strcmp(extra, "pre") != 0 && strcmp(extra, "rc") != 0)) - ver->pre = 0; + start = end + 1; + if (*end == '-') { + if (*start == 'r' && *(start + 1) == 'c') + start += 2; + else if (*start == 'p' && + *(start + 1) == 'r' && + *(start + 2) == 'e') + start += 3; + + ver->pre = strtol(start, &end, 10); + } /* * For now we ignore any extraversions besides pre and post versions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/ld.hugetlbfs new/libhugetlbfs-2.15/ld.hugetlbfs --- old/libhugetlbfs-2.13/ld.hugetlbfs 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/ld.hugetlbfs 2012-12-08 18:15:26.000000000 +0100 @@ -14,6 +14,13 @@ HUGETLB_LDSCRIPT_PATH=$(dirname $(readlink $0))/ldscripts fi +### SET CUSTOM_LDSCRIPTS HERE ### +if [ -z "$CUSTOM_LDSCRIPTS" ]; then + # Assume this script is running from the libhugetlbfs source tree, + # and set CUSTOM_LDSCRIPTS to default "yes" + CUSTOM_LDSCRIPTS="yes" +fi + # Try to figure out what's the underlying linker to invoke if [ -z "$LD" ]; then for x in $(which -a ld); do @@ -65,6 +72,10 @@ done if [ -n "$HTLB_LINK" ]; then + if [ "$CUSTOM_LDSCRIPTS" == "no" ]; then + echo -n "ld.hugetlbfs: --hugetlbfs-link is not supported on this " 1>&2 + echo "platform. Use --hugetlbfs-align instead." 1>&2 + fi HTLB_ALIGN="" # --hugetlbfs-link overrides --hugetlbfs-align LDSCRIPT="$EMU.x$HTLB_LINK" HTLBOPTS="-T${HUGETLB_LDSCRIPT_PATH}/${LDSCRIPT}" @@ -74,6 +85,7 @@ case "$EMU" in elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;; 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 ;; esac if [ "$HTLB_ALIGN" == "slice" ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/gethugepagesize.3 new/libhugetlbfs-2.15/man/gethugepagesize.3 --- old/libhugetlbfs-2.13/man/gethugepagesize.3 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-2.15/man/gethugepagesize.3 2012-12-08 18:15:26.000000000 +0100 @@ -0,0 +1,54 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" Copyright 2012 Cray Inc. +.\" All rights reserved. +.\" Licensed under LGPL 2.1 by Cray Inc. +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH GETHUGEPAGESIZE 3 "March 7, 2012" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +gethugepagesize - Get the default huge page size +.SH SYNOPSIS +.B #include <hugetlbfs.h> +.br + +.B long gethugepagesize(void) + +.SH DESCRIPTION + +The gethugepagesize() function returns the default huge page size used by +libhugetlbfs. This will be either the system default, or a valid value set +by the environment variable \fBHUGETLB_DEFAULT_PAGE_SIZE\fP. + +If the system does not support any huge page sizes an error is returned. + +.SH RETURN VALUE + +On success, the default huge page size is returned. On failure, +-1 is returned and errno is set appropriately. + +.SH ERRORS + +.TP +.B ENOSYS +The system does not support huge pages. + +.SH SEE ALSO +.I libhugetlbfs(7) + +.SH AUTHORS +libhugetlbfs was written by various people on the libhugetlbfs-devel +mailing list. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/gethugepagesizes.3 new/libhugetlbfs-2.15/man/gethugepagesizes.3 --- old/libhugetlbfs-2.13/man/gethugepagesizes.3 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/man/gethugepagesizes.3 2012-12-08 18:15:26.000000000 +0100 @@ -19,7 +19,6 @@ gethugepagesizes - Get the system supported huge page sizes .SH SYNOPSIS .B #include <hugetlbfs.h> -.br .br int gethugepagesizes(long pagesizes[], int n_elem); @@ -41,12 +40,10 @@ .SH ERRORS .TP -.B ERRNO +.B EINVAL \fBn_elem\fP is less than zero or \fBn_elem\fP is greater than zero and \fBpagesizes\fP is NULL. - .PP - Also see opendir(3) for other possible values for errno. This error occurs when the sysfs directory exists but cannot be opened. @@ -61,9 +58,9 @@ .SH SEE ALSO .I oprofile(1), .I opendir(3), +.I hugetlbfs_find_path_for_size(3), .I libhugetlbfs(7) .SH AUTHORS libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/getpagesizes.3 new/libhugetlbfs-2.15/man/getpagesizes.3 --- old/libhugetlbfs-2.13/man/getpagesizes.3 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/man/getpagesizes.3 2012-12-08 18:15:26.000000000 +0100 @@ -41,7 +41,7 @@ .SH ERRORS .TP -.B ERRNO +.B EINVAL \fBn_elem\fP is less than zero or \fBn_elem\fP is greater than zero and \fBpagesizes\fP is NULL. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/hugetlbfs_find_path.3 new/libhugetlbfs-2.15/man/hugetlbfs_find_path.3 --- old/libhugetlbfs-2.13/man/hugetlbfs_find_path.3 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-2.15/man/hugetlbfs_find_path.3 2012-12-08 18:15:26.000000000 +0100 @@ -0,0 +1,52 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" Copyright 2012 Cray Inc. +.\" All rights reserved. +.\" Licensed under LGPL 2.1 by Cray Inc. +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH HUGETLBFS_FIND_PATH 3 "March 7, 2012" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +hugetlbfs_find_path, hugetlbfs_find_path_for_size - Locate an appropriate hugetlbfs mount point +.SH SYNOPSIS +.B #include <hugetlbfs.h> + +.br +const char *hugetlbfs_find_path(void); +.br +const char *hugetlbfs_find_path_for_size(long page_size); + +.SH DESCRIPTION + +These functions return a pathname for a mounted hugetlbfs filesystem for +the appropriate huge page size. For hugetlbfs_find_path, the default +huge page size is used (see gethugepagesize(3)). For +hugetlbfs_find_path_for_size, a valid huge page size must be specified +(see gethugepagesizes(3)). + +.SH RETURN VALUE + +On success, a non-NULL value is returned. +On failure, NULL is returned. + +.SH SEE ALSO +.I libhugetlbfs(7), +.I gethugepagesize(3), +.I gethugepagesizes(3) + +.SH AUTHORS +libhugetlbfs was written by various people on the libhugetlbfs-devel +mailing list. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/hugetlbfs_test_path.3 new/libhugetlbfs-2.15/man/hugetlbfs_test_path.3 --- old/libhugetlbfs-2.13/man/hugetlbfs_test_path.3 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-2.15/man/hugetlbfs_test_path.3 2012-12-08 18:15:26.000000000 +0100 @@ -0,0 +1,53 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" Copyright 2012 Cray Inc. +.\" All rights reserved. +.\" Licensed under LGPL 2.1 by Cray Inc. +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH HUGETLBFS_TEST_PATH 3 "March 7, 2012" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +hugetlbfs_test_path - Determine whether a mount point is hugetlbfs +.SH SYNOPSIS +.B #include <hugetlbfs.h> + +.br +int hugetlbfs_test_path(const char *mount); + +.SH DESCRIPTION + +The hugetlbfs_test_path() function determines whether a given pathname +is in a hugetlbfs filesystem. + +.SH RETURN VALUE + +On success, 1 is returned for a hugetlbfs filesystem, or 0 for a +non-hugetlbfs filesystem. On failure, -1 is returned and errno is set +appropriately. + +.SH ERRORS + +.PP +Please see statfs(3) for possible values for errno. + + +.SH SEE ALSO +.I statfs(3), +.I libhugetlbfs(7) + +.SH AUTHORS +libhugetlbfs was written by various people on the libhugetlbfs-devel +mailing list. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/hugetlbfs_unlinked_fd.3 new/libhugetlbfs-2.15/man/hugetlbfs_unlinked_fd.3 --- old/libhugetlbfs-2.13/man/hugetlbfs_unlinked_fd.3 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-2.15/man/hugetlbfs_unlinked_fd.3 2012-12-08 18:15:26.000000000 +0100 @@ -0,0 +1,55 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" Copyright 2012 Cray Inc. +.\" All rights reserved. +.\" Licensed under LGPL 2.1 by Cray Inc. +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH HUGETLBFS_UNLINKED_FD 3 "March 7, 2012" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +hugetlbfs_unlinked_fd, hugetlbfs_unlinked_fd_for_size - Obtain a file descriptor for a new unlinked file in hugetlbfs +.SH SYNOPSIS +.B #include <hugetlbfs.h> + +.br +.B int hugetlbfs_unlinked_fd(void); +.br +.B int hugetlbfs_unlinked_fd_for_size(long page_size); + +.SH DESCRIPTION + +These functions return an open file descriptor for a unique, newly-created +file in a hugetlbfs filesystem. To avoid leaking hugepages, the file +is unlinked automatically before the function returns. + +For hugetlbfs_unlinked_fd, the default huge page size is used (see +gethugepagesize(3)). For hugetlbfs_unlinked_fd_for_size, a valid huge +page size must be specified (see gethugepagesizes(3)). + +.SH RETURN VALUE + +On success, a valid open file descriptor is returned. On failure, +-1 is returned and errno may be set appropriately. + +.SH SEE ALSO +.I gethugepagesize(3), +.I gethugepagesizes(3), +.I mkstemp(3), +.I libhugetlbfs(7) + +.SH AUTHORS +libhugetlbfs was written by various people on the libhugetlbfs-devel +mailing list. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/ld.hugetlbfs.1 new/libhugetlbfs-2.15/man/ld.hugetlbfs.1 --- old/libhugetlbfs-2.13/man/ld.hugetlbfs.1 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-2.15/man/ld.hugetlbfs.1 2012-12-08 18:15:26.000000000 +0100 @@ -0,0 +1,72 @@ +\" Hey, EMACS: -*- nroff -*- +.\" Copyright 2012 Cray Inc. +.\" All rights reserved. +.\" Licensed under LGPL 2.1 by Cray Inc. +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH LD.HUGETLBFS 1 "March 12, 2012" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +ld.hugetlbfs \- link a program for huge pages +.SH SYNOPSIS +.B ld.hugetlbfs [options] +.SH DESCRIPTION + +\fBld.hugetlbfs\fP replaces the normal \fBld\fP command for linking programs +to use hugepages. Under gcc, you should use the option +\fB-B /usr/share/libhugetlbfs\fP which tells gcc to look in a non-standard +location for the linker. This could be set in the \fBCFLAGS\fP environment +variable. + +.TP +.B -Wl,--hugetlbfs-align + +This method of linking an application permits greater flexibility at runtime. +Using HUGETLB_ELFMAP, it is possible to control which program segments are +placed in hugepages. The following four settings will cause the indicated +segments to be placed in hugepages: + + HUGETLB_ELFMAP=R Read-only segments (text) + HUGETLB_ELFMAP=W Writable segments (data/BSS) + HUGETLB_ELFMAP=RW All segments (text/data/BSS) + HUGETLB_ELFMAP=no No segments + +It is possible to select specific huge page sizes for read-only and writable +segments by using the following advanced syntax: + + HUGETLB_ELFMAP=[R[=<pagesize>]:[W[=<pagesize>]] + +.B -Wl,--hugetlbfs-link=B + +Under binutils 2.16 or older, this option will link the application to store +BSS data (only) into hugepages. + +.B -Wl,--hugetlbfs-link=BDT + +Under binutils 2.16 or older, this option will link the application to store +text, initialized data and BSS data into hugepages. + +.SH FILES +[DESTDIR|/usr/share]/doc/libhugetlbfs/HOWTO + +.SH SEE ALSO +.I libhugetlbfs(7), +.I hugectl(8), +.I hugeedit(8) +.br +.SH AUTHORS +libhugetlbfs was written by various people on the libhugetlbfs-devel +mailing list. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/man/libhugetlbfs.7 new/libhugetlbfs-2.15/man/libhugetlbfs.7 --- old/libhugetlbfs-2.13/man/libhugetlbfs.7 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/man/libhugetlbfs.7 2012-12-08 18:15:26.000000000 +0100 @@ -39,8 +39,8 @@ For the effective backing of text and data with huge pages, the application must be linked to the library and the ELF segments correctly aligned using the ld helpers. Once linked, malloc or shared memory can still be backed -but no pre-loading is required. See /usr/share/docs/libhugetlbfs/HOWTO for -detailed instructions on relinking applications. +but no pre-loading is required. See /usr/share/doc/libhugetlbfs/HOWTO and +ld.hugetlbfs(1) for detailed instructions on relinking applications. For applications that are hugepage-aware and linked to the library \fBget_huge_pages()\fP can be used for the direct allocation of @@ -64,6 +64,11 @@ disabled. .TP +.B HUGETLB_DEFAULT_PAGE_SIZE=<pagesize> +This sets the default hugepage size to be used by libhugetlbfs. If not +set, libhugetlbfs will use the kernel's default hugepage size. + +.TP .B HUGETLB_MORECORE=[yes|<pagesize>] This enables the hugepage malloc() feature, instructing libhugetlbfs to override glibc's normal morecore() function with a hugepage version and use @@ -199,14 +204,27 @@ Once set, this will give very detailed output on what is happening in the library and run extra diagnostics. +.SH FILES +[DESTDIR|/usr/share]/doc/libhugetlbfs/HOWTO + .SH SEE ALSO .I oprofile(1), +.I ld.hugetlbfs(1), .I hugectl(8), .I hugeedit(8), +.I gethugepagesize(3), +.I gethugepagesizes(3), +.I getpagesizes(3), +.I hugetlbfs_test_path(3), +.I hugetlbfs_find_path(3), +.I hugetlbfs_find_path_for_size(3), +.I hugetlbfs_test_path(3), +.I hugetlbfs_test_path_for_size(3), +.I hugetlbfs_unlinked_fd(3), +.I hugetlbfs_unlinked_fd_for_size(3), .I get_huge_pages(3), .I free_huge_pages(3) .br .SH AUTHORS libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/oprofile_map_events.pl new/libhugetlbfs-2.15/oprofile_map_events.pl --- old/libhugetlbfs-2.13/oprofile_map_events.pl 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/oprofile_map_events.pl 2012-12-08 18:15:26.000000000 +0100 @@ -22,6 +22,7 @@ my (%map_event_name, %map_event_mask); # CPU events miss table +$map_event_name{"i386##timer"} = "CPU_CLK_UNHALTED:6000"; $map_event_name{"i386##dtlb_miss"} = "PAGE_WALK_TYPE:100000:0x01"; $map_event_name{"i386##p4##timer"} = "GLOBAL_POWER_EVENTS:100000:0x01"; $map_event_name{"i386##p4##dtlb_miss"} = "PAGE_WALK_TYPE:3000:0x01"; @@ -35,6 +36,10 @@ $map_event_name{"i386##core_2##dtlb_miss"} = "DTLB_MISSES:500:0x01"; $map_event_name{"i386##core_2##timer"} = "CPU_CLK_UNHALTED:6000"; $map_event_name{"i386##core_2##instructions"} = "INST_RETIRED_ANY_P:6000"; +$map_event_name{"i386##core_7##dtlb_miss"} = "DTLB_LOAD_MISSES:6000:0x01"; +$map_event_name{"i386##core_7##l2cache_miss"} = "LLC_MISSES:6000"; +$map_event_name{"i386##core_7##timer"} = "CPU_CLK_UNHALTED:6000"; +$map_event_name{"i386##core_7##instructions"} = "INST_RETIRED:6000:0x01"; $map_event_name{"x86-64##timer"} = "CPU_CLK_UNHALTED:100000"; $map_event_name{"x86-64##hammer##dtlb_miss"} = "L1_AND_L2_DTLB_MISSES:100000"; $map_event_name{"x86-64##hammer##l1cache_miss"} = "DATA_CACHE_MISSES:500"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/sys-elf64_s390.S new/libhugetlbfs-2.15/sys-elf64_s390.S --- old/libhugetlbfs-2.13/sys-elf64_s390.S 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-2.15/sys-elf64_s390.S 2012-12-08 18:15:26.000000000 +0100 @@ -0,0 +1,22 @@ +/* + * libhugetlbfs - direct system call for s390 (64 bit) + * + * Copyright IBM Corp. 2012 + * Author(s): Gerald Schaefer <[email protected]> + * + * NOTE: Only 4 syscall parameters supported w/o stack access, but this is + * sufficient for the syscalls used so far (__NR_write, __NR_kill and + * __NR_getpid). + */ + + .text + + .globl direct_syscall +direct_syscall: + lgr %r1,%r2 + lgr %r2,%r3 + lgr %r3,%r4 + lgr %r4,%r5 + lgr %r5,%r6 + svc 0 + br %r14 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/sys-elf_s390.S new/libhugetlbfs-2.15/sys-elf_s390.S --- old/libhugetlbfs-2.13/sys-elf_s390.S 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-2.15/sys-elf_s390.S 2012-12-08 18:15:26.000000000 +0100 @@ -0,0 +1,22 @@ +/* + * libhugetlbfs - direct system call for s390 (31 bit) + * + * Copyright IBM Corp. 2012 + * Author(s): Gerald Schaefer <[email protected]> + * + * NOTE: Only 4 syscall parameters supported w/o stack access, but this is + * sufficient for the syscalls used so far (__NR_write, __NR_kill and + * __NR_getpid). + */ + + .text + + .globl direct_syscall +direct_syscall: + lr %r1,%r2 + lr %r2,%r3 + lr %r3,%r4 + lr %r4,%r5 + lr %r5,%r6 + svc 0 + br %r14 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/Makefile new/libhugetlbfs-2.15/tests/Makefile --- old/libhugetlbfs-2.13/tests/Makefile 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/Makefile 2012-12-08 18:15:26.000000000 +0100 @@ -13,8 +13,10 @@ shm-perms \ mremap-expand-slice-collision \ mremap-fixed-normal-near-huge mremap-fixed-huge-near-normal -LIB_TESTS_64 = straddle_4GB huge_at_4GB_normal_below \ +LIB_TESTS_64 = +LIB_TESTS_64_STATIC = straddle_4GB huge_at_4GB_normal_below \ huge_below_4GB_normal_above +LIB_TESTS_64_ALL = $(LIB_TESTS_64) $(LIB_TESTS_64_STATIC) NOLIB_TESTS = malloc malloc_manysmall dummy heapshrink shmoverride_unlinked LDSCRIPT_TESTS = zero_filesize_segment HUGELINK_TESTS = linkhuge linkhuge_nofd linkshare @@ -39,17 +41,28 @@ TESTS = $(LIB_TESTS) $(NOLIB_TESTS) $(STRESS_TESTS) dummy.ldscript ifdef ELF32 +ifeq ($(CUSTOM_LDSCRIPTS),yes) TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) $(HUGELINK_TESTS:%=xB.%) \ $(HUGELINK_TESTS:%=xBDT.%) $(HUGELINK_RW_TESTS) else +TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) $(HUGELINK_RW_TESTS) +endif + +else ifdef ELF64 +ifeq ($(CUSTOM_LDSCRIPTS),yes) TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) $(HUGELINK_TESTS:%=xB.%) \ $(HUGELINK_TESTS:%=xBDT.%) +else +TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) +endif + endif endif ifneq ($(ARCH),ia64) TESTS_64 = $(LIB_TESTS_64) +TESTS_64_STATIC = $(LIB_TESTS_64_STATIC) endif SCRIPTS=../ldscripts @@ -74,6 +87,7 @@ ALLHELPERLIBS = $(foreach DIR,$(OBJDIRS),$(HELPER_LIBS:%=$(DIR)/%)) ifdef CC64 ALLTESTS += $(TESTS_64:%=obj64/%) +ALLTESTS += $(TESTS_64_STATIC:%=obj64/%_static) endif # For now, build only one test as a static binary. @@ -134,7 +148,7 @@ @$(VECHO) LD32 "(lib test)" $@ $(CC32) $(LDFLAGS) $(LDFLAGS32) -o $@ $^ $(LDLIBS) -lhugetlbfs -$(LIB_TESTS:%=obj64/%) $(LIB_TESTS_64:%=obj64/%): %: %.o obj64/testutils.o obj64/libtestutils.o +$(LIB_TESTS:%=obj64/%) $(LIB_TESTS_64_ALL:%=obj64/%): %: %.o obj64/testutils.o obj64/libtestutils.o @$(VECHO) LD64 "(lib test)" $@ $(CC64) $(LDFLAGS) $(LDFLAGS64) -o $@ $^ $(LDLIBS) -lhugetlbfs @@ -142,7 +156,7 @@ @$(VECHO) LD32 "(lib test)" $@ $(CC32) -static $(LDFLAGS) $(LDFLAGS32) -o $@ $^ $(STATIC_LDLIBS) $(STATIC_LIBHUGE) -$(LIB_TESTS:%=obj64/%_static) $(LIB_TESTS_64:%=obj64/%_static): %_static: %.o obj64/testutils.o obj64/libtestutils.o +$(LIB_TESTS:%=obj64/%_static) $(LIB_TESTS_64_ALL:%=obj64/%_static): %_static: %.o obj64/testutils.o obj64/libtestutils.o @$(VECHO) LD64 "(lib test)" $@ $(CC64) -static $(LDFLAGS) $(LDFLAGS64) -o $@ $^ $(STATIC_LDLIBS) $(STATIC_LIBHUGE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/gethugepagesizes.c new/libhugetlbfs-2.15/tests/gethugepagesizes.c --- old/libhugetlbfs-2.13/tests/gethugepagesizes.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/gethugepagesizes.c 2012-12-08 18:15:26.000000000 +0100 @@ -320,7 +320,8 @@ int main(int argc, char *argv[]) { - long expected_sizes[MAX], actual_sizes[MAX]; + int i, fakes_no; + long expected_sizes[MAX], actual_sizes[MAX], fake_sizes[MAX]; long base_size = sysconf(_SC_PAGESIZE); test_init(argc, argv); @@ -351,7 +352,14 @@ */ INIT_LIST(expected_sizes, HPAGE_KB * 1024, 1024 * 1024, 64 * 1024); - setup_fake_data(expected_sizes, 3); + fakes_no = 0; + for (i = 0; i < 3; i++) + /* don't include base_size in 'fake' hugepagesizes */ + if (base_size != expected_sizes[i]) { + fake_sizes[fakes_no] = expected_sizes[i]; + fakes_no++; + } + setup_fake_data(fake_sizes, fakes_no); /* * Check handling when /proc/meminfo indicates no huge page support @@ -382,30 +390,30 @@ sysfs_state = OVERRIDE_ON; kernel_default_hugepage_size_reset(); - INIT_LIST(expected_sizes, HPAGE_KB * 1024, 1024 * 1024, 64 * 1024); + memcpy(expected_sizes, fake_sizes, sizeof(fake_sizes)); /* ... make sure all sizes are returned without duplicates */ /* ... while making sure we do not overstep our limit */ - EXPECT_SIZES(gethugepagesizes, MAX, 3, expected_sizes); - EXPECT_SIZES(gethugepagesizes, 1, 3, expected_sizes); - EXPECT_SIZES(gethugepagesizes, 2, 3, expected_sizes); - EXPECT_SIZES(gethugepagesizes, 3, 3, expected_sizes); - EXPECT_SIZES(gethugepagesizes, 4, 3, expected_sizes); - - INIT_LIST(expected_sizes, - base_size, HPAGE_KB * 1024, 1024 * 1024, 64 * 1024); - EXPECT_SIZES(getpagesizes, MAX, 4, expected_sizes); - EXPECT_SIZES(getpagesizes, 1, 4, expected_sizes); - EXPECT_SIZES(getpagesizes, 2, 4, expected_sizes); - EXPECT_SIZES(getpagesizes, 3, 4, expected_sizes); - EXPECT_SIZES(getpagesizes, 4, 4, expected_sizes); - EXPECT_SIZES(getpagesizes, 5, 4, expected_sizes); + EXPECT_SIZES(gethugepagesizes, MAX, fakes_no, expected_sizes); + EXPECT_SIZES(gethugepagesizes, 1, fakes_no, expected_sizes); + EXPECT_SIZES(gethugepagesizes, 2, fakes_no, expected_sizes); + EXPECT_SIZES(gethugepagesizes, 3, fakes_no, expected_sizes); + EXPECT_SIZES(gethugepagesizes, 4, fakes_no, expected_sizes); + + memcpy(expected_sizes, fake_sizes, sizeof(fake_sizes)); + expected_sizes[fakes_no] = base_size; + EXPECT_SIZES(getpagesizes, MAX, fakes_no + 1, expected_sizes); + EXPECT_SIZES(getpagesizes, 1, fakes_no + 1, expected_sizes); + EXPECT_SIZES(getpagesizes, 2, fakes_no + 1, expected_sizes); + EXPECT_SIZES(getpagesizes, 3, fakes_no + 1, expected_sizes); + EXPECT_SIZES(getpagesizes, 4, fakes_no + 1, expected_sizes); + EXPECT_SIZES(getpagesizes, 5, fakes_no + 1, expected_sizes); /* ... we can check how many sizes are supported. */ - if (gethugepagesizes(NULL, 0) != 3) + if (gethugepagesizes(NULL, 0) != fakes_no) FAIL("Unable to check the number of supported sizes"); - if (getpagesizes(NULL, 0) != 4) + if (getpagesizes(NULL, 0) != fakes_no + 1) FAIL("Unable to check the number of supported sizes"); PASS(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/huge_at_4GB_normal_below.c new/libhugetlbfs-2.15/tests/huge_at_4GB_normal_below.c --- old/libhugetlbfs-2.13/tests/huge_at_4GB_normal_below.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/huge_at_4GB_normal_below.c 2012-12-08 18:15:26.000000000 +0100 @@ -66,8 +66,17 @@ p = mmap((void *)FOURGB, hpage_size, PROT_READ|PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); - if (p == MAP_FAILED) - FAIL("mmap() huge: %s", strerror(errno)); + if (p == MAP_FAILED) { + /* slice 0 (high) spans from 4G-1T */ + unsigned long below_start = FOURGB; + unsigned long above_end = 1024L*1024*1024*1024; + if (range_is_mapped(below_start, above_end) == 1) { + verbose_printf("region 4G-1T is not free\n"); + verbose_printf("mmap() failed: %s\n", strerror(errno)); + PASS_INCONCLUSIVE(); + } else + FAIL("mmap() huge: %s\n", strerror(errno)); + } if (p != (void *)FOURGB) FAIL("Wrong address with MAP_FIXED huge"); @@ -83,8 +92,16 @@ lowaddr = FOURGB - page_size; q = mmap((void *)lowaddr, page_size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED|MAP_ANONYMOUS, 0, 0); - if (q == MAP_FAILED) - FAIL("mmap() normal: %s", strerror(errno)); + if (p == MAP_FAILED) { + unsigned long below_start = FOURGB - page_size; + unsigned long above_end = FOURGB; + if (range_is_mapped(below_start, above_end) == 1) { + verbose_printf("region (4G-page)-4G is not free\n"); + verbose_printf("mmap() failed: %s\n", strerror(errno)); + PASS_INCONCLUSIVE(); + } else + FAIL("mmap() normal: %s\n", strerror(errno)); + } if (q != (void *)lowaddr) FAIL("Wrong address with MAP_FIXED normal"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/huge_below_4GB_normal_above.c new/libhugetlbfs-2.15/tests/huge_below_4GB_normal_above.c --- old/libhugetlbfs-2.13/tests/huge_below_4GB_normal_above.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/huge_below_4GB_normal_above.c 2012-12-08 18:15:26.000000000 +0100 @@ -72,8 +72,17 @@ verbose_printf("Mapping hugepage at at %lx...", lowaddr); p = mmap((void *)lowaddr, hpage_size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd, 0); - if (p == MAP_FAILED) - FAIL("mmap() huge: %s", strerror(errno)); + if (p == MAP_FAILED) { + /* This is last low slice - 256M just before 4G */ + unsigned long below_start = FOURGB - 256L*1024*1024; + unsigned long above_end = FOURGB; + if (range_is_mapped(below_start, above_end) == 1) { + verbose_printf("region (4G-256M)-4G is not free\n"); + verbose_printf("mmap() failed: %s\n", strerror(errno)); + PASS_INCONCLUSIVE(); + } else + FAIL("mmap() huge: %s\n", strerror(errno)); + } if (p != (void *)lowaddr) FAIL("Wrong address with MAP_FIXED huge"); verbose_printf("done\n"); @@ -89,8 +98,16 @@ verbose_printf("Mapping normal page at %lx...", highaddr); q = mmap((void *)highaddr, page_size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED|MAP_ANONYMOUS, 0, 0); - if (q == MAP_FAILED) - FAIL("mmap() normal 1: %s", strerror(errno)); + if (p == MAP_FAILED) { + unsigned long below_start = FOURGB; + unsigned long above_end = FOURGB + page_size; + if (range_is_mapped(below_start, above_end) == 1) { + verbose_printf("region 4G-(4G+page) is not free\n"); + verbose_printf("mmap() failed: %s\n", strerror(errno)); + PASS_INCONCLUSIVE(); + } else + FAIL("mmap() normal 1: %s\n", strerror(errno)); + } if (q != (void *)highaddr) FAIL("Wrong address with MAP_FIXED normal 2"); verbose_printf("done\n"); @@ -105,8 +122,16 @@ verbose_printf("Mapping normal page at %lx...", highaddr); q = mmap((void *)highaddr, page_size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED|MAP_ANONYMOUS, 0, 0); - if (q == MAP_FAILED) - FAIL("mmap() normal 2: %s", strerror(errno)); + if (p == MAP_FAILED) { + unsigned long below_start = highaddr; + unsigned long above_end = highaddr + page_size; + if (range_is_mapped(below_start, above_end) == 1) { + verbose_printf("region haddr-(haddr+page) not free\n"); + verbose_printf("mmap() failed: %s\n", strerror(errno)); + PASS_INCONCLUSIVE(); + } else + FAIL("mmap() normal 2: %s\n", strerror(errno)); + } if (q != (void *)highaddr) FAIL("Wrong address with MAP_FIXED normal 2"); verbose_printf("done\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/hugetests.h new/libhugetlbfs-2.15/tests/hugetests.h --- old/libhugetlbfs-2.13/tests/hugetests.h 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/hugetests.h 2012-12-08 18:15:26.000000000 +0100 @@ -48,6 +48,7 @@ unsigned long long get_mapping_page_size(void *p); long read_meminfo(const char *tag); ino_t get_addr_inode(void *p); +int range_is_mapped(unsigned long low, unsigned long high); #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) #define PALIGN(p, a) ((void *)ALIGN((unsigned long)(p), (a))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/mremap-expand-slice-collision.c new/libhugetlbfs-2.15/tests/mremap-expand-slice-collision.c --- old/libhugetlbfs-2.13/tests/mremap-expand-slice-collision.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/mremap-expand-slice-collision.c 2012-12-08 18:15:26.000000000 +0100 @@ -30,13 +30,62 @@ #define RANDOM_CONSTANT 0x1234ABCD +unsigned long slice_boundary; +long hpage_size, page_size; + +void init_slice_boundary(int fd) +{ + unsigned long slice_size; + void *p1, *p2, *heap; + int slices_ok, i, rc; #ifdef __LP64__ -#define SLICE_BOUNDARY 0x20000000000 + /* powerpc: 1TB slices starting at 1 TB */ + slice_boundary = 0x10000000000; + slice_size = 0x10000000000; #else -#define SLICE_BOUNDARY 0xe0000000 + /* powerpc: 256MB slices up to 4GB */ + slice_boundary = 0x00000000; + slice_size = 0x10000000; #endif -long hpage_size, page_size; + /* dummy malloc so we know where is heap */ + heap = malloc(1); + free(heap); + + /* find 2 neighbour slices, which are both free, + * 16 is the maximum number of slices (low/high) */ + for (i = 0; i < 16-1; i++) { + slices_ok = 0; + p1 = mmap((void *)slice_boundary, hpage_size, + PROT_READ, MAP_SHARED | MAP_FIXED, fd, 0); + p2 = mmap((void *)(slice_boundary+slice_size), hpage_size, + PROT_READ, MAP_SHARED | MAP_FIXED, fd, 0); + + if (p1 != MAP_FAILED) { + slices_ok++; + rc = munmap(p1, hpage_size); + if (rc != 0) + FAIL("munmap(p1): %s", strerror(errno)); + } + if (p2 != MAP_FAILED) { + slices_ok++; + rc = munmap(p2, hpage_size); + if (rc != 0) + FAIL("munmap(p2): %s", strerror(errno)); + } + + slice_boundary += slice_size; + if (slices_ok == 2) + break; + else + verbose_printf("can't use slice_boundary: 0x%lx\n", + slice_boundary); + } + + if (slices_ok != 2) + FAIL("couldn't find 2 free neighbour slices"); + verbose_printf("using slice_boundary: 0x%lx\n", slice_boundary); +} void do_readback(void *p, size_t size, const char *stage) { @@ -102,9 +151,10 @@ fd = hugetlbfs_unlinked_fd(); if (fd < 0) FAIL("hugetlbfs_unlinked_fd()"); + init_slice_boundary(fd); /* First, hugepages above, normal below */ - p = mmap((void *)(SLICE_BOUNDARY + hpage_size), hpage_size, + p = mmap((void *)(slice_boundary + hpage_size), hpage_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); if (p == MAP_FAILED) @@ -112,9 +162,9 @@ do_readback(p, hpage_size, "huge above"); - q = mmap((void *)(SLICE_BOUNDARY - page_size), page_size, + q = mmap((void *)(slice_boundary - page_size), page_size, PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); if (q == MAP_FAILED) FAIL("mmap(normal below): %s", strerror(errno)); @@ -144,7 +194,7 @@ FAIL("munmap(huge above)"); /* Next, normal pages above, huge below */ - p = mmap((void *)(SLICE_BOUNDARY + hpage_size), page_size, + p = mmap((void *)(slice_boundary + hpage_size), page_size, PROT_READ|PROT_WRITE, MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (p == MAP_FAILED) @@ -152,7 +202,7 @@ do_readback(p, page_size, "normal above"); - q = mmap((void *)(SLICE_BOUNDARY - hpage_size), + q = mmap((void *)(slice_boundary - hpage_size), hpage_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); if (q == MAP_FAILED) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/readahead_reserve.c new/libhugetlbfs-2.15/tests/readahead_reserve.c --- old/libhugetlbfs-2.13/tests/readahead_reserve.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/readahead_reserve.c 2012-12-08 18:15:26.000000000 +0100 @@ -64,8 +64,7 @@ verbose_printf("Reserve count after map: %lu\n", map_rsvd); /* readahead the region and record reservations */ - if (readahead(fd, 0, hpage_size) == -1) - FAIL("readahead(): %s", strerror(errno)); + readahead(fd, 0, hpage_size); readahead_rsvd = get_huge_page_counter(hpage_size, HUGEPAGES_RSVD); verbose_printf("Reserve count after readahead: %lu\n", readahead_rsvd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/run_tests.py new/libhugetlbfs-2.15/tests/run_tests.py --- old/libhugetlbfs-2.13/tests/run_tests.py 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/run_tests.py 2012-12-08 18:15:26.000000000 +0100 @@ -377,6 +377,11 @@ do_test(cmd, **env) # Test we don't blow up if not linked for hugepage do_test(cmd, LD_PRELOAD="libhugetlbfs.so", **env) + + # Only run custom ldscript tests when -l option is set + if not custom_ldscripts: + return + do_elflink_test("xB." + cmd, **env) do_elflink_test("xBDT." + cmd, **env) # Test we don't blow up if HUGETLB_MINIMAL_COPY is diabled @@ -522,9 +527,9 @@ do_test("ptrace-write-hugepage") do_test("icache-hygiene") do_test("slbpacaflush") - do_test("straddle_4GB", bits=(64,)) - do_test("huge_at_4GB_normal_below", bits=(64,)) - do_test("huge_below_4GB_normal_above", bits=(64,)) + do_test("straddle_4GB_static", bits=(64,)) + do_test("huge_at_4GB_normal_below_static", bits=(64,)) + do_test("huge_below_4GB_normal_above_static", bits=(64,)) do_test("map_high_truncate_2") do_test("misaligned_offset") do_test("truncate_above_4GB") @@ -578,9 +583,11 @@ elflink_test("linkhuge_nofd", HUGETLB_VERBOSE="0") elflink_test("linkhuge") - # Original elflink sharing tests - elfshare_test("linkshare") - elflink_and_share_test("linkhuge") + # Only run custom ldscript tests when -l option is set + if custom_ldscripts: + # Original elflink sharing tests + elfshare_test("linkshare") + elflink_and_share_test("linkhuge") # elflink_rw tests elflink_rw_test("linkhuge_rw") @@ -645,15 +652,17 @@ def main(): global wordsizes, pagesizes, dangerous, paranoid_pool_check, system_default_hpage_size + global custom_ldscripts testsets = set() env_override = {"QUIET_TEST": "1", "HUGETLBFS_MOUNTS": "", "HUGETLB_ELFMAP": None, "HUGETLB_MORECORE": None} env_defaults = {"HUGETLB_VERBOSE": "0"} dangerous = 0 paranoid_pool_check = False + custom_ldscripts = False try: - opts, args = getopt.getopt(sys.argv[1:], "vVfdt:b:p:c") + opts, args = getopt.getopt(sys.argv[1:], "vVfdt:b:p:c:l") except getopt.GetoptError, err: print str(err) sys.exit(1) @@ -673,6 +682,8 @@ for p in arg.split(): pagesizes.add(int(p)) elif opt == '-c': paranoid_pool_check = True + elif opt == '-l': + custom_ldscripts = True else: assert False, "unhandled option" if len(testsets) == 0: testsets = set(["func", "stress"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/stack_grow_into_huge.c new/libhugetlbfs-2.15/tests/stack_grow_into_huge.c --- old/libhugetlbfs-2.13/tests/stack_grow_into_huge.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/stack_grow_into_huge.c 2012-12-08 18:15:26.000000000 +0100 @@ -56,7 +56,17 @@ void do_child(void *stop_address) { + struct rlimit r; volatile int *x; + + /* corefile from this process is not interesting and limiting + * its size can save a lot of time. '1' is a special value, + * that will also abort dumping via pipe, which by default + * sets limit to RLIM_INFINITY. */ + r.rlim_cur = 1; + r.rlim_max = 1; + setrlimit(RLIMIT_CORE, &r); + do { x = alloca(STACK_ALLOCATION_SIZE); *x = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/straddle_4GB.c new/libhugetlbfs-2.15/tests/straddle_4GB.c --- old/libhugetlbfs-2.13/tests/straddle_4GB.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/straddle_4GB.c 2012-12-08 18:15:26.000000000 +0100 @@ -80,8 +80,17 @@ verbose_printf("Mapping with MAP_FIXED at %lx...", straddle_addr); p = mmap((void *)straddle_addr, 2*hpage_size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd, 0); - if (p == MAP_FAILED) - FAIL("mmap() FIXED: %s", strerror(errno)); + if (p == MAP_FAILED) { + /* this area crosses last low slice and first high slice */ + unsigned long below_start = FOURGB - 256L*1024*1024; + unsigned long above_end = 1024L*1024*1024*1024; + if (range_is_mapped(below_start, above_end) == 1) { + verbose_printf("region (4G-256M)-1T is not free\n"); + verbose_printf("mmap() failed: %s\n", strerror(errno)); + PASS_INCONCLUSIVE(); + } else + FAIL("mmap() FIXED failed: %s\n", strerror(errno)); + } if (p != (void *)straddle_addr) { verbose_printf("got %p instead\n", p); FAIL("Wrong address with MAP_FIXED"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/tests/testutils.c new/libhugetlbfs-2.15/tests/testutils.c --- old/libhugetlbfs-2.13/tests/testutils.c 2012-03-05 14:20:12.000000000 +0100 +++ new/libhugetlbfs-2.15/tests/testutils.c 2012-12-08 18:15:26.000000000 +0100 @@ -162,6 +162,49 @@ return 0; } +int range_is_mapped(unsigned long low, unsigned long high) +{ + FILE *f; + char line[MAPS_BUF_SZ]; + char *tmp; + + f = fopen("/proc/self/maps", "r"); + if (!f) { + ERROR("Failed to open /proc/self/maps: %s\n", strerror(errno)); + return -1; + } + + while (1) { + unsigned long start, end; + int ret; + + tmp = fgets(line, MAPS_BUF_SZ, f); + if (!tmp) + break; + + ret = sscanf(line, "%lx-%lx", &start, &end); + if (ret != 2) { + ERROR("Couldn't parse /proc/self/maps line: %s\n", + line); + fclose(f); + return -1; + } + + if ((start >= low) && (start < high)) { + fclose(f); + return 1; + } + if ((end >= low) && (end < high)) { + fclose(f); + return 1; + } + + } + + fclose(f); + return 0; +} + /* * With the inclusion of MAP_HUGETLB it is now possible to have huge pages * without using hugetlbfs, so not all huge page regions will show with the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libhugetlbfs-2.13/version new/libhugetlbfs-2.15/version --- old/libhugetlbfs-2.13/version 2012-03-05 14:24:38.000000000 +0100 +++ new/libhugetlbfs-2.15/version 2012-12-08 18:18:06.000000000 +0100 @@ -1 +1 @@ -2.13 +2.15 ++++++ libhugetlbfs.s390.patch ++++++ --- /var/tmp/diff_new_pack.bA1TlL/_old 2013-01-29 10:48:14.000000000 +0100 +++ /var/tmp/diff_new_pack.bA1TlL/_new 2013-01-29 10:48:14.000000000 +0100 @@ -1,27 +1,39 @@ -Do not build 31 bit for S390x, allow to build on S390 - --- - Makefile | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) + Makefile | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) -Index: libhugetlbfs-2.5/Makefile +Index: libhugetlbfs-2.15/Makefile =================================================================== ---- libhugetlbfs-2.5.orig/Makefile -+++ libhugetlbfs-2.5/Makefile -@@ -74,8 +74,11 @@ CFLAGS += -DNO_ELFLINK +--- libhugetlbfs-2.15.orig/Makefile ++++ libhugetlbfs-2.15/Makefile +@@ -69,19 +69,22 @@ else + ifeq ($(ARCH),ia64) + CC64 = gcc + TMPLIB64 = lib +-CFLAGS += -DNO_ELFLINK ++CPPFLAGS += -DNO_ELFLINK + else + ifeq ($(ARCH),sparc64) + CC64 = gcc -m64 + TMPLIB64 = lib64 +-CFLAGS += -DNO_ELFLINK ++CPPFLAGS += -DNO_ELFLINK else ifeq ($(ARCH),s390x) CC64 = gcc -m64 -CC32 = gcc -m31 +-ELF32 = elf_s390 + ELF64 = elf64_s390 TMPLIB64 = lib64 -+CFLAGS += -DNO_ELFLINK ++CUSTOM_LDSCRIPTS = no +else +ifeq ($(ARCH),s390) +CC32 = gcc -m31 ++ELF32 = elf_s390 TMPLIB32 = lib - CFLAGS += -DNO_ELFLINK + CUSTOM_LDSCRIPTS = no else -@@ -83,6 +86,7 @@ $(error "Unrecognized architecture ($(AR +@@ -89,6 +92,7 @@ $(error "Unrecognized architecture ($(AR endif endif endif ++++++ libhugetlbfs_fix_tests.patch ++++++ References: bnc#706891 Signed-off-by: Thomas Renninger <[email protected]> --- libhugetlbfs-2.12/tests/run_tests.py.org 2011-07-20 00:00:46.000000000 -0400 +++ libhugetlbfs-2.12/tests/run_tests.py 2011-07-20 00:01:55.000000000 -0400 @@ -234,7 +234,7 @@ def get_pagesizes(): """ sizes = set() out = "" - (rc, out) = bash("../obj/hugeadm --page-sizes") + (rc, out) = bash("hugeadm --page-sizes") if rc != 0 or out == "": return sizes for size in out.split("\n"): sizes.add(int(size)) ++++++ libhugetlbfs_ia64_fix_missing_test.patch ++++++ libhugetlbfs: TESTS_64 is not defined for ia64, check when trying to install it That was for libhugetlbfs version 2.12 (TEST_64 is not defined for ia64), same seem to be the case for x86_64 in version 2.15. -> Revert the installation of this test totally. Signed-off-by: Thomas Renninger <[email protected]> --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: libhugetlbfs-2.15/tests/Makefile =================================================================== --- libhugetlbfs-2.15.orig/tests/Makefile +++ libhugetlbfs-2.15/tests/Makefile @@ -292,7 +292,7 @@ obj64/install: $(INSTALL) -m 755 wrapper-utils.sh $(DESTDIR)$(INST_TESTSDIR64)/obj64 $(INSTALL) -m 755 $(HELPERS:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 $(INSTALL) -m 755 $(HELPER_LIBS:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 - $(INSTALL) -m 755 $(TESTS_64:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 + $(INSTALL) -m 755 run_tests.py $(DESTDIR)$(INST_TESTSDIR64) install: $(OBJDIRS:%=%/install) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
