Skip to content

allow specifying custom cpu template inline in config json #5175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 6, 2025

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Apr 29, 2025

When starting firecracker without the API server and configuring it through a config files, specifying a custom cpu template requires writing this cpu template into a separate json file, and then passing the path to this separate json file in the config json file. This is a bit silly, since everything is just json. So additionally allow just directly specifying the custom cpu template inside the config file.

Changes

...

Reason

...

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

@roypat roypat added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Apr 29, 2025
Copy link

codecov bot commented Apr 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.93%. Comparing base (114c87f) to head (6a58dba).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5175      +/-   ##
==========================================
+ Coverage   82.87%   82.93%   +0.05%     
==========================================
  Files         250      250              
  Lines       26932    26936       +4     
==========================================
+ Hits        22321    22339      +18     
+ Misses       4611     4597      -14     
Flag Coverage Δ
5.10-c5n.metal 83.37% <100.00%> (+<0.01%) ⬆️
5.10-m5n.metal 83.36% <100.00%> (+<0.01%) ⬆️
5.10-m6a.metal 82.58% <100.00%> (-0.01%) ⬇️
5.10-m6g.metal 79.19% <100.00%> (+<0.01%) ⬆️
5.10-m6i.metal 83.35% <100.00%> (-0.01%) ⬇️
5.10-m7a.metal-48xl 82.58% <100.00%> (?)
5.10-m7g.metal 79.19% <100.00%> (+<0.01%) ⬆️
5.10-m7i.metal-24xl 83.32% <100.00%> (?)
5.10-m7i.metal-48xl 83.32% <100.00%> (?)
5.10-m8g.metal-24xl 79.19% <100.00%> (?)
5.10-m8g.metal-48xl 79.19% <100.00%> (?)
6.1-c5n.metal 83.42% <100.00%> (+<0.01%) ⬆️
6.1-m5n.metal 83.41% <100.00%> (-0.01%) ⬇️
6.1-m6a.metal 82.63% <100.00%> (+<0.01%) ⬆️
6.1-m6g.metal 79.19% <100.00%> (+<0.01%) ⬆️
6.1-m6i.metal 83.40% <100.00%> (+<0.01%) ⬆️
6.1-m7a.metal-48xl 82.62% <100.00%> (?)
6.1-m7g.metal 79.19% <100.00%> (-0.01%) ⬇️
6.1-m7i.metal-24xl 83.42% <100.00%> (?)
6.1-m7i.metal-48xl 83.43% <100.00%> (?)
6.1-m8g.metal-24xl 79.18% <100.00%> (?)
6.1-m8g.metal-48xl 79.19% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

zulinx86
zulinx86 previously approved these changes Apr 29, 2025
Copy link
Contributor

@zulinx86 zulinx86 left a comment

Choose a reason for hiding this comment

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

If I remember correctly, the reason why we made such a decision is that we anticipated users don't want to have the very long CPU template definition for each machine configuration (i.e. if users have 10 different machine configs with the same CPU template, when they want to change a single bit of the CPU template, they will have to change all the machine config JSON files). So the design is not so silly. I believe accepting both must be better though :D

When starting firecracker without the API server and configuring it
through a config files, specifying a custom cpu template requires
writing this cpu template into a separate json file, and then passing
the path to this separate json file in the config json file. This is a
bit silly, since everything is just json. So additionally allow just
directly specifying the custom cpu template inside the config file.

Signed-off-by: Patrick Roy <[email protected]>
@roypat roypat force-pushed the inline-custom-templates branch from a8b367c to b7647ba Compare May 2, 2025 13:09
@roypat roypat requested review from xmarcalx, pb8o and Manciukic as code owners May 2, 2025 13:09
@roypat roypat changed the title [RFC] allow specifying custom cpu template inline in config json allow specifying custom cpu template inline in config json May 2, 2025
@roypat
Copy link
Contributor Author

roypat commented May 2, 2025

If I remember correctly, the reason why we made such a decision is that we anticipated users don't want to have the very long CPU template definition for each machine configuration (i.e. if users have 10 different machine configs with the same CPU template, when they want to change a single bit of the CPU template, they will have to change all the machine config JSON files). So the design is not so silly. I believe accepting both must be better though :D

Ah, that's fair - my usecase was more than I had a single CPU template that only needed to modify a single cpuid leaf, and so it was easier to just have it straight in there. What you're saying makes sense though, I shouldn't have judged so soon 😔

@roypat roypat requested a review from kalyazin May 6, 2025 08:38
@roypat roypat enabled auto-merge (rebase) May 6, 2025 09:20
@roypat roypat merged commit 41fb776 into firecracker-microvm:main May 6, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting review Indicates that a pull request is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants