|
From: Matt B. <Mat...@al...> - 2015-06-15 01:44:31
|
Hello, This is similar to the issue seen here (http://valgrind.10908.n7.nabble.com/valgrind-out-of-memory-error-td54401.html) however I have compiled with n64 ABI and therefore should be supported. When I attempt to use valgrind I get the following error: ==5133== Valgrind's memory management: out of memory: ==5133== newSuperblock's request for 4194304 bytes failed. ==5133== 27607040 bytes have already been allocated. ==5133== Valgrind cannot continue. Sorry. I have run valgrind using strace (entire trace is pasted at the end of the email) and I can see the execution tripping up on a call to mmap: mmap(0x802001000, 4194304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0, 0) = -1 EINVAL (Invalid argument) At this stage I am not sure what is causing this problem? I have attached 'ulimit -a' and 'cat /proc/meminfo' below. ulimit -a -f: file size (blocks) unlimited -t: cpu time (seconds) unlimited -d: data seg size (kb) unlimited -s: stack size (kb) 8192 -c: core file size (blocks) unlimited -m: resident set size (kb) unlimited -l: locked memory (kb) 64 -p: processes 2987 -n: file descriptors 1024 -v: address space (kb) unlimited -w: locks unlimited -e: scheduling priority 0 -r: real-time priority 0 cat /proc/meminfo MemTotal: 825776 kB MemFree: 608024 kB MemAvailable: 677880 kB Buffers: 16936 kB Cached: 65360 kB SwapCached: 0 kB Active: 140392 kB Inactive: 53720 kB Active(anon): 112112 kB Inactive(anon): 5216 kB Active(file): 28280 kB Inactive(file): 48504 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 111888 kB Mapped: 41928 kB Shmem: 5512 kB Slab: 25256 kB SReclaimable: 4288 kB SUnreclaim: 20968 kB KernelStack: 2512 kB PageTables: 3336 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 412888 kB Committed_AS: 685024 kB VmallocTotal: 8585740272 kB VmallocUsed: 1152 kB VmallocChunk: 8585732560 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 8192 kB Thanks, Matt ---------------------------- strace -f valgrind -v -v -v -d -d -d execve("/usr/bin/valgrind", ["valgrind", "-v", "-v", "-v", "-d", "-d", "-d"], [/* 23 vars */]) = 0 brk(0) = 0x1c292000 uname({sys="Linux", node="awplus", ...}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffe8cde000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=27905, ...}) = 0 mmap(NULL, 27905, PROT_READ, MAP_PRIVATE, 3, 0) = 0xffe8cd6000 close(3) = 0 open("/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0\0\0\0\0\233\320"..., 832) = 832 lseek(3, 9208, SEEK_SET) = 9208 read(3, "\0\0\0\4\0\0\0\20\0\0\0\1GNU\0\0\0\0\0\0\0\0\2\0\0\0\6\0\0\0\f", 32) = 32 fstat(3, {st_mode=S_IFREG|0755, st_size=1056879, ...}) = 0 mmap(NULL, 214880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffe8c6c000 mprotect(0xffe8c8a000, 65536, PROT_NONE) = 0 mmap(0xffe8c9a000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e000) = 0xffe8c9a000 mmap(0xffe8c9e000, 10080, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffe8c9e000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0\0\0\0\3\262\4"..., 832) = 832 lseek(3, 59824, SEEK_SET) = 59824 read(3, "\0\0\0\4\0\0\0\20\0\0\0\1GNU\0\0\0\0\0\0\0\0\2\0\0\0\6\0\0\0\f", 32) = 32 fstat(3, {st_mode=S_IFREG|0755, st_size=9287062, ...}) = 0 mmap(NULL, 1671152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffe8ad4000 mprotect(0xffe8c46000, 98304, PROT_NONE) = 0 mmap(0xffe8c5e000, 49152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17a000) = 0xffe8c5e000 mmap(0xffe8c6a000, 8176, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffe8c6a000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffe8cd4000 set_thread_area(0xffe8cdb700) = 0 mprotect(0xffe8c5e000, 24576, PROT_READ) = 0 mprotect(0xffe8c9a000, 8192, PROT_READ) = 0 mprotect(0xffe8ce0000, 8192, PROT_READ) = 0 munmap(0xffe8cd6000, 27905) = 0 set_tid_address(0xffe8cd40d0) = 4948 set_robust_list(0xffe8cd40e0, 24) = 0 futex(0xffffe9abc8, FUTEX_WAKE_PRIVATE, 1) = 0 futex(0xffffe9abc8, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, ffe8cdb700) = -1 EAGAIN (Resource temporarily unavailable) rt_sigaction(SIGRT_0, {0x800000000, [RT_37 RT_40 RT_41 RT_46 RT_52 RT_55 RT_56 RT_60 RT_62 RT_63 RT_64 RT_65 RT_66 RT_67 RT_68 RT_69 RT_70 RT_71 RT_72], SA_STACK|SA_INTERRUPT|SA_NODEFER|SA_RESETHAND|SA_NOCLDWA IT|0xc65700}, NULL, 16) = 0 rt_sigaction(SIGRT_1, {0x1000000800000000, [RT_37 RT_40 RT_41 RT_46 RT_52 RT_55 RT_56 RT_60 RT_62 RT_63 RT_64 RT_65 RT_66 RT_67 RT_68 RT_69 RT_70 RT_71 RT_72], SA_STACK|SA_INTERRUPT|SA_NODEFER|SA_RESETHAND|SA_ SIGINFO|SA_NOCLDWAIT|0xc655d0}, NULL, 16) = 0 rt_sigprocmask(SIG_UNBLOCK, [RT_0 RT_1], NULL, 16) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 getpid() = 4948 write(2, "--4948:1:debuglog DebugLog syste"..., 80--4948:1:debuglog DebugLog system started by Stage 1, level 3 logging requested ) = 80 getpid() = 4948 write(2, "--4948:1:launcher no tool reques"..., 62--4948:1:launcher no tool requested, defaulting to 'memcheck' ) = 62 getpid() = 4948 write(2, "--4948:1:launcher no client spec"..., 77--4948:1:launcher no client specified, defaulting platform to 'mips64-linux' ) = 77 readlink("/proc/self/exe", "/usr/bin/valgrind", 4096) = 17 brk(0) = 0x1c292000 brk(0x1c2b4000) = 0x1c2b4000 getpid() = 4948 write(2, "--4948:1:launcher launching /usr"..., 68--4948:1:launcher launching /usr/lib/valgrind/memcheck-mips64-linux ) = 68 execve("/usr/lib/valgrind/memcheck-mips64-linux", ["valgrind", "-v", "-v", "-v", "-d", "-d", "-d"], [/* 24 vars */]) = 0 getpid() = 4948 write(2, "--4948:1:debuglog DebugLog syste"..., 87--4948:1:debuglog DebugLog system started by Stage 2 (main), level 3 logging requested ) = 87 getpid() = 4948 write(2, "--4948:1:main Welcome to Val"..., 67--4948:1:main Welcome to Valgrind version 3.10.1 debug logging ) = 67 getpid() = 4948 write(2, "--4948:1:main Checking curre"..., 54--4948:1:main Checking current stack is plausible ) = 54 getpid() = 4948 write(2, "--4948:1:main Checking initi"..., 51--4948:1:main Checking initial stack was noted ) = 51 getpid() = 4948 write(2, "--4948:1:main Starting the a"..., 53--4948:1:main Starting the address space manager ) = 53 getpid() = 4948 write(2, "--4948:2:aspacem sp_a"..., 68--4948:2:aspacem sp_at_startup = 0xffff907b80 (supplied) ) = 68 getpid() = 4948 write(2, "--4948:2:aspacem "..., 68--4948:2:aspacem minAddr = 0x0004000000 (computed) ) = 68 getpid() = 4948 write(2, "--4948:2:aspacem "..., 68--4948:2:aspacem maxAddr = 0x0fffffffff (computed) ) = 68 getpid() = 4948 write(2, "--4948:2:aspacem "..., 68--4948:2:aspacem cStart = 0x0004000000 (computed) ) = 68 getpid() = 4948 write(2, "--4948:2:aspacem "..., 68--4948:2:aspacem vStart = 0x0802000000 (computed) ) = 68 getpid() = 4948 write(2, "--4948:2:aspacem suggested_cl"..., 68--4948:2:aspacem suggested_clstack_end = 0x0fff000fff (computed) ) = 68 getpid() = 4948 write(2, "--4948:2:aspacem <<< SHOW_SEG"..., 79--4948:2:aspacem <<< SHOW_SEGMENTS: Initial layout (5 segments, 0 segnames) ) = 79 getpid() = 4948 write(2, "--4948:2:aspacem 0: RSVN 00"..., 74--4948:2:aspacem 0: RSVN 0000000000-0003ffffff 64m ----- SmFixed ) = 74 getpid() = 4948 write(2, "--4948:2:aspacem 1: 00"..., 60--4948:2:aspacem 1: 0004000000-0801ffffff 32736m ) = 60 getpid() = 4948 write(2, "--4948:2:aspacem 2: RSVN 08"..., 74--4948:2:aspacem 2: RSVN 0802000000-0802000fff 4096 ----- SmFixed ) = 74 getpid() = 4948 write(2, "--4948:2:aspacem 3: 08"..., 60--4948:2:aspacem 3: 0802001000-0fffffffff 32735m ) = 60 getpid() = 4948 write(2, "--4948:2:aspacem 4: RSVN 10"..., 80--4948:2:aspacem 4: RSVN 1000000000-ffffffffffffffff 16383e ----- SmFixed ) = 80 getpid() = 4948 write(2, "--4948:2:aspacem >>>\n", 24--4948:2:aspacem >>> ) = 24 getpid() = 4948 write(2, "--4948:2:aspacem Reading /pro"..., 44--4948:2:aspacem Reading /proc/self/maps ) = 44 open("/proc/self/maps", O_RDONLY) = 3 read(3, "38000000-384bc000 r-xp 00010000 "..., 100000) = 441 read(3, "", 99559) = 0 close(3) = 0 getpid() = 4948 write(2, "--4948:2:aspacem <<< SHOW_SEG"..., 90--4948:2:aspacem <<< SHOW_SEGMENTS: With contents of /proc/self/maps (14 segments, 1 se) = 90 write(2, "gnames)\n", 8gnames) ) = 8 getpid() = 4948 write(2, "--4948:2:aspacem ( 0) /usr/li"..., 67--4948:2:aspacem ( 0) /usr/lib64/valgrind/memcheck-mips64-linux ) = 67 getpid() = 4948 write(2, "--4948:2:aspacem 0: RSVN 00"..., 74--4948:2:aspacem 0: RSVN 0000000000-0003ffffff 64m ----- SmFixed ) = 74 getpid() = 4948 write(2, "--4948:2:aspacem 1: 00"..., 60--4948:2:aspacem 1: 0004000000-0037ffffff 832m ) = 60 getpid() = 4948 write(2, "--4948:2:aspacem 2: FILE 00"..., 90--4948:2:aspacem 2: FILE 0038000000-00384bbfff 4964352 r-x-- d=0x100 i=1974 o=6553) = 90 write(2, "6 (0)\n", 86 (0) ) = 8 getpid() = 4948 write(2, "--4948:2:aspacem 3: 00"..., 60--4948:2:aspacem 3: 00384bc000-00384c9fff 57344 ) = 60 getpid() = 4948 write(2, "--4948:2:aspacem 4: FILE 00"..., 90--4948:2:aspacem 4: FILE 00384ca000-00384ebfff 139264 rw--- d=0x100 i=1974 o=5021) = 90 write(2, "696 (0)\n", 8696 (0) ) = 8 getpid() = 4948 write(2, "--4948:2:aspacem 5: ANON 00"..., 66--4948:2:aspacem 5: ANON 00384ec000-0039f1bfff 26m rwx-- ) = 66 getpid() = 4948 write(2, "--4948:2:aspacem 6: 00"..., 60--4948:2:aspacem 6: 0039f1c000-0801ffffff 31872m ) = 60 getpid() = 4948 write(2, "--4948:2:aspacem 7: RSVN 08"..., 74--4948:2:aspacem 7: RSVN 0802000000-0802000fff 4096 ----- SmFixed ) = 74 getpid() = 4948 write(2, "--4948:2:aspacem 8: 08"..., 60--4948:2:aspacem 8: 0802001000-0fffffffff 32735m ) = 60 getpid() = 4948 write(2, "--4948:2:aspacem 9: RSVN 10"..., 74--4948:2:aspacem 9: RSVN 1000000000-ffff8e7fff 983032m ----- SmFixed ) = 74 getpid() = 4948 write(2, "--4948:2:aspacem 10: ANON ff"..., 66--4948:2:aspacem 10: ANON ffff8e8000-ffff909fff 139264 rwx-- ) = 66 getpid() = 4948 write(2, "--4948:2:aspacem 11: RSVN ff"..., 74--4948:2:aspacem 11: RSVN ffff90a000-ffffffdfff 7290880 ----- SmFixed ) = 74 getpid() = 4948 write(2, "--4948:2:aspacem 12: ANON ff"..., 66--4948:2:aspacem 12: ANON ffffffe000-ffffffffff 8192 r-x-- ) = 66 getpid() = 4948 write(2, "--4948:2:aspacem 13: RSVN 10"..., 81--4948:2:aspacem 13: RSVN 10000000000-ffffffffffffffff 16383e ----- SmFixed ) = 81 getpid() = 4948 write(2, "--4948:2:aspacem >>>\n", 24--4948:2:aspacem >>> ) = 24 getpid() = 4948 write(2, "--4948:1:main Address space "..., 51--4948:1:main Address space manager is running ) = 51 getpid() = 4948 write(2, "--4948:1:main Starting the d"..., 54--4948:1:main Starting the dynamic memory manager ) = 54 mmap(0x802001000, 4194304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0, 0) = -1 EINVAL (Invalid argument) getpid() = 4948 write(2, "--4948:0:aspacem <<< SHOW_SEGME"..., 77--4948:0:aspacem <<< SHOW_SEGMENTS: out_of_memory (14 segments, 1 segnames) ) = 77 getpid() = 4948 write(2, "--4948:0:aspacem ( 0) /usr/lib6"..., 65--4948:0:aspacem ( 0) /usr/lib64/valgrind/memcheck-mips64-linux ) = 65 getpid() = 4948 write(2, "--4948:0:aspacem 0: RSVN 0000"..., 72--4948:0:aspacem 0: RSVN 0000000000-0003ffffff 64m ----- SmFixed ) = 72 getpid() = 4948 write(2, "--4948:0:aspacem 1: 0004"..., 58--4948:0:aspacem 1: 0004000000-0037ffffff 832m ) = 58 getpid() = 4948 write(2, "--4948:0:aspacem 2: FILE 0038"..., 90--4948:0:aspacem 2: FILE 0038000000-00384bbfff 4964352 r-x-- d=0x100 i=1974 o=65536 ) = 90 write(2, " (0)\n", 6 (0) ) = 6 getpid() = 4948 write(2, "--4948:0:aspacem 3: 0038"..., 58--4948:0:aspacem 3: 00384bc000-00384c9fff 57344 ) = 58 getpid() = 4948 write(2, "--4948:0:aspacem 4: FILE 0038"..., 90--4948:0:aspacem 4: FILE 00384ca000-00384ebfff 139264 rw--- d=0x100 i=1974 o=502169) = 90 write(2, "6 (0)\n", 66 (0) ) = 6 getpid() = 4948 write(2, "--4948:0:aspacem 5: ANON 0038"..., 64--4948:0:aspacem 5: ANON 00384ec000-0039f1bfff 26m rwx-- ) = 64 getpid() = 4948 write(2, "--4948:0:aspacem 6: 0039"..., 58--4948:0:aspacem 6: 0039f1c000-0801ffffff 31872m ) = 58 getpid() = 4948 write(2, "--4948:0:aspacem 7: RSVN 0802"..., 72--4948:0:aspacem 7: RSVN 0802000000-0802000fff 4096 ----- SmFixed ) = 72 getpid() = 4948 write(2, "--4948:0:aspacem 8: 0802"..., 58--4948:0:aspacem 8: 0802001000-0fffffffff 32735m ) = 58 getpid() = 4948 write(2, "--4948:0:aspacem 9: RSVN 1000"..., 72--4948:0:aspacem 9: RSVN 1000000000-ffff8e7fff 983032m ----- SmFixed ) = 72 getpid() = 4948 write(2, "--4948:0:aspacem 10: ANON ffff"..., 64--4948:0:aspacem 10: ANON ffff8e8000-ffff909fff 139264 rwx-- ) = 64 getpid() = 4948 write(2, "--4948:0:aspacem 11: RSVN ffff"..., 72--4948:0:aspacem 11: RSVN ffff90a000-ffffffdfff 7290880 ----- SmFixed ) = 72 getpid() = 4948 write(2, "--4948:0:aspacem 12: ANON ffff"..., 64--4948:0:aspacem 12: ANON ffffffe000-ffffffffff 8192 r-x-- ) = 64 getpid() = 4948 write(2, "--4948:0:aspacem 13: RSVN 1000"..., 79--4948:0:aspacem 13: RSVN 10000000000-ffffffffffffffff 16383e ----- SmFixed ) = 79 getpid() = 4948 write(2, "--4948:0:aspacem >>>\n", 22--4948:0:aspacem >>> ) = 22 getpid() = 4948 write(2, "--4948-- core : 0/ "..., 188--4948-- core : 0/ 0 max/curr mmap'd, 0/0 unsplit/split sb unmmap'd, 0/ 0 max/curr, 0/ 0 totalloc-blocks/byte s, 0 searches 8 rzB ) = 188 getpid() = 4948 write(2, "--4948-- dinfo : 0/ "..., 188--4948-- dinfo : 0/ 0 max/curr mmap'd, 0/0 unsplit/split sb unmmap'd, 0/ 0 max/curr, 0/ 0 totalloc-blocks/byte s, 0 searches 8 rzB ) = 188 getpid() = 4948 write(2, "--4948-- (null) : 0/ "..., 188--4948-- (null) : 0/ 0 max/curr mmap'd, 0/0 unsplit/split sb unmmap'd, 0/ 0 max/curr, 0/ 0 totalloc-blocks/byte s, 0 searches 0 rzB ) = 188 getpid() = 4948 write(2, "--4948-- demangle: 0/ "..., 188--4948-- demangle: 0/ 0 max/curr mmap'd, 0/0 unsplit/split sb unmmap'd, 0/ 0 max/curr, 0/ 0 totalloc-blocks/byte s, 0 searches 8 rzB ) = 188 getpid() = 4948 write(2, "--4948-- ttaux : 0/ "..., 188--4948-- ttaux : 0/ 0 max/curr mmap'd, 0/0 unsplit/split sb unmmap'd, 0/ 0 max/curr, 0/ 0 totalloc-blocks/byte s, 0 searches 8 rzB ) = 188 getpid() = 4948 write(2, "--4948-- translate: f"..., 70--4948-- translate: fast SP updates identified: 0 ( --%) ) = 70 getpid() = 4948 write(2, "--4948-- translate: generic_kn"..., 70--4948-- translate: generic_known SP updates identified: 0 ( --%) ) = 70 getpid() = 4948 write(2, "--4948-- translate: generic_unkn"..., 70--4948-- translate: generic_unknown SP updates identified: 0 ( --%) ) = 70 getpid() = 4948 write(2, "--4948-- tt/tc: 0 tt lookups"..., 52--4948-- tt/tc: 0 tt lookups requiring 0 probes ) = 52 getpid() = 4948 write(2, "--4948-- tt/tc: 0 fast-cache"..., 52--4948-- tt/tc: 0 fast-cache updates, 0 flushes ) = 52 getpid() = 4948 write(2, "--4948-- transtab: new 0"..., 62--4948-- transtab: new 0 (0 -> 0; ratio 0:10) [0 scs] ) = 62 getpid() = 4948 write(2, "--4948-- transtab: dumped 0"..., 43--4948-- transtab: dumped 0 (0 -> ??) ) = 43 getpid() = 4948 write(2, "--4948-- transtab: discarded 0"..., 43--4948-- transtab: discarded 0 (0 -> ??) ) = 43 getpid() = 4948 write(2, "--4948-- scheduler: 0 event chec"..., 36--4948-- scheduler: 0 event checks. ) = 36 getpid() = 4948 write(2, "--4948-- scheduler: 0 indir tran"..., 57--4948-- scheduler: 0 indir transfers, 0 misses (1 in 0) ) = 57 getpid() = 4948 write(2, "--4948-- scheduler: 0/0 major/mi"..., 50--4948-- scheduler: 0/0 major/minor sched events. ) = 50 getpid() = 4948 write(2, "--4948-- sanity: 0 cheap, 0 e"..., 49--4948-- sanity: 0 cheap, 0 expensive checks. ) = 49 mmap(0x802001000, 4194304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0, 0) = -1 EINVAL (Invalid argument) getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 write(2, "==4948== \n==4948== Valgrind'"..., 512==4948== ==4948== Valgrind's memory management: out of memory: ==4948== newSuperblock's request for 4194304 bytes failed. ==4948== 27607040 bytes have already been allocated. ==4948== Valgrind cannot continue. Sorry. ==4948== ==4948== There are several possible reasons for this. ==4948== - You have some kind of memory limit in place. Look at the ==4948== output of 'ulimit -a'. Is there a limit on the size of ==4948== virtual memory or address space? ==4948== ) = 512 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 write(2, " - You have run out of swap spa"..., 512 - You have run out of swap space. ==4948== - Valgrind has a bug. If you think this is the case or you are ==4948== not sure, please let us know and we'll try to fix it. ==4948== Please note that programs can take substantially more memory than ==4948== normal when running under Valgrind tools, eg. up to twice or ==4948== more, depending on the tool. On a 64-bit machine, Valgrind ==4948== should be able to make use of up 32GB memory. On a 32-bit ==4948== machine, Valgrind sho) = 512 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 getpid() = 4948 write(2, "uld be able to use all the memor"..., 301uld be able to use all the memory available ==4948== to a single process, up to 4GB if that's how you have your ==4948== kernel configured. Most 32-bit Linux setups allow a maximum of ==4948== 3GB per process. ==4948== ==4948== Whatever the reason, Valgrind cannot continue. Sorry. ) = 301 exit_group(1) = ? +++ exited with 1 +++ |
|
From: John R. <jr...@bi...> - 2015-06-15 05:01:27
|
> mmap(0x802001000, 4194304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0, 0) = -1 EINVAL (Invalid argument) What is SHMLBA for this configuration? [grep -sr SHMLBA /usr/include] And on the same topic, what is the page size? [grep -sr PAGE_SIZE /usr/include] Every successful mmap() return value happens to be a multiple of 0x2000 (8KiB); there are no odd multiples of 0x1000 (4KiB). [Some ARM machines have an SHMLBA of 0x4000 (16KiB) even though the page size is 0x1000 (4KiB).] Construct a standalone test program whose sole action is that call to mmap(). Does the mmap() succeed there? -- |
|
From: Matt B. <Mat...@al...> - 2015-06-15 05:22:39
|
On Sun, 2015-06-14 at 22:01 -0700, John Reiser wrote: > > mmap(0x802001000, 4194304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0, 0) = -1 EINVAL (Invalid argument) > > What is SHMLBA for this configuration? [grep -sr SHMLBA /usr/include] /usr/include/valgrind/vki/vki-amd64-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-arm-linux.h:#define VKI_SHMLBA (4 * VKI_PAGE_SIZE) /usr/include/valgrind/vki/vki-arm64-linux.h:#define VKI_SHMLBA (4 * VKI_PAGE_SIZE) /usr/include/valgrind/vki/vki-darwin.h:#define VKI_SHMLBA SHMLBA /usr/include/valgrind/vki/vki-linux.h:#define VKI_SHM_RND 020000 /* round attach address to SHMLBA boundary */ /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_SHMLBA 0x40000 /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_SHMLBA 0x40000 /usr/include/valgrind/vki/vki-ppc32-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-ppc64-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-s390x-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-x86-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE > And on the same topic, what is the page size? [grep -sr PAGE_SIZE /usr/include] /usr/include/valgrind/pub_tool_libcbase.h:#define VG_IS_PAGE_ALIGNED(aaa_p) (0 == (((Addr)(aaa_p)) & ((Addr)(VKI_PAGE_SIZE-1)))) /usr/include/valgrind/pub_tool_libcbase.h:#define VG_PGROUNDDN(p) VG_ROUNDDN(p, VKI_PAGE_SIZE) /usr/include/valgrind/pub_tool_libcbase.h:#define VG_PGROUNDUP(p) VG_ROUNDUP(p, VKI_PAGE_SIZE) /usr/include/valgrind/vki/vki-amd64-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT) /usr/include/valgrind/vki/vki-amd64-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-amd64-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-arm-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT) /usr/include/valgrind/vki/vki-arm-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-arm-linux.h:#define VKI_SHMLBA (4 * VKI_PAGE_SIZE) /usr/include/valgrind/vki/vki-arm64-linux.h:extern UWord VKI_PAGE_SIZE; /usr/include/valgrind/vki/vki-arm64-linux.h:#define VKI_MAX_PAGE_SIZE (1UL << VKI_MAX_PAGE_SHIFT) /usr/include/valgrind/vki/vki-arm64-linux.h:// shared memory with 64 bit processes, VKI_PAGE_SIZE is good /usr/include/valgrind/vki/vki-arm64-linux.h:// the old-style 16k value (4 * VKI_PAGE_SIZE) to be safe. /usr/include/valgrind/vki/vki-arm64-linux.h:#define VKI_SHMLBA (4 * VKI_PAGE_SIZE) /usr/include/valgrind/vki/vki-darwin.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-darwin.h:#define VKI_PAGE_SIZE PAGE_SIZE /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT) /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_PAGE_MASK (~(VKI_PAGE_SIZE-1)) /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT) /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_PAGE_MASK (~(VKI_PAGE_SIZE-1)) /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-ppc32-linux.h:extern UWord VKI_PAGE_SIZE; /usr/include/valgrind/vki/vki-ppc32-linux.h:#define VKI_MAX_PAGE_SIZE (1UL << VKI_MAX_PAGE_SHIFT) /usr/include/valgrind/vki/vki-ppc32-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-ppc64-linux.h:extern UWord VKI_PAGE_SIZE; /usr/include/valgrind/vki/vki-ppc64-linux.h:#define VKI_MAX_PAGE_SIZE (1UL << VKI_MAX_PAGE_SHIFT) /usr/include/valgrind/vki/vki-ppc64-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-s390x-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT) /usr/include/valgrind/vki/vki-s390x-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-s390x-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-x86-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT) /usr/include/valgrind/vki/vki-x86-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE /usr/include/valgrind/vki/vki-x86-linux.h:#define VKI_SHMLBA VKI_PAGE_SIZE > Every successful mmap() return value happens to be a multiple of 0x2000 (8KiB); > there are no odd multiples of 0x1000 (4KiB). > [Some ARM machines have an SHMLBA of 0x4000 (16KiB) even though the page size is 0x1000 (4KiB).] This is on a MIPS chip, specifically Cavium (cnMIPS). The kernel page size is configured to 8kB and since I didn't configure the page size when cross compiling valgrind it looks like it took the page size of my local machine (4kB). Looking at the upstream source code it appears that 8kB page size isn't currently supported however there are some patches here that may make it work. https://bugs.kde.org/show_bug.cgi?id=342356 Either way if this is indeed the issue here perhaps this is something that should be fixed upstream (supporting 8k and 32k pages)? > > Construct a standalone test program whose sole action is that call to mmap(). > Does the mmap() succeed there? > |
|
From: John R. <jr...@bi...> - 2015-06-15 14:01:10
|
On 06/14/2015 10:22 PM, Matt Bennett wrote:
> On Sun, 2015-06-14 at 22:01 -0700, John Reiser wrote:
>>> mmap(0x802001000, 4194304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0, 0) = -1 EINVAL (Invalid argument)
>>
>> What is SHMLBA for this configuration? [grep -sr SHMLBA /usr/include]
>
> /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_SHMLBA 0x40000
> /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_SHMLBA 0x40000
[Note that 0x40000 is 256KiB, which is rather large and likely to cause
noticeable fragmentation of address space.]
Notice that all those files are from /usr/include/valgrind/vki/.
Your compilation environment apparently lacked the definitions
that correspond to the target hardware [these for x86_64]:
-----
/usr/include/bits/shm.h:#define SHM_RND 020000 /* round attach address to SHMLBA */
/usr/include/bits/shm.h:#define SHMLBA (__getpagesize ())
/usr/include/linux/shm.h:#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
/usr/include/asm-generic/shmparam.h:#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
-----
>
>> And on the same topic, what is the page size? [grep -sr PAGE_SIZE /usr/include]
>
> /usr/include/valgrind/pub_tool_libcbase.h:#define VG_IS_PAGE_ALIGNED(aaa_p) (0 == (((Addr)(aaa_p)) & ((Addr)(VKI_PAGE_SIZE-1))))
> /usr/include/valgrind/pub_tool_libcbase.h:#define VG_PGROUNDDN(p) VG_ROUNDDN(p, VKI_PAGE_SIZE)
> /usr/include/valgrind/pub_tool_libcbase.h:#define VG_PGROUNDUP(p) VG_ROUNDUP(p, VKI_PAGE_SIZE)
> /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
> /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_PAGE_MASK (~(VKI_PAGE_SIZE-1))
> /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
> /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
> /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_PAGE_MASK (~(VKI_PAGE_SIZE-1))
> /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
Well, what is VKI_PAGE_SHIFT; and does one of {vki-mips32-linux.h, vki-mips64-linux.h}
actually apply to the target machine?
>
>> Every successful mmap() return value happens to be a multiple of 0x2000 (8KiB);
>> there are no odd multiples of 0x1000 (4KiB).
>> [Some ARM machines have an SHMLBA of 0x4000 (16KiB) even though the page size is 0x1000 (4KiB).]
>
> This is on a MIPS chip, specifically Cavium (cnMIPS). The kernel page size is configured to 8kB and since I didn't configure the page size when
> cross compiling valgrind it looks like it took the page size of my local machine (4kB). Looking at the upstream source code it appears that
> 8kB page size isn't currently supported however there are some patches here that may make it work. https://bugs.kde.org/show_bug.cgi?id=342356
>
> Either way if this is indeed the issue here perhaps this is something that should be fixed upstream (supporting 8k and 32k pages)?
Some of the blame belongs to you and the marketing/sales/support team
that sold you the chips. Sometimes inexpensive hardware is *TOO* cheap!
In this case it looks like Cavium (cnMIPS) is an architectural variant
that does not have all the properties previously promised by MIPS.
Also, successful cross-compiling requires setting the declarations
and #includes correctly. Nothing in the valgrind source can prevent
operator error in this department.
Therefore: arrange for the proper definitions of VKI_PAGE_SHIFT and VKI_SHMLBA,
and tell us the numerical values. (Write a test program which prints them!)
If valgrind attempts MAP_FIXED at an address such as 0x802001000 which is not
a multiple of the hardware page size (apparently 8KiB) then that is a clue
that the compilation environment is not correct. If necessary, edit the
definitions by hand _after_ performing "automatic configuration" and
_before_ compiling.
Look carefully at ARM:
/usr/include/valgrind/vki/vki-arm-linux.h:#define VKI_SHMLBA (4 * VKI_PAGE_SIZE)
which does work, and contrast with your case.
--
|
|
From: Matt B. <Mat...@al...> - 2015-06-16 01:32:40
|
The blame lies with me as I never checked what page sizes Valgrind
actually supports. Looking at configure.ac it only supports 4kB, 16kB
and 64kB page sizes. Therefore when I used '--with-pagesize=8' during
compilation it was defaulting to 4kB...
I have manually patched configure.ac to accept 8kB and set VKI_PAGE_SIZE
correctly (via VKI_PAGE_SHIFT and MIPS_PAGE_SHIFT).
I then modified the VKI_PAGE_SIZE and VKI_MAX_PAGE_SIZE assert
statements in coregrind/m_main.c to include 8kB.
Valgrind now appears to run correctly (I can enter 'valgrind -h').
However, if I try to run a program under Valgrind I get another
(unrelated) issue that I will address via a separate thread.
Thanks for your help.
On Mon, 2015-06-15 at 07:01 -0700, John Reiser wrote:
> On 06/14/2015 10:22 PM, Matt Bennett wrote:
> > On Sun, 2015-06-14 at 22:01 -0700, John Reiser wrote:
> >>> mmap(0x802001000, 4194304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0, 0) = -1 EINVAL (Invalid argument)
> >>
> >> What is SHMLBA for this configuration? [grep -sr SHMLBA /usr/include]
> >
>
> > /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_SHMLBA 0x40000
> > /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_SHMLBA 0x40000
>
> [Note that 0x40000 is 256KiB, which is rather large and likely to cause
> noticeable fragmentation of address space.]
>
> Notice that all those files are from /usr/include/valgrind/vki/.
> Your compilation environment apparently lacked the definitions
> that correspond to the target hardware [these for x86_64]:
> -----
> /usr/include/bits/shm.h:#define SHM_RND 020000 /* round attach address to SHMLBA */
> /usr/include/bits/shm.h:#define SHMLBA (__getpagesize ())
> /usr/include/linux/shm.h:#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
> /usr/include/asm-generic/shmparam.h:#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
> -----
>
> >
> >> And on the same topic, what is the page size? [grep -sr PAGE_SIZE /usr/include]
> >
> > /usr/include/valgrind/pub_tool_libcbase.h:#define VG_IS_PAGE_ALIGNED(aaa_p) (0 == (((Addr)(aaa_p)) & ((Addr)(VKI_PAGE_SIZE-1))))
> > /usr/include/valgrind/pub_tool_libcbase.h:#define VG_PGROUNDDN(p) VG_ROUNDDN(p, VKI_PAGE_SIZE)
> > /usr/include/valgrind/pub_tool_libcbase.h:#define VG_PGROUNDUP(p) VG_ROUNDUP(p, VKI_PAGE_SIZE)
>
> > /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
> > /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_PAGE_MASK (~(VKI_PAGE_SIZE-1))
> > /usr/include/valgrind/vki/vki-mips32-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
> > /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
> > /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_PAGE_MASK (~(VKI_PAGE_SIZE-1))
> > /usr/include/valgrind/vki/vki-mips64-linux.h:#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
>
> Well, what is VKI_PAGE_SHIFT; and does one of {vki-mips32-linux.h, vki-mips64-linux.h}
> actually apply to the target machine?
>
> >
> >> Every successful mmap() return value happens to be a multiple of 0x2000 (8KiB);
> >> there are no odd multiples of 0x1000 (4KiB).
> >> [Some ARM machines have an SHMLBA of 0x4000 (16KiB) even though the page size is 0x1000 (4KiB).]
> >
> > This is on a MIPS chip, specifically Cavium (cnMIPS). The kernel page size is configured to 8kB and since I didn't configure the page size when
> > cross compiling valgrind it looks like it took the page size of my local machine (4kB). Looking at the upstream source code it appears that
> > 8kB page size isn't currently supported however there are some patches here that may make it work. https://bugs.kde.org/show_bug.cgi?id=342356
> >
> > Either way if this is indeed the issue here perhaps this is something that should be fixed upstream (supporting 8k and 32k pages)?
>
> Some of the blame belongs to you and the marketing/sales/support team
> that sold you the chips. Sometimes inexpensive hardware is *TOO* cheap!
> In this case it looks like Cavium (cnMIPS) is an architectural variant
> that does not have all the properties previously promised by MIPS.
>
> Also, successful cross-compiling requires setting the declarations
> and #includes correctly. Nothing in the valgrind source can prevent
> operator error in this department.
>
> Therefore: arrange for the proper definitions of VKI_PAGE_SHIFT and VKI_SHMLBA,
> and tell us the numerical values. (Write a test program which prints them!)
> If valgrind attempts MAP_FIXED at an address such as 0x802001000 which is not
> a multiple of the hardware page size (apparently 8KiB) then that is a clue
> that the compilation environment is not correct. If necessary, edit the
> definitions by hand _after_ performing "automatic configuration" and
> _before_ compiling.
>
> Look carefully at ARM:
> /usr/include/valgrind/vki/vki-arm-linux.h:#define VKI_SHMLBA (4 * VKI_PAGE_SIZE)
> which does work, and contrast with your case.
>
|