From nobody Fri Dec 29 20:31:10 2023 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1xq61sxHz558lk for ; Fri, 29 Dec 2023 20:31:14 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1xq606c3z3T9m; Fri, 29 Dec 2023 20:31:13 +0000 (UTC) (envelope-from freebsd@omnilan.de) Authentication-Results: mx1.freebsd.org; none Received: from mh0.gentlemail.de (mh0.gentlemail.de [78.138.80.135]) by mx0.gentlemail.de (8.15.2/8.15.2) with ESMTP id 3BTKVAXP035776; Fri, 29 Dec 2023 21:31:10 +0100 (CET) (envelope-from freebsd@omnilan.de) Received: from [172.21.3.1] (s1.omnilan.de [217.91.127.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id C72B9391; Fri, 29 Dec 2023 21:31:10 +0100 (CET) Message-ID: Date: Fri, 29 Dec 2023 21:31:10 +0100 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SIGILL when CPUTYPE set to anyting witjh avx and CFLAGS -O2 Content-Language: en-US To: Konstantin Belousov Cc: Dimitry Andric , FreeBSD-STABLE References: <72107B4B-F279-471B-8A8F-5B94C5EEDA47@FreeBSD.org> <62cc8fed-6acd-45fb-a138-ac7cd218191a@omnilan.de> From: Harry Schmalzbauer Organization: OmniLAN In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:61157, ipnet:2a00:e10:2800::/38, country:DE] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4T1xq606c3z3T9m On 12/29/23 21:20, Konstantin Belousov wrote: > On Fri, Dec 29, 2023 at 09:12:35PM +0100, Harry Schmalzbauer wrote: >> On 12/29/23 18:00, Dimitry Andric wrote: >>> On 29 Dec 2023, at 11:14, Harry Schmalzbauer wrote: >>>> >>>> at least since 14-release, I can't compile base/ports with CPUTYPE post nehalem. Any '-march' declaring AVX(*) capability leads to SIGILLing binaries with default -O2 CFLAGS. >> .. >>>> >>>> If I compile without CFLAGS -O2 ("CFLAGS= -pipe"), -march=skylake-avx512 the binary doens't crash with SIGILL. >>>> >>>> Is CPUTYPE supposed to stay untouched these days? >>> >>> Obviously not, but are you sure your target CPU is correct? If it is not, the compiler may insert unsupported instructions. >> >> Ho Dimitry, thanks for your attention! >> I have to admit that I know much too less about contemporary compilers and >> CPUs likewise, but target CPU matches -march ;-) >> I nailed it down to AVX instructions. Starting with 'sandybridge', Intel >> CPUs provide avx instruction units, and starting with CPUTYPE?=sandybridge, >> binaries crash on stable/14 (and late 14-current) on the corresponding >> machines. But only in combination with CFLAGS -O2! >> >> >>> In any case, for the above gdb session, try the command "disassemble" to see which particular instruction it crashed on. That may give more information. >> >> Thanks for the hint! >> This came out: >> Program terminated with signal SIGILL, Illegal instruction. >> Privileged opcode. >> #0 0x000000000041e040 in init_yank () >> (gdb) disassemble >> Dump of assembler code for function init_yank: >> 0x000000000041e030 <+0>: push %rbp >> 0x000000000041e031 <+1>: mov %rsp,%rbp >> 0x000000000041e034 <+4>: vpxor %xmm0,%xmm0,%xmm0 >> 0x000000000041e038 <+8>: vmovdqa -0x202c10(%rip),%xmm1 # 0x21b430 >> => 0x000000000041e040 <+16>: kxnorw %k0,%k0,%k1 > This is AVX512 instruction (some of it subset, probably F), not AVX. > ... >> Intel(R) Xeon(R) CPU E3-1275 v6 @ 3.80GHz (3800.00-MHz K8-class CPU) My bad, sorry. Confused machines. This indeed was wrong target CPU, stupid me. Previously I tested tih CPUTYPE?=haswell, which editors/vim survives currently. Will run a base build with CPUTYPE?=haswell over the weekend and report back. Sorry for the noise so far... -harry