NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/47248: Using -march=native on Intel I5 causes illegal instructions



>Number:         47248
>Category:       kern
>Synopsis:       Using -march=native on Intel I5 causes illegal instructions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 26 10:10:00 +0000 2012
>Originator:     Jaap Boender
>Release:        6.0_STABLE
>Organization:
>Environment:
NetBSD purcell.mdx.ac.uk 6.0_STABLE NetBSD 6.0_STABLE (PURCELL) #6: Tue Nov 20 
14:03:01 GMT 2012  
root%purcell.mdx.ac.uk@localhost:/usr/obj/sys/arch/amd64/compile/PURCELL amd64
>Description:
[See also the discussion on port-amd64, starting here: 
http://mail-index.netbsd.org/port-amd64/2012/11/13/msg001794.html ]

On my laptop, which has an Intel i5-3320 CPU (see below for cpuctl output), 
using devel/cpuflags results in the kernel, toolchain and distribution being 
compiled with
-march=native -msse3 -mfpmath=sse. This works fine for kernel and toolchain, 
but after installing the new distribution, every executable I try to run 
coredumps with "Illegal instruction".

This seems to be a problem with AVX instructions being generated, but the AVX 
bit in the kernel not being set.

An example of a generated executable and its core dump can be found on 
ftp.NetBSD.org in /pub/NetBSD/misc/jaapb/amd64_ill/gawk{,core} .

-- cpuctl identify output --
cpu0: Intel Pentium Pro, II or III (686-class), 2591.84 MHz, id 0x306a9
cpu0: features  0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu0: features  0xbfebfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR>
cpu0: features  0xbfebfbff<SSE,SSE2,SS,HTT,TM,SBF>
cpu0: features2 0x77bae3ff<SSE3,PCLMULQDQ,DTES64,MONITOR,DS-CPL,VMX,SMX,EST>
cpu0: features2 0x77bae3ff<TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE41,SSE42,X2APIC>
cpu0: features2 0x77bae3ff<POPCNT,B24,AES,XSAVE,AVX,F16C,B30>
cpu0: features3 0x28100800<SYSCALL/SYSRET,XD,EM64T>
cpu0: features4 0x1<LAHF>
cpu0: "Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz"
cpu0: ITLB 64 4KB entries 4-way
cpu0: DTLB 64 4KB entries 4-way
cpu0: Initial APIC ID 0
cpu0: Cluster/Package ID 0
cpu0: Core ID 0
cpu0: SMT ID 0
cpu0: family 06 model 0a extfamily 00 extmodel 03 stepping 09
cpu0: UCode version: ?

>How-To-Repeat:
Compile something with the -march=native flag on an Intel i5-3320 CPU. I 
detected the problem with build.sh distribution, but just compiling lang/gawk 
also triggers the problem.
>Fix:
A workaround is not using -march=native but -march=core2. This works fine.



Home | Main Index | Thread Index | Old Index