On Mon, Jun 15, 2026 at 11:01:21AM +0200, Claudio Fontana wrote:
Hello Peter,
On 6/15/26 10:47, Peter Krempa wrote:
On Mon, Jun 15, 2026 at 10:34:54 +0200, Claudio Fontana wrote:
Fix VIR_NODE_CPU_STATS_GUEST to also account for guest nice time, similarly to how VIR_NODE_CPU_STATS_USER also accounts for nice time.
Can you elaborate a bit what the problem is ... ideally in the commit message.
Well it is there, the problem is that as I introduced this last year I did not account for guest nice time.
Hopefully we can still fix it as maybe no-one is relying on this yet..
VIR_NODE_CPU_STATS_GUEST was introduced in: b5878727c714 ("util: virHostCPUGetStatsLinux: support VIR_NODE_CPU_STATS_GUEST")
Extend the tests artificially to capture this specific case.
The trap was that the system on which the tests were likely generated did not include any guest_nice time, so tests seemed to pass. But now as I revisited the issue I noticed the missing guest_nice.
Fixes: b5878727c714d813c820ad4a1b695fbbb5ffc84e
v11.7.0-2-gb5878727c7
Signed-off-by: Claudio Fontana <cfontana@suse.de> --- src/util/virhostcpu.c | 2 +- tests/virhostcpudata/linux-cpustat-24cpu.out | 8 ++++---- tests/virhostcpudata/linux-cpustat-24cpu.stat | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 1db096ba24..f2b25e940b 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -882,7 +882,7 @@ virHostCPUGetStatsLinux(FILE *procstat, return -1;
if (virHostCPUStatsAssign(¶ms[4], VIR_NODE_CPU_STATS_GUEST, - guest * TICK_TO_NSEC) < 0) + (guest + guest_nice) * TICK_TO_NSEC) < 0) return -1; return 0; }
Shouldn't we rather introduce a new field rather than modify what the old one does?
I hope it's early enough that not many users are relying on VIR_NODE_CPU_STATS_GUEST , and accounting it together would be in line with what is done for the other stats.
Yes, this feels like simply a bug fix to me, rather than an entirely new category of data to report. With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|