huge_at_4GB_normal_below, huge_below_4GB_normal_above, straddle_4GB
are tests to test corner cases on powerpc. powerpc manages memory
using slices: low (0-4G) and high (4G-).

These tests are using MAP_FIXED and try to mmap hugepage at various
locations. Issue is that kernel or ld.so can already mmaped region
that these tests want to use:
  # ./obj64/straddle_4GB
  Starting testcase "./obj64/straddle_4GB", pid 25949
  Mapping without MAP_FIXED at ff000000...got 0xefffe000000 instead, never mind
  Mapping with MAP_FIXED at ff000000
  FAIL  mmap() FIXED failed: Device or resource busy

Looking at mappings prior to failed mmap, there are already some libraries
mapped to first high slice (0).

Without patch:
10010000-10020000 r--p 00000000 fd:01 2893006        
/root/libhugetlbfs/tests/obj64/straddle_4GB
10020000-10030000 rw-p 00010000 fd:01 2893006        
/root/libhugetlbfs/tests/obj64/straddle_4GB
8015160000-8015190000 r-xp 00000000 fd:01 1857222    /usr/lib64/ld-2.15.so
8015190000-80151a0000 r--p 00020000 fd:01 1857222    /usr/lib64/ld-2.15.so
80151a0000-80151b0000 rw-p 00030000 fd:01 1857222    /usr/lib64/ld-2.15.so
80151d0000-8015390000 r-xp 00000000 fd:01 1857223    /usr/lib64/libc-2.15.so
8015390000-80153a0000 r--p 001b0000 fd:01 1857223    /usr/lib64/libc-2.15.so
80153a0000-80153c0000 rw-p 001c0000 fd:01 1857223    /usr/lib64/libc-2.15.so
80153c0000-80153e0000 r-xp 00000000 fd:01 1835789    
/usr/lib64/libpthread-2.15.so
80153e0000-80153f0000 r--p 00010000 fd:01 1835789    
/usr/lib64/libpthread-2.15.so
80153f0000-8015400000 rw-p 00020000 fd:01 1835789    
/usr/lib64/libpthread-2.15.so
8015400000-8015410000 r-xp 00000000 fd:01 1842374    /usr/lib64/libdl-2.15.so
8015410000-8015420000 r--p 00000000 fd:01 1842374    /usr/lib64/libdl-2.15.so
8015420000-8015430000 rw-p 00010000 fd:01 1842374    /usr/lib64/libdl-2.15.so
10022e00000-10022e30000 rw-p 00000000 00:00 0        [heap]
fff8e650000-fff8e670000 r-xp 00000000 fd:01 1837902  /usr/lib64/libhugetlbfs.so
fff8e670000-fff8e680000 r--p 00010000 fd:01 1837902  /usr/lib64/libhugetlbfs.so
fff8e680000-fff8e690000 rw-p 00020000 fd:01 1837902  /usr/lib64/libhugetlbfs.so
fff8e690000-fff8e6a0000 r-xp 00000000 fd:01 1842940  
/usr/lib64/libhugetlbfs_privutils.so
fff8e6a0000-fff8e6b0000 r--p 00000000 fd:01 1842940  
/usr/lib64/libhugetlbfs_privutils.so
fff8e6b0000-fff8e6c0000 rw-p 00010000 fd:01 1842940  
/usr/lib64/libhugetlbfs_privutils.so
fff8e6c0000-fff8e6d0000 rw-p 00000000 00:00 0
fff8e6d0000-fff8e6f0000 r-xp 00000000 00:00 0        [vdso]
fffc7110000-fffc7140000 rw-p 00000000 00:00 0        [stack]

This patch builds 3 mentioned testcases as -static, which increases
chances, that slices around 4GB boundary will be free.

With patch:
10000000-100d0000 r-xp 00000000 fd:01 1966884        
/root/libhugetlbfs/tests/obj64/straddle_4GB_static
100d0000-100f0000 rw-p 000c0000 fd:01 1966884        
/root/libhugetlbfs/tests/obj64/straddle_4GB_static
100f0000-10100000 rw-p 00000000 00:00 0
10019550000-10019580000 rw-p 00000000 00:00 0        [heap]
fffac380000-fffac390000 rw-p 00000000 00:00 0
fffac390000-fffac3b0000 r-xp 00000000 00:00 0        [vdso]
fffdca10000-fffdca40000 rw-p 00000000 00:00 0        [stack]

Signed-off-by: Jan Stancek <jstan...@redhat.com>
---
 tests/Makefile     |   10 +++++++---
 tests/run_tests.py |    6 +++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index cb15767..596ce72 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -13,8 +13,10 @@ LIB_TESTS = gethugepagesize test_root find_path unlinked_fd 
misalign \
        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
@@ -50,6 +52,7 @@ endif
 
 ifneq ($(ARCH),ia64)
 TESTS_64 = $(LIB_TESTS_64)
+TESTS_64_STATIC = $(LIB_TESTS_64_STATIC)
 endif
 
 SCRIPTS=../ldscripts
@@ -74,6 +77,7 @@ ALLHELPERS = $(foreach DIR,$(OBJDIRS),$(HELPERS:%=$(DIR)/%))
 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 +138,7 @@ $(LIB_TESTS:%=obj32/%): %: %.o obj32/testutils.o 
obj32/libtestutils.o
        @$(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 +146,7 @@ $(LIB_TESTS:%=obj32/%_static): %_static: %.o 
obj32/testutils.o obj32/libtestutil
        @$(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 --git a/tests/run_tests.py b/tests/run_tests.py
index 8055940..c1564c7 100755
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -522,9 +522,9 @@ def functional_tests():
     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")
-- 
1.7.1


------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to