On Wed, 13 Aug 2025 at 23:06, Colin Watson <[email protected]> wrote:
...
> I'm downgrading this for the moment as I can't currently find evidence
> that it's a baseline violation. I've tried this in various ancient qemu
> CPU models ("-cpu Conroe", "-cpu qemu64", "-cpu core2duo"), and it seems
> fine there. I'm prepared to believe that I've missed something, but
> figuring it out seems like a bit of a fishing expedition.
Hi Colin! It's a baseline violation. Your analysis of the build files
was helpful but ultimately I just had to check the dmesg log for the
segfault and look up the offset in the shared library:
traps: mtxrun[62011] trap invalid opcode ip:7fe6e4f64988
sp:7ffe42301c80 error:0 in libmimalloc.so.3.0[c988,7fe6e4f5e000+15000]
c988: f3 48 0f b8 c2 popcnt rax,rdx
Here are the additional occurrences of popcnt in the binary:
$ objdump -d -m i386:x86-64:intel
./x86_64-linux-gnu/libmimalloc.so.3.0|grep popcnt
c988: f3 48 0f b8 c2 popcnt rax,rdx
cbec: f3 49 0f b8 c1 popcnt rax,r9
cd56: f3 4c 0f b8 d6 popcnt r10,rsi
d4e3: f3 48 0f b8 c2 popcnt rax,rdx
d585: f3 4d 0f b8 f5 popcnt r14,r13
d5ca: f3 48 0f b8 c2 popcnt rax,rdx
def4: f3 4c 0f b8 df popcnt r11,rdi
e273: f3 48 0f b8 c7 popcnt rax,rdi
ecd2: f3 49 0f b8 c2 popcnt rax,r10
ee21: f3 49 0f b8 e8 popcnt rbp,r8
f095: f3 48 0f b8 c3 popcnt rax,rbx
f1f9: f3 4d 0f b8 d8 popcnt r11,r8
This library is going to segfault on hardware pre-Sandy Bridge.
The primary source uses a generic implementation of popcount or
built-in intrinsics, which should be OK if baseline code is in fact
being generated:
https://github.com/microsoft/mimalloc/blob/09a27098aa6e9286518bd9c74e6ffa7199c3f04e/include/mimalloc/internal.h#L1069
Regards,
Adam