-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add more states for each node #1
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Simon LUCIDO <[email protected]>
Signed-off-by: Simon LUCIDO <[email protected]>
Signed-off-by: Simon LUCIDO <[email protected]>
/// RAM | ||
Ram, | ||
/// MMIO | ||
Mmio, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RAM or MMIO should not be states but types. You can have Free
+ Ram
or Allocated
+ Mmio
for a node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree: a memory range marked as Ram
is not free: it is allocated to be used as RAM, hence it is not free to use for anything else. Same thing goes for Mmio
. Free
means 'this memory range is not mapped to anything'.
ReservedUnallocated
means This shall not be mapped to anything, like the upper 20MB of the 32bits address range for example.
The goal of these changes was to be able to specify the usage intended for allocated memory ranges. Instead of having only Allocated
, you now have to specify what it is allocated for. This allows us to have different behaviors when actually registering memory with KVM. Memory ranges in the Ram
state should be registered with KVM and added to E820, while Mmio
and ReservedUnallocated
should not, for example.
@@ -44,8 +44,14 @@ pub fn align_up(address: u64, alignment: u64) -> Result<u64> { | |||
pub enum NodeState { | |||
/// Node is free. | |||
Free, | |||
/// Node is allocated. | |||
Allocated, | |||
/// Reserved, and should be allocated (x86's real mode for example). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does Reserved
mean here? How is it different from Allocated
?
Also, do you mean can be allocated
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reserved is close to meaning to allocated, it is more or less a catch-all for all use cases that are not RAM neither MMIO.
I mean KVM should know about this memory region
.
Hi !
This PR adds a more granular way to configure node in our allocator state. Instead of having a binary view (Free or Allocated), we know have more state, such as Ram, mmio or ReservedAllocated.
This allows us to use a single allocator to handle all of our memory mapping, hence making sure we don't have conflicts in our memory regions.
I've also added a way to retrieve all the current nodes in our allocator.