Hi,

I'm seeing following tests failing on ppc64:
HUGETLB_ELFMAP=W linkhuge_rw (16M: 32): Failed to map hugepage segment 0: 
2f000000-31000000 (errno=16)
HUGETLB_ELFMAP=RW linkhuge_rw (16M: 32):        Failed to map hugepage segment 
1: 2f000000-31000000 (errno=16)
HUGETLB_ELFMAP=W HUGETLB_MINIMAL_COPY=no linkhuge_rw (16M: 32): Failed to map 
hugepage segment 0: 2f000000-31000000 (errno=16)
HUGETLB_ELFMAP=RW HUGETLB_MINIMAL_COPY=no linkhuge_rw (16M: 32):        Failed 
to map hugepage segment 1: 2f000000-31000000 (errno=16)
HUGETLB_ELFMAP=RW HUGETLB_MINIMAL_COPY=no linkhuge_rw (16M: 32):        Failed 
to map hugepage segment 1: 2f000000-31000000 (errno=16)
HUGETLB_SHARE=0 HUGETLB_ELFMAP=W linkhuge_rw (16M: 32): Failed to map hugepage 
segment 0: 2f000000-31000000 (errno=16)
HUGETLB_SHARE=1 HUGETLB_ELFMAP=W linkhuge_rw (16M: 32): Failed to map hugepage 
segment 0: 2f000000-31000000 (errno=16)
HUGETLB_SHARE=1 HUGETLB_ELFMAP=RW linkhuge_rw (16M: 32):        Failed to map 
hugepage segment 1: 2f000000-31000000 (errno=16)

# cat /proc/meminfo  | grep Huge
HugePages_Total:      50
HugePages_Free:       50
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:      16384 kB

# uname -r
3.5.0-0.23.el7.ppc64

# git describe
2.13-8-g03687a4 (origin/next)

Here is partial output of first one running via strace:
# env  LD_LIBRARY_PATH=/root/libhugetlbfs/obj32/ HUGETLB_ELFMAP=W strace 
./obj32/linkhuge_rw
...
mmap(NULL, 0, PROT_NONE, MAP_FILE, 0, 0) = -1 EINVAL (Invalid argument)
munmap(0x2fff0000, 262144)              = 0
mmap(0x2f000000, 33554432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) = 
-1 EBUSY (Device or resource busy)

I identified this part as remap_segments() in  elflink.c. The way I understand 
it, this code munmaps ordinary page
and places hugepage in its place.

This is process memory map just before remap_segments():

0fea0000-0feb0000 r-xp 00000000 fd:01 2759809                            
/root/libhugetlbfs/obj32/libhugetlbfs.so
0feb0000-0fec0000 r--p 00010000 fd:01 2759809                            
/root/libhugetlbfs/obj32/libhugetlbfs.so
0fec0000-0fed0000 rw-p 00020000 fd:01 2759809                            
/root/libhugetlbfs/obj32/libhugetlbfs.so
0fee0000-0fef0000 r-xp 00000000 fd:01 2759837                            
/root/libhugetlbfs/obj32/libhugetlbfs_privutils.so
0fef0000-0ff00000 r--p 00000000 fd:01 2759837                            
/root/libhugetlbfs/obj32/libhugetlbfs_privutils.so
0ff00000-0ff10000 rw-p 00010000 fd:01 2759837                            
/root/libhugetlbfs/obj32/libhugetlbfs_privutils.so
0ff20000-0ff30000 r-xp 00000000 fd:01 1855297                            
/usr/lib/libdl-2.15.so
0ff30000-0ff40000 r--p 00000000 fd:01 1855297                            
/usr/lib/libdl-2.15.so
0ff40000-0ff50000 rw-p 00010000 fd:01 1855297                            
/usr/lib/libdl-2.15.so
0ff60000-0ff80000 r-xp 00000000 fd:01 1855317                            
/usr/lib/libpthread-2.15.so
0ff80000-0ff90000 r--p 00010000 fd:01 1855317                            
/usr/lib/libpthread-2.15.so
0ff90000-0ffa0000 rw-p 00020000 fd:01 1855317                            
/usr/lib/libpthread-2.15.so
0ffb0000-0ffe0000 r-xp 00000000 fd:01 1837414                            
/usr/lib/ld-2.15.so
0ffe0000-0fff0000 r--p 00020000 fd:01 1837414                            
/usr/lib/ld-2.15.so
0fff0000-10000000 rw-p 00030000 fd:01 1837414                            
/usr/lib/ld-2.15.so
10000000-10020000 r-xp 00000000 fd:01 2760027                            
/root/libhugetlbfs/tests/obj32/linkhuge_rw
2fff0000-30000000 r--p 0fff0000 fd:01 2760027                            
/root/libhugetlbfs/tests/obj32/linkhuge_rw
30000000-30020000 rw-p 10000000 fd:01 2760027                            
/root/libhugetlbfs/tests/obj32/linkhuge_rw
30020000-30030000 rwxp 00000000 00:00 0 
30180000-301b0000 rwxp 00000000 00:00 0                                  [heap]
f7ae0000-f7c80000 r-xp 00000000 fd:01 1855284                            
/usr/lib/libc-2.15.so
f7c80000-f7c90000 r--p 001a0000 fd:01 1855284                            
/usr/lib/libc-2.15.so
f7c90000-f7ca0000 rw-p 001b0000 fd:01 1855284                            
/usr/lib/libc-2.15.so
ff820000-ff850000 rw-p 00000000 00:00 0                                  [stack]

The area munmap() removes is 0x2fff0000-0x30030000, so 2 huge pages
of size 16M are needed as replacement. But they can't fit in, because
mmap(0x2f000000, 33554432, ...) is mapping area "0x2f000000-0x31000000",
which collides with [heap]. 

Is this a known limitation/bug?

Regards,
Jan

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to