Cache VM stats - #859
Draft
ben-grande wants to merge 11 commits into
Draft
Conversation
- Only meminfo reports the correct memory used for each balanced domain - Including overhead can be used to calculate how much memory is reserved for all qubes - Excluding overhead, just memory available in the qube on memory-balanced qubes, indicates memory that it can possibly get. For: QubesOS/qubes-issues#8368
Although both values can be lied by the qube, we can distinguish the "memory types" in client tools. For: QubesOS/qubes-linux-utils#140
It's not completely Xen agnostic because then it would not be possible to query stubdomains, as libvirt is not aware of them. On the other hand, non-Xen has one more API methods working. When not using Xen, construct the dictionary as "xc.domain_getinfo()" would, so the info loop can consume from both inputs. Stubdomains are returned as separate keys instead of aggregated to allow clients to distinguish if it's HVM using the resources or it's stubdomain. This is specially relevant for HVMs that have memory balancing enabled.
Changing maxmem property of a running domain allows qmemman to read new information and balance appropriately. For the maxmem property to accurately reflect current state for clients to query, it is forbidden to change it for a running non memory balanced domain.
Add "maxmem" property to "Qubes" (app) and "AdminVM", so clients can now
system/host memory and dom0 memory.
Fix "get_mem" and "get_mem_static_max" mess:
- AdminVM:
- "get_mem": supposedly, should report usage in KiB, but it's reading
/proc/meminfo and returning kB
- "get_mem_static_max": returning total host memory
- QubesVM:
- "get_mem": supposedly, should report usage, but it's
reporting initial memory
- "get_mem_static_max": same as above
Now all of these methods returns memory in KiB. "get_mem" returns
allocated/assigned memory, while "get_mem_static_max" returns maxmem in
KiB.
Breaking change. No known Qubes OS code uses. A better value is "cpu_usage".
Xenstore keys are created immediately after domain is crated and before tasks can be switched with "await", to guarantee that qubesd methods (same thread) don't fail attempts to read xenstore keys. This is the case for "Qubes.get_vm_stats", which interacts with VMM methods instead of qubes events.
Clients that subscribe will each query extraneously query the statistics (spending time) and get different results for time based data such as CPU usage (elapsed time). This patch aims to fix those problems, but current the sleep between queries is only considered on the API.
This file contains hidden or 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
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.
Opened this PR so I don't forget it. Made on top of (will rebase once that PR is merged):
Draft as not finished, see TODO.