FS#49518 - [llvm-libs] libllvm-3.8.0 emits unsupported AVX-512 instructions for Skylake processors

Attached to Project: Arch Linux
Opened by Ivan Krasilnikov (ivank) - Tuesday, 31 May 2016, 02:23 GMT
Last edited by Evangelos Foutras (foutrelis) - Tuesday, 27 June 2017, 07:18 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Evangelos Foutras (foutrelis)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I've found the problem by attempting a clean install of archlinux with cinnamon desktop environment in a QEMU/KVM virtual machine on Intel i7-6700k CPU. The bug makes cinnamon crash upon start, showing repeatedly only "Cinnamon just crashed" popup, whole GUI session is basically totally unusable. Haven't tested on bare metal, but from what I can see, it would crash there too.

Steps to reproduce:
1) Create and start VM:
$ qemu-img create -f qcow2 image.qcow2 10G && qemu-system-x86_64 -enable-kvm -machine pc,accel=kvm -cpu host -m 2048 -cdrom archlinux-2016.05.01-dual.iso image.qcow2
(Side note: disabling AVX with "-cpu host,-avx" flag would eliminate crashes)
2) Install a minimal archlinux with cinnamon. In particular packages: base xorg-server xorg-xinit xterm cinnamon.
3) Start a cinnamon session manually: startx, and then cinnamon-session in xterm.

Cinnamon would repeatedly fail to start, because /usr/bin/cinnamon crashes with SIGILL on the instructions below:
kmovw %edx,%k0
kmovb %ecx,%k1
korw %k0,%k1,%k0

These are new AVX512 instructions, which are not available Skylake CPUs, although initially Intel had plans to include them. That section of code appears to be dynamically generated by libllvm and it emits them because its skylake cpu definition says that it supports AVX512.

Code reference: http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz, file lib/Target/X86/X86.td
487: // FIXME: define SKX model
488: class SkylakeProc<string Name> : ProcessorModel<Name, HaswellModel, [
489: FeatureMMX,
490: FeatureAVX512, <-- BUG
491: FeatureFXSR,

The bug should have been fixed upstream as of this commit: http://llvm.org/viewvc/llvm-project?view=revision&revision=258659
It's probably too much work to merge it, I'd propose instead just to patch tarball to drop "FeatureAVX512" line above, that should do the trick. I did not test.

Additional info:
* package version(s)
cinnamon 3.0.4-1
llvm-libs 3.8.0-1
* config and/or log files etc.
gdb screenshots and /proc/cpuinfo attached.

--
Best regards
Ivan
This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Tuesday, 27 June 2017, 07:18 GMT
Reason for closing:  Fixed
Additional comments about closing:  Seems fixed upstream since LLVM 3.9.0.
Comment by Ivan Krasilnikov (ivank) - Tuesday, 31 May 2016, 02:35 GMT
Ubuntu apparently has also stumbled on this bug:
https://bugs.launchpad.net/oem-priority/+bug/1564156

Loading...