From nobody Sun May 22 10:38:49 2022 X-Original-To: freebsd-arm@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 64C5D1AE8301 for ; Sun, 22 May 2022 10:38:54 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic311-23.consmr.mail.gq1.yahoo.com (sonic311-23.consmr.mail.gq1.yahoo.com [98.137.65.204]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 4L5cQ53vHpz3Q1q for ; Sun, 22 May 2022 10:38:53 +0000 (UTC) (envelope-from marklmi@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1653215932; bh=DPyCaTVJnKCRUmyGBEJGYnOvBoRcgiL6jSxN7AOOcqc=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject:Reply-To; b=DhbQJcGhclZmv7MUaiV4fhnkqCgExZXW43R+s/Auo6sHCqAf68W9rpbs4ExaZcKUMbqITFAMbUQlobdA/oA4yxVZYzfb26b/6tdzxqWway9J9aayTkwuZpurPxId/rp1SOYchKj53dArV3l9ioyiReMWLb5wVtgsfztRtCCLyDnyQFFsme8AGeu/U5TOAE/X2/CcDhifVZgYCpPaKvr5dm2re9hFHee1Mcno3OKwHMMEX7c3plZmZn9SMDVcGers9wWaGc+T5KkWVW972lxneWBByi8/s0w3wfbgDxSMVAaiV9eBLKI4cN1pODjfD5VmaOgU33UzuOVTgkfpO41vBw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1653215932; bh=pCayyy7ZPoR3pvTMmbu20HCMXl+cBdKxRo9LjTwqZuH=; h=X-Sonic-MF:Subject:From:Date:To:From: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146kxlO23HW5Js. yGEmW6cc.0ssDS1xnfeL8jLnPTTSAEREoCqa2ewBC9XenOsJpgH1qwPUQCUYV8YD0gl6BzqToxNI ZVlXxDEYcexD7p09cAKEDqh5nOUe2cBasfbLHPWDDFuX.WlNueiq0EP6Z_hJO8V_fop502nm7vTY fpIFZJehpeUsaYZNyy0aiGbUAdYmurq_LuIOaWavLx5FW_TlTX98nj4oc5X9QQjxuOfBfSVcozS. MjeWmhR5FTdbkyC8.qaFM5xsOHrIqTXdxhfL4NP4Ueegc5GT6_uxBnWlxgDPV09.jhq3vURMl7XL EzSIKBYvRVp9QDwSl6IWP5CEUAU8ilkgkJGkSpedy9iE.xSP7LmLiZ_apeFNvNZHO8SmmV_CbD.r Plg3OeXsHQCdK1xp4gJUOjwggulwZX7g_HBXpUVSXs8fChkZTrcU64hEy2BzrC..nVGfJ4OPdmm8 lKdopV0jwTauYjYp.zbHX1lOi00Av9zLqEJ.84gnKhrRwtZi1xsU13oV79OFRJ3UL9EmNTq7tscc 8rfVgqiQYJ79huBFuOkjEQBA687Kz5gcMVQ-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.gq1.yahoo.com with HTTP; Sun, 22 May 2022 10:38:52 +0000 Received: by hermes--canary-production-gq1-5cd7967f4d-jm9lz (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 4305aa6208283caf2d2296c546a519ce; Sun, 22 May 2022 10:38:50 +0000 (UTC) Content-Type: text/plain; charset=utf-8 List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: main's recent loader.efi broken in an example aarch64 update context From: Mark Millard In-Reply-To: <54447E1F-3D16-438A-A17D-5FB8A1F4B4F2@yahoo.com> Date: Sun, 22 May 2022 03:38:49 -0700 Cc: Warner Losh , Dimitry Andric Content-Transfer-Encoding: quoted-printable Message-Id: References: <04B81938-102C-457D-A22F-5489ED42507D@yahoo.com> <54447E1F-3D16-438A-A17D-5FB8A1F4B4F2@yahoo.com> To: Free BSD X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4L5cQ53vHpz3Q1q X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=DhbQJcGh; dmarc=pass (policy=reject) header.from=yahoo.com; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.65.204 as permitted sender) smtp.mailfrom=marklmi@yahoo.com X-Spamd-Result: default: False [-2.95 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; NEURAL_HAM_LONG(-1.00)[-0.996]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.204:from]; NEURAL_HAM_SHORT(-0.45)[-0.452]; MLMMJ_DEST(0.00)[freebsd-arm]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim] X-ThisMailContainsUnwantedMimeParts: N On 2022-May-20, at 10:31, Mark Millard wrote: > On 2022-May-17, at 18:09, Mark Millard wrote: >=20 >> [I've cc'd some folks that recently committed onto main's stand/ >> or did the llvm14 toolchain merge. I've no clue what makes the >> difference.] >>=20 >> Note: the MACCHIATObin Double Shot has a EDK2 based >> UEFI/ACPI context for how it is set up to boot. >>=20 >> In trying to update a MACCHIATObin Double Shot to a main >> vintage with llvm14 I got boot attempts that look like the >> below at the tail of its visible activity (serial console): >>=20 >> QUOTE >> Loading kernel... >> /boot/kernel/kernel text=3D0x2a8 text=3D0x91b040 text=3D0x216434 = data=3D0x1b8128 data=3D0x >> 0+0x2ae000 0x8+0x130980+0x8+0x157b86 >> Loading configured modules... >> /boot/kernel/cryptodev.ko text=3D0x16c3 text=3D0x27a0 data=3D0x628+0x10= 0x8+0xcd8+0x8+ >> 0x96c >> /boot/kernel/zfs.ko text=3D0xa81a0 text=3D0x209310 = data=3D0x26a88+0xba46c 0x8+0x32a78+ >> 0x8+0x2c37e >> /etc/hostid size=3D0x25 >> /boot/entropy size=3D0x1000 >> No valid device tree blob found! >> WARNING! Trying to fire up the kernel, but no device tree blob found! >> EFI framebuffer information: >> addr, size 0x0, 0x0 >> dimensions 0 x 0 >> stride 0 >> masks 0x00000000, 0x00000000, 0x00000000, 0x00000000 >>=20 >>=20 >> Synchronous Exception at 0x00000000B460F554 >> END QUOTE >>=20 >> Part of the update was updating the loader.efi copies: >>=20 >> # ls -Tldt /mnt/efi/*/* >> -r-xr-xr-x 1 root wheel 1204828 May 14 18:53:16 2022 = /mnt/efi/boot/bootaa64.efi >> -r-xr-xr-x 1 root wheel 1204828 May 14 18:53:16 2022 = /mnt/efi/freebsd/loader.efi >>=20 >>=20 >>=20 >> I had to revert to copies of a prior loader.efi vintage that >> I had around to copy in order to boot the otherwise updated >> USB3 drive. Nothing else had to change. Copied from: >>=20 >> CA72_Mbin_ZFS aarch64 1400057 1400057 # ls -Tldt /boot/efi/efi/*/* >> -rwxr-xr-x 1 root wheel 1287580 Apr 28 21:46:46 2022 = /boot/efi/efi/boot/bootaa64.efi >> -rwxr-xr-x 1 root wheel 1287580 Apr 28 21:46:46 2022 = /boot/efi/efi/freebsd/loader.efi >>=20 >>=20 >=20 >=20 > By the way, yesterday I tried updating my amd64 context's loader.efi = use > based on an install from a buildworld buildkernel made from the same > source files (by content). The amd64 one worked fine. So the problem = is > somehow more specific to my aarch64 context. >=20 > But I just tried the armv7 system and it got: >=20 > . . . > Hit [Enter] to boot immediately, or any other key for command prompt. > Booting [/boot/kernel/kernel]... =20 > Using DTB provided by EFI at 0x47edf000. > Kernel entry at 0xb2e00200... > Kernel args: (null) > undefined instruction > pc : [] lr : [] > reloc pc : [<44e3f4a4>] lr : [<44e9d28c>] > sp : b9f6a328 ip : b69e1c00 fp : b9f6a368 > r10: b9f6a374 r9 : 00000000 r8 : b8f1f11c > r7 : c0e03000 r6 : 00008000 r5 : b6981500 r4 : 00000000 > r3 : 00000065 r2 : 00000076 r1 : b8f1b847 r0 : 00000000 > Flags: nZCv IRQs off FIQs off Mode SVC_32 > Code: e08f0000 e1a0e00f ea01776e 00144492 (00146ddf)=20 > UEFI image [0xb8dd3000:0xb8f2632b] pc=3D0x4a4 '/efi\boot\bootarm.efi' > Resetting CPU ... >=20 Updating to recent enough to include: =E2=80=A2 git: 0d6600b579be - main - Set mm before passing it to = the UEFI firmware Andrew Turner=20 made the then-built loader.efi 's for aarch64 and armv7 work agin. The fixed problem appears to be a Undefined Behavior for which the llvm14 based toolchain handles differently. It looks like the Undefined Behavior goes back to: QUOTE author Rebecca Cran 2019-03-06 05:39:40 = +0000 committer Rebecca Cran 2019-03-06 = 05:39:40 +0000 commit ce37b71e6809fe5074be54230da9cf09543d3cdd (patch) tree 6dcce17c6e090289b79e78f72e3f2904d8ba171b = /stand/efi/loader/bootinfo.c parent 151c6d102035a05ff5c62b7df02bb7b3247dd0f7 (diff) download src-ce37b71e6809fe5074be54230da9cf09543d3cdd.tar.gz src-ce37b71e6809fe5074be54230da9cf09543d3cdd.zip Add retry loop around GetMemoryMap call to fix fragmentation bug The call to BS->AllocatePages can cause the memory map to become = framented, causing BS->GetMemoryMap to return EFI_BUFFER_TOO_SMALL more than once. = For example this can happen on the MinnowBoard Turbot, causing the boot to = stop with an error. Avoid this by calling GetMemoryMap in a loop. Reviewed by: imp, tsoome, kevans Differential Revision:=09 https://reviews.freebsd.org/D19341 Notes Notes: svn path=3D/head/; revision=3D344839 END QUOTE I do not know if MFCs will be done to avoid continuing to depend on various toolchain vintage's detailed handling of the Undefined Behavior --or not. =3D=3D=3D Mark Millard marklmi at yahoo.com