If you need avx2 support, --cpu Haswell-noTSX,-x2apic works on Haswell desktop/laptop chips.
The most confusing problem is that qemu's definition of "Haswell" is actually Haswell-E, -EP and -EX; Haswell itself lacks x2apic, which qemu's Haswell requires. x2apic dates back to Nehalem, but qemu's CPU definitions only include it back to Sandy Bridge, so a standard desktop or laptop Haswell CPU falls all the back to Westmere and then adds flags including avx, avx2 and xsave on top of that[0]. Advertising support for AVX and AVX2 is just a matter of setting CPUID.1:ECX.AVX and CPUID.7:EBX.AVX2, but the instructions won't actually work unless XCR0.AVX is set, and kvm_load_guest_xcr0 only sets XCR0 from the guest if the guest's XR4.OSXSAVE is set. The guest's fpu__init_cpu_xstate only sets CR4.OSXSAVE when xfeatures_mask is non- zero, and xfeatures_mask is calculated by fpu__init_system_xstate from CPUID.(EAX=0DH,ECX=0), which doesn't exist on qemu's Westmere (level=0xb), so XCR0.AVX remains unset and AVX2 instructions #UD. The bug is probably that raid6_have_avx2 only checks that AVX2 is supported in CPUID, not that it's enabled. Checking for X86_FEATURE_OSXSAVE might work, though I'm not sure if the value checked by boot_cpu_has is stored too early for that. I am also a little suspicious of kvm_load_guest_xcr0's CR4.OSXSAVE guard. The Intel manuals state that XSAVE, XSRSTOR, XGETBV and XSETBV require the flag to be set, but KVM won't restore a guest's existing XCR0 unless OSXSAVE is still set. [0] "-cpu Westmere,+invpcid,+erms,+bmi2,+smep,+avx2,+bmi1,+fsgsbase,+abm,+rdtscp,+pdpe1gb,+rdrand,+f16c,+avx,+osxsave,+xsave,+tsc-deadline,+movbe,+pcid,+pdcm,+xtpr,+fma,+tm2,+est,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme" -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1524069 Title: [Xenial] KVM trusty guest 3.13.0-68 raid6-pq panic in raid6_avx21_gen_syndrome() while probing grub devices [was: Xenial KVM: updating Trusty guest from 3.13.0-68 to 3.13.0-71 causes kernel exception] Status in kvm package in Ubuntu: Confirmed Status in linux package in Ubuntu: Confirmed Bug description: The symptom I saw was this (note the segfault, and apt-get upgrade hangs after this): Setting up linux-image-3.13.0-71-generic (3.13.0-71.114) ... Running depmod. update-initramfs: deferring update (hook will be called later) Examining /etc/kernel/postinst.d. run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic update-initramfs: Generating /boot/initrd.img-3.13.0-71-generic run-parts: executing /etc/kernel/postinst.d/pm-utils 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic Generating grub configuration file ... Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. Found linux image: /boot/vmlinuz-3.13.0-71-generic Found initrd image: /boot/initrd.img-3.13.0-71-generic Found linux image: /boot/vmlinuz-3.13.0-68-generic Found initrd image: /boot/initrd.img-3.13.0-68-generic Segmentation fault done Setting up linux-firmware (1.127.19) ... Setting up linux-image-extra-3.13.0-71-generic (3.13.0-71.114) ... run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic update-initramfs: Generating /boot/initrd.img-3.13.0-71-generic run-parts: executing /etc/kernel/postinst.d/pm-utils 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-71-generic /boot/vmlinuz-3.13.0-71-generic Generating grub configuration file ... Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. Found linux image: /boot/vmlinuz-3.13.0-71-generic Found initrd image: /boot/initrd.img-3.13.0-71-generic Found linux image: /boot/vmlinuz-3.13.0-68-generic Found initrd image: /boot/initrd.img-3.13.0-68-generic In dmesg, I saw a corresponding kernel stack trace: [ 522.649091] SGI XFS with ACLs, security attributes, realtime, large block/inode numbers, no debug enabled [ 522.654031] JFS: nTxBlock = 8192, nTxLock = 65536 [ 522.660515] NTFS driver 2.1.30 [Flags: R/O MODULE]. [ 522.672519] QNX4 filesystem 0.2.3 registered. [ 522.677257] xor: measuring software checksum speed [ 522.715613] prefetch64-sse: 17306.000 MB/sec [ 522.755589] generic_sse: 16039.000 MB/sec [ 522.755590] xor: using function: prefetch64-sse (17306.000 MB/sec) [ 522.823619] raid6: sse2x1 10481 MB/s [ 522.891614] raid6: sse2x2 13303 MB/s [ 522.959616] raid6: sse2x4 15209 MB/s [ 522.963634] invalid opcode: 0000 [#1] SMP [ 522.963645] Modules linked in: raid6_pq(+) xor ufs qnx4 hfsplus hfs minix ntfs msdos jfs xfs libcrc32c ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT xt_CHECKSUM iptable_mangle xt_tcpudp bridge stp llc ip6table_filter ip6_tables iptable_filter ip_tables ebtable_nat ebtables x_tables snd_hda_intel snd_hda_codec snd_hwdep qxl snd_pcm kvm_intel ttm snd_page_alloc kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel drm_kms_helper snd_timer aesni_intel snd aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd drm soundcore lp parport serio_raw i2c_piix4 mac_hid pata_acpi floppy psmouse [ 522.963746] CPU: 2 PID: 11288 Comm: modprobe Not tainted 3.13.0-68-generic #111-Ubuntu [ 522.963751] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 [ 522.963755] task: ffff880059363000 ti: ffff88005dec6000 task.ti: ffff88005dec6000 [ 522.963759] RIP: 0010:[<ffffffffa049dd0a>] [<ffffffffa049dd0a>] raid6_avx21_gen_syndrome+0x4a/0x160 [raid6_pq] [ 522.963767] RSP: 0018:ffff88005dec7c40 EFLAGS: 00010246 [ 522.963771] RAX: 0000000000000000 RBX: ffff88005dec7c88 RCX: ffff880059363000 [ 522.963774] RDX: 0000000000000000 RSI: 0000000000000080 RDI: 0000000000000012 [ 522.963778] RBP: ffff88005dec7c70 R08: 0000000000000086 R09: 000000000000025f [ 522.963781] R10: 0000000000000000 R11: ffff88005dec79ae R12: 0000000000001000 [ 522.963785] R13: ffff880043a42000 R14: ffff880043a43000 R15: 0000000000000012 [ 522.963789] FS: 00007fa330823740(0000) GS:ffff88007fd00000(0000) knlGS:0000000000000000 [ 522.963793] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 522.963796] CR2: 00007fa330623000 CR3: 0000000036acf000 CR4: 00000000001006e0 [ 522.963801] Stack: [ 522.963803] 0000000000000080 ffffffffa049e238 ffffffffa04b0720 ffff880043a42000 [ 522.963810] 0000000000003cd7 000000010000d992 ffff88005dec7d40 ffffffffa00d20fb [ 522.963817] 0000000000000000 ffffffffa04a0600 ffffffffa04a1600 ffffffffa04a2600 [ 522.963824] Call Trace: [ 522.963838] [<ffffffffa00d20fb>] init_module+0xfb/0x1000 [raid6_pq] [ 522.963843] [<ffffffffa00d2000>] ? 0xffffffffa00d1fff [ 522.963849] [<ffffffff8100214a>] do_one_initcall+0xfa/0x1b0 [ 522.963854] [<ffffffff81059903>] ? set_memory_nx+0x43/0x50 [ 522.963859] [<ffffffff810e29bd>] load_module+0x12dd/0x1b40 [ 522.963863] [<ffffffff810de440>] ? store_uevent+0x40/0x40 [ 522.963868] [<ffffffff810e3396>] SyS_finit_module+0x86/0xb0 [ 522.963873] [<ffffffff81734cdd>] system_call_fastpath+0x1a/0x1f [ 522.963876] Code: 00 00 00 00 53 48 89 d3 48 83 ec 08 48 89 75 d0 4c 8b 2c c2 4c 8b 74 32 08 e8 13 f9 b7 e0 84 c0 0f 84 f1 00 00 00 e8 c6 f9 b7 e0 <c5> fd 6f 05 ee 2a 01 00 c5 e5 ef db 4d 85 e4 0f 84 c0 00 00 00 [ 522.963940] RIP [<ffffffffa049dd0a>] raid6_avx21_gen_syndrome+0x4a/0x160 [raid6_pq] [ 522.963946] RSP <ffff88005dec7c40> [ 522.963949] ---[ end trace 7324d498bc862f81 ]--- ProblemType: Bug DistroRelease: Ubuntu 14.04 Package: linux-image-3.13.0-68-generic 3.13.0-68.111 ProcVersionSignature: Ubuntu 3.13.0-68.111-generic 3.13.11-ckt27 Uname: Linux 3.13.0-68-generic x86_64 AlsaVersion: Advanced Linux Sound Architecture Driver Version k3.13.0-68-generic. AplayDevices: Error: [Errno 2] No such file or directory: 'aplay' ApportVersion: 2.14.1-0ubuntu3.19 Architecture: amd64 ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord' AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/by-path', '/dev/snd/controlC0', '/dev/snd/hwC0D0', '/dev/snd/pcmC0D0c', '/dev/snd/pcmC0D0p', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1: CRDA: Error: [Errno 2] No such file or directory: 'iw' Card0.Amixer.info: Error: [Errno 2] No such file or directory: 'amixer' Card0.Amixer.values: Error: [Errno 2] No such file or directory: 'amixer' Date: Tue Dec 8 13:08:13 2015 HibernationDevice: RESUME=UUID=69fc2e53-278d-40ca-8109-64f826a073e7 IwConfig: Error: [Errno 2] No such file or directory: 'iwconfig' Lsusb: Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub MachineType: QEMU Standard PC (i440FX + PIIX, 1996) ProcEnviron: TERM=xterm-256color PATH=(custom, no user) XDG_RUNTIME_DIR=<set> LANG=en_US.UTF-8 SHELL=/bin/bash ProcFB: 0 qxldrmfb ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.13.0-68-generic root=UUID=897d5dd8-599e-42f9-a081-96f73cef59d9 ro splash quiet vt.handoff=7 RelatedPackageVersions: linux-restricted-modules-3.13.0-68-generic N/A linux-backports-modules-3.13.0-68-generic N/A linux-firmware 1.127.19 RfKill: Error: [Errno 2] No such file or directory: 'rfkill' SourcePackage: linux UpgradeStatus: No upgrade log present (probably fresh install) dmi.bios.date: 04/01/2014 dmi.bios.vendor: SeaBIOS dmi.bios.version: Ubuntu-1.8.2-1ubuntu1 dmi.chassis.type: 1 dmi.chassis.vendor: QEMU dmi.chassis.version: pc-i440fx-wily dmi.modalias: dmi:bvnSeaBIOS:bvrUbuntu-1.8.2-1ubuntu1:bd04/01/2014:svnQEMU:pnStandardPC(i440FX+PIIX,1996):pvrpc-i440fx-wily:cvnQEMU:ct1:cvrpc-i440fx-wily: dmi.product.name: Standard PC (i440FX + PIIX, 1996) dmi.product.version: pc-i440fx-wily dmi.sys.vendor: QEMU To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kvm/+bug/1524069/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp