Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal instruction on x86 Qemu guest #272

Closed
svillemot opened this issue Aug 4, 2013 · 5 comments · Fixed by #288
Closed

Illegal instruction on x86 Qemu guest #272

svillemot opened this issue Aug 4, 2013 · 5 comments · Fixed by #288
Labels

Comments

@svillemot
Copy link
Contributor

The OpenBLAS 0.2.8 Debian package for i386 (x86) fails to build. A test crashes with illegal instruction. The full build log is there:

https://buildd.debian.org/status/fetch.php?pkg=openblas&arch=i386&ver=0.2.8-1&stamp=1375567538

The machine on which the build was performed is a Qemu guest. Here is the contents of its /proc/cpuinfo (repeated 8 times):

processor       : 7
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 2
model name      : QEMU Virtual CPU version 1.1.2
stepping        : 3
microcode       : 0x1000065
cpu MHz         : 2100.000
cache size      : 512 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 4
wp              : yes
flags           : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 popcnt hypervisor lahf_lm svm abm sse4a
bogomips        : 4200.00
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

I don't have access to the machine. However, if needed, I could try to replicate the problem by creating a similar Qemu guest.

@xianyi
Copy link
Collaborator

xianyi commented Aug 4, 2013

Hi @sebastien-villemot ,

Thank you for the feedback.

I didn't meet this error before. Please reproduce this problem on your Qemu guest.

I need the backtrace and the exe file. Then, I can objdump the exe to investigate the instruction.

Xianyi

@cartazio
Copy link

I don't see xsave on the list of cpu extensions, isn't xsave needed for simd registers to work well with function calls?

@xianyi
Copy link
Collaborator

xianyi commented Aug 24, 2013

I think xsave is for AVX instructions. Qemu looks like a SSE4a CPU cores.

@svillemot
Copy link
Contributor Author

I have found the cause of this problem. The Qemu guest mentioned above is recognized as an Athlon by the dynamic engine of OpenBLAS (because of its CPU vendor and model). However, the virtual CPU does not have the 3dnow! extension. Hence OpenBLAS crashes when trying to use that set of instructions.

I have therefore patched the Debian package for OpenBLAS in such a way that it effectively tests the presence of 3dnow! extension before deciding it is an Athlon CPU. Otherwise, it fallbacks to Katmai.

The patch is available there: http://anonscm.debian.org/gitweb/?p=debian-science/packages/openblas.git;a=blob;f=debian/patches/qemu-athlon.patch;h=51174b97098e9b2191bde9210e9ca01f4911b275;hb=HEAD

Tell me if you are willing to incorporate it into OpenBLAS, in which case I'll do a pull request.

@xianyi
Copy link
Collaborator

xianyi commented Aug 28, 2013

Hi @sebastien-villemot ,

Good work!~
Thank you for the investigation. Please do a pull request.

Xianyi

svillemot added a commit to svillemot/OpenBLAS that referenced this issue Aug 28, 2013
The present patch verifies that, on machines declaring an Athlon CPU model and
family, the 3dnow and 3dnowext feature flags are indeed present. If they are
not, it fallbacks on the most generic x86 kernel. This prevents crashes due to
illegal instruction on qemu guests with a weird configuration.

Closes OpenMathLib#272
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants