---------- Forwarded message ---------- From: 王昊然 <msl0000023...@gmail.com> Date: Thu, 20 Oct 2022 00:33:18 +0800 Subject: Re: Bug#1022049: libnettle8: Illegal instruction on IBM POWER7 To: Niels Möller <ni...@lysator.liu.se>
2022-10-20 0:18 GMT+08:00, 王昊然 <msl0000023...@gmail.com>: >> The ppc specification says "vmrgow is treated as a Vector >> instruction in terms of resource availability.", it's not entirely clear >> to me what that means, and if checking for altivec support should be >> enough. >> >> The fat setup for ppc is intended to enable the crashing code path only >> if the feature bits PPC_FEATURE_HAS_ALTIVEC and PPC_FEATURE_HAS_VSX are >> both set in the status word returned from >> ... > > Thanks for the hint, I guess this issue is likely caused by my kernel which > wasn't have CONFIG_VSX enabled. But in my understanding, this feature is an > extension to AltiVec, not the AltiVec itself, so nettle shouldn't assume > VSX > to be available if they seen AltiVec available. > > >> You can get some diagnostics from the initialization process by setting >> the NETTLE_FAT_VERBOSE environment variable, and override the automatic >> detection with the NETTLE_FAT_OVERRIDE environment variable. > > $ NETTLE_FAT_VERBOSE=1 test-program > libnettle: cpu features: > libnettle: enabling altivec code. > Illegal instruction > > >> Can you check what getauxval(AT_HWCAP) returns on your system? > > whr@debian:~/src$ cat cpu-feature-test.c > #include <sys/auxv.h> > #include <stdio.h> > > int main() { > unsigned long int hwcap = getauxval(AT_HWCAP); > printf("hwcap = 0x%lx\n", hwcap); > return 0; > } > whr@debian:~/src$ gcc -Wall cpu-feature-test.c > whr@debian:~/src$ ./a.out > hwcap = 0xdc0065c2 > > >> Is the program that crashes running under a vm, or is the kernel running >> on the bare metal? Each layer of vm tends to be ian opportunity to >> introduce >> errors in the list of available processor features. > > Operating systems on this machine are always running on the Power > Hypervisor, > which is a part of the server firmware. > I just checked the nettle source code, it is indeed correctly checked both PPC_FEATURE_HAS_ALTIVEC and PPC_FEATURE_HAS_VSX; and with my HWCAP has PPC_FEATURE_HAS_VSX set, I think it hits a limitation of this processor feature checking logic: hardware supporting it, but the kernel didn't. I will try to build a new kernel with CONFIG_VSX enabled by tomorrow.