Re: Another VFP-in-kernel problem on armv8

From: Mark Millard <marklmi_at_yahoo.com>
Date: Fri, 07 Apr 2023 20:11:00 UTC
On Apr 7, 2023, at 06:06, John F Carr <jfc@mit.edu> wrote:

> I upgraded from mid-February CURRENT (5dc00f00b747) to yesterday (f02879f19925) and my system panics during boot with
> 
>  panic: VFP exception in the kernel
> 
> Most likely this panic is while trying to import the root ZFS pool.  The crash is at the first vector instruction in zfs_sha256_block_neon (in zfs.ko):
> 
>   f9284: 4cdf7020      ld1     { v0.16b }, [x1], #16
> 
> This instruction is implemented on my CPU (Cortex A-57), confirmed by running it in user mode.
> 
> I don't see any obviously related changes in ZFS since the last working kernel.  What's going on recently with VFP in the kernel?


I've a simpler reproducer context based on just official
materials:

Downloaded and dd'd an 2023-Apr-06 snapshot image and
powered up a small aarch64 board with it:

. . .
FreeBSD 14.0-CURRENT #0 main-n262010-f21faa67ab6b: Thu Apr  6 11:49:31 UTC 2023
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
FreeBSD clang version 15.0.7 (https://github.com/llvm/llvm-project.git llvmorg-15.0.7-0-g8dfdcc7b7bf6)
 . . .


So: A just-UFS boot context. Then login and try "zpool import"
without having any zfs media present, just the UFS boot media:

Login: root
Password:
Apr  6 13:00:28 generic login[1443]: ROOT LOGIN (root) ON ttyu0
FreeBSD 14.0-CURRENT #0 main-n262010-f21faa67ab6b: Thu Apr  6 11:49:31 UTC 2023     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List:        https://www.FreeBSD.org/lists/questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

To change this login announcement, see motd(5).
root@generic:~ # zpool import
  x0: ffff0000f0fa9168 (ucom_cons_softc + efbf1bb8)
  x1: ffff0000ff900000 ($d.1 + afa318)
  x2: ffff0000ff900400 ($d.1 + afa718)
  x3: ffff0000fec1b0a4 (sha_incremental + 0)
  x4:                0
  x5:           100000
  x6:         8e16db93
  x7:                0
  x8: ffff0000feb06168 (tf_sha256_neon + 0)
  x9: ffff0000fea931fb ($d.1 + b)
 x10: ffff0000feb045f4 (SHA2Update + f4)
 x11:               29
 x12:                1
 x13:                0
 x14:                0
 x15:                2
 x16: ffff0000feaf7500 ($d.0 + 0)
 x17: ffff000000476cf0 (nanouptime + 0)
 x18: ffff0000f0fa9000 (ucom_cons_softc + efbf1a50)
 x19: ffff0000f0fa9168 (ucom_cons_softc + efbf1bb8)
 x20:              400
 x21: ffff0000ff900000 ($d.1 + afa318)
 x22: ffff0000f0fa9198 (ucom_cons_softc + efbf1be8)
 x23:                0
 x24:                0
 x25:                0
 x26: ffff0000fed2df70 (sha256_neon_impl + 0)
 x27:              203
 x28:               31
 x29: ffff0000f0fa9040 (ucom_cons_softc + efbf1a90)
  sp: ffff0000f0fa9000
  lr: ffff0000feb04668 (SHA2Update + 168)
 elr: ffff0000feaf8684 (zfs_sha256_block_neon + 14)
spsr:         20000045
 esr: 000000001fe00000
panic: VFP exception in the kernel
cpuid = 3
time = 1680786034
KDB: stack backtrace:
db_trace_self() at db_trace_self
db_trace_self_wrapper() at db_trace_self_wrapper+0x30
vpanic() at vpanic+0x13c
panic() at panic+0x44
do_el1h_sync() at do_el1h_sync+0x210
handle_el1h_sync() at handle_el1h_sync+0x10
--- exception, esr 0xffff0000f0fa9198
(null)() at 0x400
KDB: enter: panic
[ thread pid 1446 tid 100101 ]
Stopped at      kdb_enter+0x44: undefined       f905c27f
db> 

===
Mark Millard
marklmi at yahoo.com