Skip to content
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

vCPU Hot-unplug #4753

Draft
wants to merge 3 commits into
base: feature/vcpu-hotplug
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Aug 28, 2024

Changes

  • Implement the inverse operation of vCPU hot-plugging - vCPU hot-unplugging.
  • Changed the /hotplug endpoint, now the user requests a target number of vCPUs to be reached.

Unfinished

  • Currently only the guest portion has been completed, an API call can be made, and the vCPUs will be successfully removed from the guest
  • The host portion has not been completed. The backing threads need to be deleted after the guest has ejected the CPU. This requires a refactor of vCPU handles, to enable the CpuContainer the ability to terminate threads.

Reason

To provide the inverse of hot-plugging, so that VMs can be scaled in both directions.

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

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this
    PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet
    contribution quality standards.

  • This functionality cannot be added in rust-vmm.

Copy link

codecov bot commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.21%. Comparing base (a541725) to head (99858de).
Report is 1 commits behind head on feature/vcpu-hotplug.

Additional details and impacted files
@@                   Coverage Diff                    @@
##           feature/vcpu-hotplug    #4753      +/-   ##
========================================================
- Coverage                 81.95%   79.21%   -2.74%     
========================================================
  Files                       257      224      -33     
  Lines                     31762    26485    -5277     
========================================================
- Hits                      26031    20981    -5050     
+ Misses                     5731     5504     -227     
Flag Coverage Δ
5.10-c5n.metal ?
5.10-m5n.metal ?
5.10-m6a.metal ?
5.10-m6g.metal 79.21% <100.00%> (+<0.01%) ⬆️
5.10-m6i.metal ?
5.10-m7g.metal 79.21% <100.00%> (+<0.01%) ⬆️
6.1-c5n.metal ?
6.1-m5n.metal ?
6.1-m6a.metal ?
6.1-m6g.metal 79.21% <100.00%> (+<0.01%) ⬆️
6.1-m6i.metal ?
6.1-m7g.metal 79.21% <100.00%> (+<0.01%) ⬆️

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.

Change from `add` to `target`. The user now supplies the number of vCPUs
they would like to reach, rather than the number of vCPUs to add to the
system. Obviously to make this work, hot-unplug functionality is needed
as well.

Examples:
- Currently 1 vCPU, would like 16 vCPUs: target = 16
- Currently 32 vCPUs, would like 2 vCPUs: target = 2

Signed-off-by: James Curtis <[email protected]>
Guest side hot-unplug implementation. This means that the API call can
be made, and the vCPUs are successfully removed from the guest, but the
backing vCPU threads are not removed from the host VMM.

As a result of this, hot-plugs that occur after hot-unplugs do not work
correctly right now. Once the total thread count in the VMM exceeds 32,
there is no effect of hot-plugging. To complete this, a refactor is
needed of the VMM, such that the CpuContainer can somehow remove the
threads when the guest kernel calls _EJ0.

Signed-off-by: James Curtis <[email protected]>
Update metrics and swagger to reflect the changes made to the API.

Signed-off-by: James Curtis <[email protected]>
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.

1 participant