Hello all,

Recently our QAs used valgrind tool(valgrind-3.20.0.GIT) to verify memory leak 
with Qemu release on Intel new Sapphire Rapids platform. They only focused on
Sapphire Rapids' new features which are merged into Linux and Qemu release.

#The command
/usr/local/bin/valgrind --log-file=/root/valgrind.log --leak-check=full -v \
./qemu-system-x86_64 \
 ...... 

#Qemu will report below issue with valgrind tool:
qemu-system-x86_64: warning: prctl(ARCH_REQ_XCOMP_GUEST_PERM) failure for 
feature bit 18
qemu-system-x86_64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Operation not 
permitted

W/o valgrind tool, the AMX can work normally in latest Linux and Qemu release.

I checked the Qemu code, below syscall will fail(rc=-1) with valgrind tool
int rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit);
Notice: bit=18, which is AMX feature in xstate area.

I also use same valgrind command to check amx selftool on Sapphire Rapids 
platform.

/usr/local/bin/valgrind --log-file=/root/valgrind.log --leak-check=full -v 
linux/tools/testing/selftests/x86/amx_64
amx_64: [FAIL]  xstate cpuid: invalid tile data size/offset: 0/0: Success

from the linux/tools/testing/selftests/x86/amx.c

        eax = CPUID_LEAF_XSTATE;
        ecx = XFEATURE_XTILEDATA;

        cpuid(&eax, &ebx, &ecx, &edx);
        /*
         * eax: XTILEDATA state component size
         * ebx: XTILEDATA state component offset in user buffer
         */
        if (!eax || !ebx)
                fatal_error("xstate cpuid: invalid tile data size/offset: 
%d/%d",
                                eax, ebx);

Above code only read AMX xtilestate's offset and size from xstate buffer by 
cpuid.
But from the error information, with valgrind tool, the amx selftest tool in 
Linux can't
read correct Sapphire Rapids platform's cpuid registers. 

I also tried this same command w/o valgrind tool in intel older 
platform(without this feature),
we can get same error information, but this should be normal behavior.
root@icx:~/yangzhon/projects/amx/linux# tools/testing/selftests/x86/amx_64
amx_64: [FAIL]  xstate cpuid: invalid tile data size/offset: 0/0: Success

So, from above issue in Intel new platform, the valgrind need do some enablings 
to be compatible
with on new platform? Seems valgrind tool can't identify the real HW platform 
because cpuid can't
read correct register value. thanks!

Regards,
Yang



_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to