Add arm64(AArch64) support - #429
Open
dzianisbely wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add arm64 (AArch64) support
Summary
Adds arm64(armv8) support for the modern (5.9+) ftrace-based build. dattobd's x86-dependence turned out to be narrow. Changes isolated behind arch/capability conditionals, and leaves the x86 path untouched.
Supported kernels
arm64(AArch64): kernel 5.10+
ftrace_regs_set_instruction_pointer()exists only from 6.2 (renamed fromftrace_instruction_pointer_set; 6.2 is also where arm64 switched ftrace toWITH_ARGS). Hardcoding it would fail to build on ≤ 6.1 (implicit declaration). Detecting it and falling back to the WITH_REGS->pcpath lowers the arm64 floor to ~5.10.Runtime-verified: 5.10 (Debian 11), 5.15 (Ubuntu 22.04), 6.8 (emulated), 6.17 (real HW). 5.9 is plausible (submit_bio path is 5.9+,
ftrace_regsis 5.11+) but not tested.P.S For building on 6.17+ kernels, I used ccflags-y := -g -Werror -I$(src)/../.. in /src/configure-tests/feature-tests/Makefile
Does not attempt legacy make_request_fn / syscall-table / armv7.
What changed and why
#ifdef CONFIG_X86. no-op stubs otherwise. Closes X86 specific code failes building on ARM #248 (arm64 build break).dattobd_ftrace_set_ip()macro (the 3 cases above), gated on theHAVE_FTRACE_REGS_SET_INSTRUCTION_POINTERfeature-test plus arch — not on the arch alone.FTRACE_OPS_FL_SAVE_REGSrequested only whenCONFIG_DYNAMIC_FTRACE_WITH_REGSis present (x86 and arm64 ≤ 6.1 have it. arm64 6.2+ has only WITH_ARGS, where requesting SAVE_REGS makesregister_ftrace_function()fail) — gated on the capability, not arch.configure-tests/feature-tests/ftrace_regs_set_instruction_pointer.c.FENTRY_CALL_INSTR_BYTESvalue added. Its only fordattobd_submit_bio_realhas no callers (dead code), so the value only needs to compile.REQ_OP_WRITE_ZEROESbio has no data pages. Tracer special-cases this, but the guard used the wrong macro, so on kernels ≥ 6.0 it compiled out. The page-less bio hit the per-segment loop,called page_get_inode()on a NULL page, and crashed kernel.Fix: key the guards off
HAVE_ENUM_REQ_OP_WRITE_ZEROES, which checks the actual constant used and is true on 4.10+ for any arch. No change on < 6.0.Note: not arm64-specific, affects every 6.x kernel on all arches, including x86_64. Found on the arm64 port (ext4 lazyinit), reproduced on x86_64/7.0 with
scsi_debug.Evidence
Environments:
Build: clean, 0 source warnings, vermagic aarch64 on 5.10 / 5.15 / 6.8 / 6.17.
build-arm64-5-10-4k.txt
build-arm64-5-15-4k.txt
build-arm64-6-17-4k.txt
build-arm64-6-8-64k.txt.txt
Full
tests/suite: 6.17 24 OK; 5.15 24 OK; 5.10 23 OKfull-tests-arm64-5-10-4k.txt
full-tests-arm64-5-15-4k.txt
full-tests-arm64-6-17-4k.txt
full-tests-arm64-6-8-64k.txt
Runtime hooks:
insmodOK,path_mount/path_umountftrace hooks register, and a real mount fireshandle_bdev_mount_event- i.e., the->pcIPMODIFY redirect works.runtime-hooks-arm64-5-10-4k.txt
runtime-hooks-arm64-5-15-4k.txt
runtime-hooks-arm64-6-17-4k.txt
runtime-hooks-arm64-6-8-64k.txt
Explicit snapshot demo: a file created before the snapshot, then deleted from the origin, is still present in
/dev/datto0(content + 8 MB sha256 match) - COW correct.snapshot-demo-arm64-5-10-4k.txt
snapshot-demo-arm64-5-15-4k.txt
snapshot-demo-arm64-6-17-4k.txt
snapshot-demo-arm64-6-8-64k.txt
Real aarch64 HW (6.17, 6.8):
setup-snapshotof the live root →/dev/datto0(state 3). Full snapshot → image pull → restore-onto-live-root → clean reboot verified.