Bug 406422

Summary: none/tests/amd64-linux/map_32bits.vgtest fails too easily
Product: [Developer tools] valgrind Reporter: Mark Wielaard <mark>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: philippe.waroquiers
Priority: NOR    
Version: 3.15 SVN   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Mark Wielaard 2019-04-10 23:18:16 UTC
On various systems none/tests/amd64-linux/map_32bits.vgtest fails with first mmap: Cannot allocate memory.

The problem is that the --aspace-minaddr is too tight. Newer glibc seem to mmap some memory and so even our first mmap with MMAP_32BIT will fail.

The solution is to make a bit more memory < 2GB available. If there is 16MB available the test always seems to succeed without needing too many tries.

diff --git a/none/tests/amd64-linux/map_32bits.vgtest b/none/tests/amd64-linux/map_32bits.vgtest
index 2b7f3a04a..2c1785436 100644
--- a/none/tests/amd64-linux/map_32bits.vgtest
+++ b/none/tests/amd64-linux/map_32bits.vgtest
@@ -1,5 +1,5 @@
 prog: map_32bits
 # take a big aspacemgr minaddr, to quickly reach the 2GB limit
-vgopts: -q --aspace-minaddr=0x7ff60000
+vgopts: -q --aspace-minaddr=0x70000000
 stderr_filter: filter_stderr
Comment 1 Mark Wielaard 2019-04-11 09:41:16 UTC
(In reply to Mark Wielaard from comment #0)
> The solution is to make a bit more memory < 2GB available. If there is 16MB
> available the test always seems to succeed without needing too many tries.
> 
> +vgopts: -q --aspace-minaddr=0x70000000

The comment is right, the constant is wrong (although it also works fine).
Leaving 16MB available would be:

   vgopts: -q --aspace-minaddr=0x7f000000

I was testing if leaving even more would make the testcase too slow. But it was still fast, even though it had to chew through 256MB first. In fact even without --aspace-minaddr the test still finishes quickly. It is just that the original 256K is too low.
Comment 2 Mark Wielaard 2019-04-11 16:08:48 UTC
Approved on irc by Julian.

commit 535d2ff4f2f755faa8b1a9e467833eca455bd2d7
Author: Mark Wielaard <mark@klomp.org>
Date:   Thu Apr 11 18:06:34 2019 +0200

    none/tests/amd64-linux/map_32bits.vgtest fails too easily
    
    On various systems none/tests/amd64-linux/map_32bits.vgtest fails with:
    first mmap: Cannot allocate memory.
    
    The problem is that the --aspace-minaddr is too tight. Newer glibc seem
    to mmap some memory and so even our first mmap with MMAP_32BIT will fail.
    
    The solution is to make a bit more memory < 2GB available.
    If there is 16MB available the test always seems to succeed without
    needing too many tries. The original 256K is too low.
    
    https://bugs.kde.org/show_bug.cgi?id=406422