[FEATURE] Carry "ftrace: Drop weak function locations of modules when loading them" (amdgpu module load takes ~3 s)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c, linux
- Domain
- operating-systems, performance
Research direction
Read the upstream v2 patch linked in the issue and compare it with the kernel’s ftrace module loading code around ftrace_module_enable() and test_for_valid_rec(). The issue describes the quadratic lookup cost and provides benchmark results; check how the proposed change handles module symbols and preserves ftrace behavior. Done means carrying the fix and confirming module load performance improves without changing available_filter_functions or ftrace selftests.
Written by the indexing model from the issue text.
Description
Pre-flight checklist
- I have searched existing issues/PRs and this has not been requested before.
- I have read the Contributing Guidelines.
Request type
- New patch / patchset inclusion
Summary
Please consider carrying the pending upstream fix for the quadratic cost of ftrace_module_enable() when loading large modules.
Since b39181f7c690 ("ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak function"), ftrace_module_enable() calls test_for_valid_rec() for every ftrace record of the module being loaded, and for a module address kallsyms_lookup() scans the whole symbol table of that module. Loading a module therefore costs O(records x symbols), all under ftrace_lock. amdgpu is the worst case.
Motivation / use case
On linux-cachyos 7.3.1-1 (Ryzen 7 5800X3D, RX 9070 XT, amdgpu in the initramfs through the kms hook), udev asks for amdgpu at 0.59 s but amdgpu's init only starts at 3.85 s (initcall_debug + udev debug log): about 3.2 s are spent inserting the module, before any hardware init. amdgpu.ko here has 16,203 ftrace records and 77,543 symbols.
Because amdgpu is in the initramfs, switch-root waits for it, so the whole boot is about 3 s slower. For comparison, xfs.ko (5,335 records, 31,048 symbols) takes about 0.44 s to modprobe on the same machine. This affects every AMD GPU user with early KMS.
Patch / upstream reference
- v2 (2026-10-04, Lawrence Lin), patch 2/2: https://patchew.org/linux/[email protected]/[email protected]/ (Steven Rostedt: in patchwork, delegated to him, queued)
- v1: https://lore.kernel.org/all/[email protected]/
- Already carried by Omarchy: https://github.com/omacom/omarchy-pkgs/pull/780 (0160-ftrace-module-enable-bsearch.patch)
Testing / benchmarks
- Patch author (Ryzen 3 3200U, v7.2.5): amdgpu init done at 6.19 s -> 2.00 s; kernel part of systemd-analyze 6.65 s -> 2.46 s; nouveau load 457 ms -> 118 ms.
- Reviewer on the list (Ryzen 9 5900X + RX 6900 XT, 7.2.15): userspace 4.5 s -> 2.4 s.
- Omarchy (7.3-rc5): "amdgpu initializing" 6.20 s -> 1.82 s; available_filter_functions byte-identical; ftrace and livepatch selftests unchanged.
- Here, without the patch: see Motivation.
Additional context
4099b98203d6 ("ftrace: Fix softlockup in ftrace_module_enable") only added cond_resched() to the loop; the quadratic cost is still there.
- Dominant language
- Shell
- Stars
- 4.9k
- Forks
- 190
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CachyOS/linux-cachyos
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
CachyOS/linux-cachyos#1196 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CachyOS/linux-cachyos#1091 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
CachyOS/linux-cachyos#961 · 1 comment ·
-
[FEATURE] Pre-signed hwmon / fan control modules (nct6687d, it87) for linux-cachyos-eacPossibly taken @ventureoo claimed this 1 day ago. Openenhancement
CachyOS/linux-cachyos#1206 · 3 assignees ·
-
[Feature Request] Add prebuilt signed linux-cachyos-eac-tuxedo-drivers modulePossibly taken @ventureoo claimed this 1 day ago. Openenhancement
CachyOS/linux-cachyos#1205 · 3 assignees ·
All issues in CachyOS/linux-cachyos
Similar issues
-
documentation enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/aws-networking-best-practices#256 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
openai-directory
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
smores56/homelab-platform#289 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omacom/omarchy#21787 · 3 comments ·
Maintainers usually reply within 1 day