Skip to content

ttm: Automatically regenerate initramfs when TTM configuration changes#35

Merged
superm1 merged 1 commit intosuperm1:masterfrom
daissi:wip/initramfs
May 4, 2026
Merged

ttm: Automatically regenerate initramfs when TTM configuration changes#35
superm1 merged 1 commit intosuperm1:masterfrom
daissi:wip/initramfs

Conversation

@daissi
Copy link
Copy Markdown
Contributor

@daissi daissi commented Apr 27, 2026

When modifying TTM configuration via modprobe, the changes won't take effect until the next reboot. However, if the ttm module is loaded during early boot (e.g., in initramfs), the new configuration won't be applied unless the initramfs is regenerated.

This commit adds functionality to:

  1. Check if the ttm module is included in existing initramfs images
  2. Detect the system's initramfs generation tool (update-initramfs, dracut, or mkinitcpio)
  3. Automatically regenerate the initramfs if needed after modifying TTM configuration

This ensures that TTM configuration changes are properly applied during the next reboot, even when the module is loaded from initramfs.

Please note that this has only been tested on a Debian system.

Comment thread src/amd_debug/ttm.py
try:
# Run lsinitramfs and search for "ttm" in the output
result = subprocess.run(
["lsinitramfs", initramfs_path],
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know if this works with initramfs images built with dracut?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried it and it works.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay - besides it working is it present in systems that only use dracut? Like on Fedora for example

Comment thread src/amd_debug/ttm.py Outdated
Comment thread src/amd_debug/ttm.py Outdated
Copy link
Copy Markdown
Owner

@superm1 superm1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some unit tests that mock some behaviors of the tools?

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 41.17647% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.61%. Comparing base (720acec) to head (7cc69fa).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/amd_debug/ttm.py 41.17% 27 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #35      +/-   ##
==========================================
- Coverage   85.90%   85.61%   -0.30%     
==========================================
  Files          34       34              
  Lines        7693     7744      +51     
  Branches      724      731       +7     
==========================================
+ Hits         6609     6630      +21     
- Misses        871      898      +27     
- Partials      213      216       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread src/amd_debug/ttm.py Outdated
Comment thread src/amd_debug/ttm.py Outdated
Comment thread src/amd_debug/ttm.py Outdated
When modifying TTM configuration via modprobe, the changes won't
take effect until the next reboot. However, if the ttm module is
loaded during early boot (e.g., in initramfs), the new
configuration won't be applied unless the initramfs is regenerated.

This commit adds functionality to:
1. Check if the ttm module is included in existing initramfs images
2. Detect the system's initramfs generation tool (update-initramfs,
   dracut, or mkinitcpio)
3. Automatically regenerate the initramfs if needed after modifying
   TTM configuration

This ensures that TTM configuration changes are properly applied during
the next reboot, even when the module is loaded from initramfs.

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
@superm1 superm1 merged commit 74b3f01 into superm1:master May 4, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants