-
Notifications
You must be signed in to change notification settings - Fork 35
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
init: dynamically determine necessary size for ALLOCMAN_VIRTUAL_SIZE #115
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2023, DornerWorks | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#include <camkes.h> | ||
|
||
/* For every 500000000 bytes added to ALLOCMAN_VIRTUAL_SIZE, | ||
* the guest can map an additional 6960 MiBs. Dividing the two | ||
* values gives a scale of 71839, which we round up to 72000 | ||
*/ | ||
|
||
/*- set guest_ram_mb = configuration[me.name].get('guest_ram_mb', 4096) -*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it might be better to just have a function that returns the config value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't that the point of the templates though? Also, what do you mean by "which allocator is used"? This was inspired by the ARM version, which does something similar in pulling the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But there we have a config setting dedicated to the allocator pool. Maybe having this is not really a good idea at all, because this seems like an internal details one does not really care. All a user realy wants is set the VM's amount of memory, and leave the rest to some internal automation actually? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for x86 only, and not ARM. ARM and x86 use different methods. ARM:
x86:
I don't know the difference why the methods are different. But x86 doesn't use the VMParameters template at all. |
||
/*- set allocman_virtual_size = guest_ram_mb * 72000 -*/ | ||
|
||
size_t allocman_virtual_size(void) | ||
{ | ||
return /*? allocman_virtual_size ?*/; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright 2023, DornerWorks | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
size_t allocman_virtual_size(void); |
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 think with the current parameters we should have this here. And we can't refer to
ALLOCMAN_VIRTUAL_SIZE
any longer because this got removed, so I adjusted the comment.My point is, that the template does not really know what we do here and it should not have to (at least for now). Your current improvement goal seem to be making things more dynamic, but we should separate this from aiming towards a config option about the allocator pool (like we have on ARM). So I consider it more simple for now if we just provide a
get_guest_ram_mb()
. As a follow-up we could consider aligning the x86 and ARM a bit more thenThere 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.
Its not trying to make things more dynamic really, its just trying to allow for large RAM allocation, replacing a predefined macro with a value calculated based on the VMs needs. ARM doesn't define the amount of RAM in the configuration, x86 does, and its used in other places throughout the VMM.