-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[DRAFT] Prerequisite for proper device manager. #4509
Draft
ShadowCurse
wants to merge
12
commits into
firecracker-microvm:main
Choose a base branch
from
ShadowCurse:device_manager
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
Add single entity to controll all devices in the vmm. There are currently 2 types of devices in Firecraker: mmio and pio devices. Each type is managed by it's own device manager. This works fine in current setup. But with prospect of adding ACPI there will be 3 types of devices and all interactions with them will become more entangled than they are right now. To prevent this from happening single device manager will controll all devices and have all device specific logic inside of it. Signed-off-by: Egor Lazarchuk <[email protected]>
Now registration of KVM resources is not attached to the mmio_device_manager and can be performed outside of it. Signed-off-by: Egor Lazarchuk <[email protected]>
Update of cmd line with virtio devices does not need to access to the mmio_device_manager and can be done outside of it. Signed-off-by: Egor Lazarchuk <[email protected]>
MMIODeviceManager was aware of different types of devices like Rtc or BootTimer. Because of this MMIODeviceManager had specialized methods to deal with such devices. This commit tries to generalize addition of such devices, so MMIODeviceManager will not differentiate between them. Signed-off-by: Egor Lazarchuk <[email protected]>
SerialDevice is always used with stdin as an input source. Setting generic parameter of SerialDevice to always be Stdin removes duplication of it's definitions all over codebase. Also it allows to make a simple `new` method to create SerialDevice instead of specifying each field separately. Signed-off-by: Egor Lazarchuk <[email protected]>
MMIODeviceInfo now handles registration of irqfd. This registration can happen outside of MMIODeviceManager in the future. Signed-off-by: Egor Lazarchuk <[email protected]>
Rename allocate_mmio_resources into allocate_device_info to better specify the method output. Signed-off-by: Egor Lazarchuk <[email protected]>
Remove special method for serial device from MMIODeviceManager. Now MMIODeviceManager does not have any device specific methods. Signed-off-by: Egor Lazarchuk <[email protected]>
setup_serial_device was only used for x86_64 PortIODeviceManager creation. Moving creation of serial device near creation of PortIODeviceManager removes a need to jump through the code to see how serial device is created. Signed-off-by: Egor Lazarchuk <[email protected]>
MMIODeviceManager's implementation was spread across 2 modules: mmio.rs and persist.rs. By moving all implementation into mmio module we wil have an easir time when it comes to add more device managers (e.g. ACPI device_manager). Signed-off-by: Egor Lazarchuk <[email protected]>
Before the inner `MMIODeviceManager` was responsible for state of devices. With this commit it will be easier to save states of other device types (e.g. ACPI devices). Signed-off-by: Egor Lazarchuk <[email protected]>
New `add_device_with_info` method plays a bit better with other new `add_*` methods. Signed-off-by: Egor Lazarchuk <[email protected]>
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.
Reason
Currently Firecracker does not have a single
DeviceManger
but instead hasMMIODeviceManager
andPortIODeviceManager
(only for x86). This design works for now, but with an addition of ACPI devices in #4428 and #4487 it starts to show limitations. The biggest problem is a resource allocation sharing for interrupts and memory ranges.In order to fix this, this PR clears current device management (mainly MMIO) code in attempt to move all unnecessary code out of it. This will allow creation of a proper
DeviceManger
which will have all resource allocators (irqs, memory ranges) and will handle their allocation for MMIO and ACPI devices.This PR does not achieve this goal yet. Next steps would be to move all
attach_*_device
methods frombuilder.rs
intoDeviceManager
.Main idea can be visualized like this:
As an additional point, with single
DeviceManager
the storing of devices information in a snapshot will become more manageable, as we will need to store only 1 struct, instead of several.Changes
TBD
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
PR.
CHANGELOG.md
.TODO
s link to an issue.contribution quality standards.
rust-vmm
.