From nobody Thu Jul 30 09:49:29 2026 X-Original-To: dev-commits-src-all@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 4h9kvJ1jJgz6n9Mc; Thu, 30 Jul 2026 09:49:48 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 4h9kvH3mJRz44LL; Thu, 30 Jul 2026 09:49:47 +0000 (UTC) (envelope-from kib@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 66U9nT0x084342; Thu, 30 Jul 2026 12:49:32 +0300 (EEST) (envelope-from kib@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 66U9nT0x084342 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 66U9nTZC084341; Thu, 30 Jul 2026 12:49:29 +0300 (EEST) (envelope-from kib@freebsd.org) X-Authentication-Warning: tom.home: kostik set sender to kib@freebsd.org using -f Date: Thu, 30 Jul 2026 12:49:29 +0300 From: Konstantin Belousov To: Mark Millard Cc: John Baldwin , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 6e93f5e4d693 - main - amd64: FRED support Message-ID: References: <6a5e986a.22164.2ca88691@gitrepo.freebsd.org> <0c99064d-9ada-4ed9-800e-a0cae178f6c8@FreeBSD.org> <6FF84ADB-3678-480F-BD67-FF7C7A675121@yahoo.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6FF84ADB-3678-480F-BD67-FF7C7A675121@yahoo.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Rspamd-Queue-Id: 4h9kvH3mJRz44LL 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:6939, ipnet:2001:470::/32, country:US] X-Spamd-Bar: ---- On Wed, Jul 29, 2026 at 10:20:31PM -0700, Mark Millard wrote: > On Jul 29, 2026, at 20:08, Konstantin Belousov wrote: > > > On Wed, Jul 29, 2026 at 03:08:20PM -0700, Mark Millard wrote: > >> On 7/29/26 13:44, John Baldwin wrote: > >>> On 7/20/26 17:51, Konstantin Belousov wrote: > >>>> The branch main has been updated by kib: > >>>> > >>>> URL: https://cgit.FreeBSD.org/src/commit/? > >>>> id=6e93f5e4d6932c423b89dff8fc08d86f8bdeb7b9 > >>>> > >>>> commit 6e93f5e4d6932c423b89dff8fc08d86f8bdeb7b9 > >>>> Author: Konstantin Belousov > >>>> AuthorDate: 2026-02-13 11:24:40 +0000 > >>>> Commit: Konstantin Belousov > >>>> CommitDate: 2026-07-20 21:51:02 +0000 > >>>> > >>>> amd64: FRED support > >>>> FRED support as defined starting from the SDM rev. 90, > >>>> requires a new > >>>> 'events' entry point to receive user and kernel mode exceptions and > >>>> interrupts notifications from the hardware. A minimal asm > >>>> trampoline is > >>>> enough, rest can be implemented in C due to the clean FRED > >>>> organization > >>>> of the event reporting. > >>>> The syscall entry is handled by a microptimized assembly > >>>> path, directly > >>>> calling into the amd64_syscall() handler, instead of the generic > >>>> events > >>>> entry point. > >>>> Tested by: emaste > >>>> Sponsored by: The FreeBSD Foundation > >>>> MFC after: 1 week > >>>> Differential revision: https://reviews.freebsd.org/D55829 > >>> > >>> This appears to have broken the cross-build jobs on GitHub for the past > >>> week > >>> which build with clang 15 and clang 18. Are those versions too old to > >>> support > >>> the instructions used here? > >>> > >>> Sample output: > >>> > >>> -------------------------------------------------------------- > >>>>>> stage 3.1: building everything > >>> -------------------------------------------------------------- > >>> /home/runner/work/freebsd-src/freebsd-src/sys/amd64/amd64/ > >>> exception.S:1455:2: error: invalid instruction mnemonic 'eretu' > >>> eretu > >>> ^~~~~ > >>> /home/runner/work/freebsd-src/freebsd-src/sys/amd64/amd64/ > >>> exception.S:1521:2: error: invalid instruction mnemonic 'lkgs' > >>> lkgs %ax > >>> ^~~~ > >>> /home/runner/work/freebsd-src/freebsd-src/sys/amd64/amd64/ > >>> exception.S:1542:2: error: invalid instruction mnemonic 'eretu' > >>> eretu > >>> ^~~~~ > >>> /home/runner/work/freebsd-src/freebsd-src/sys/amd64/amd64/ > >>> exception.S:1662:2: error: invalid instruction mnemonic 'erets' > >>> erets > >>> ^~~~~ > >>> /home/runner/work/freebsd-src/freebsd-src/sys/amd64/amd64/ > >>> exception.S:1682:2: error: invalid instruction mnemonic 'erets' > >>> erets > >>> ^~~~~ > >>> --- exception.o --- > >>> *** [exception.o] Error code 1 > >>> > >>> (Or maybe clang needs some -m or .set to enable use of these > >>> instructions?) > >>> > >> > >>> From what I read (but its is only reading): > >> > >> clang-15 predates any FRED support. > >> clang-17 was more incomplete/preliminary/experimental for FRED support > >> > >> > >> clang-18 has .S and inline assembly FRED support but various (most?) > >> target triples do not enable it by default. > >> > >> Possibly add to appropriate .S file(s): > >> > >> .arch x86-64 > >> .arch .fred > >> .arch .lkgs > >> > >> for defined(__clang__) && (__clang_major__ >= 18) > >> > >> Or, make use of: > >> > >> -Wa,-mwave-fred -Wa,-mwave-lkgs > >> > >> > >> clang-19 has the intended fully general handling of FRED. > > > > I think that the adequate workaround would be to #ifdef out the > > instructions for old versions of clang. I doubt that anybody would > > run the built kernel, esp. on the new enough hardware. > > > > But I am open for other suggestions. > > > So far as I can tell, clang documentation does not cover this area, > making what I read solidly hear-say. (The -mwave-* notation is a > possible hint at that status.) It seems that linux may have gotten > its source to go through all the tools via use of (what translates > to) .byte use for the 3 instructions. > > It is not clear to me what versions of clang may require -mattr= or > -mcpu= to specify something known to support LKGS/FRED in order to > enable the notation for the 3 instructions. > > > [Note: For some reason, I only found your note in my Email, not in > dev-commits-src-all@ or dev-commits-src-main@ (via multiple ways of > accessing those). So this is an Email based reply, not thunderbird > based use of news.gmane.io .] https://reviews.freebsd.org/D58550