Skip to content

Cache VM stats - #859

Draft
ben-grande wants to merge 11 commits into
QubesOS:mainfrom
ben-grande:cache-stats
Draft

Cache VM stats#859
ben-grande wants to merge 11 commits into
QubesOS:mainfrom
ben-grande:cache-stats

Conversation

@ben-grande

Copy link
Copy Markdown
Contributor

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.

- 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.
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