From nobody Wed Jun 24 21:41:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=suse.de Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1781512936520448.02625742084444; Mon, 15 Jun 2026 01:42:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 36D7E41AF9; Mon, 15 Jun 2026 04:42:15 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id EA6D341CAE; Mon, 15 Jun 2026 04:41:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A680341997; Mon, 15 Jun 2026 04:41:08 -0400 (EDT) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 43F0441ABA for ; Mon, 15 Jun 2026 04:41:07 -0400 (EDT) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D357B75813; Mon, 15 Jun 2026 08:35:02 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 44E39779A7; Mon, 15 Jun 2026 08:35:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iUsBDja5L2o5CAAAD6G6ig (envelope-from ); Mon, 15 Jun 2026 08:35:02 +0000 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 X-Greylist: delayed 362 seconds by postgrey-1.37 at lists.libvirt.org; Mon, 15 Jun 2026 04:41:07 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781512503; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5elLCEky41Q6BjDwWwM+OoLICCRyHDnt8KoZwame1tQ=; b=eT/7D5Tz0yGJpFJnmMaw2mxhH34sTN6DTMTbn4HFcIc3BY0EfT1m9vaOX+z/dJqKOVClHU tCXahR71pzWCAZRMqaQC0Y2NflqnN8PFAtB2RIJMbwIMZts5ixKoNynRcG5Kqc177n19JB E3HCZrxEeT0/CZK8FL+wW6wfk15+3EQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781512503; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5elLCEky41Q6BjDwWwM+OoLICCRyHDnt8KoZwame1tQ=; b=zuCzBX7ofW8HCbdwU11vWVbwJ0bRbQggzgzjNuTiKm9zqSyAfeshYI50J6WytFTQBd4Qea IImnxqmWk1a3gXCg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=XsQ0N6hJ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ApjTbaVT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781512502; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5elLCEky41Q6BjDwWwM+OoLICCRyHDnt8KoZwame1tQ=; b=XsQ0N6hJGC0JEZleRwyWAyaQnXd4gr8HVcIZPxi+42k7tgkfqUm1CPoB573qgCcCn4NBnV zT1XuSg1WFhGdfwcfUo8D/G6VQTxf7F9iWmAkNQyaNbN5IIwlr5o+KtvnBibVBwUuR+4LF jRUi4/3tg+FHeCc68/UzjKhJHaavuLE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781512502; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5elLCEky41Q6BjDwWwM+OoLICCRyHDnt8KoZwame1tQ=; b=ApjTbaVTcC4+CrteBPBfo8j+AQFSVYMxUBLuPhzswPmXqwHekY9ifHe1GYsvj0XjrGn8ZC x2YY36o45/LSLJDA== From: Claudio Fontana To: devel@lists.libvirt.org Subject: [PATCH] util: virHostCPUGetStatsLinux: add guest_nice to VIR_NODE_CPU_STATS_GUEST Date: Mon, 15 Jun 2026 10:34:54 +0200 Message-Id: <20260615083454.5087-1-cfontana@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.00 / 50.00]; BAYES_HAM(-2.99)[99.96%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_TRACE(0.00)[suse.de:+]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_THREE(0.00)[3]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: D357B75813 Message-ID-Hash: VC47T7IAGLXANUQY4O5GWJJY3OYUGE43 X-Message-ID-Hash: VC47T7IAGLXANUQY4O5GWJJY3OYUGE43 X-MailFrom: cfontana@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Claudio Fontana X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (found 4 invalid signatures) X-ZM-MESSAGEID: 1781512940422158500 Content-Type: text/plain; charset="utf-8" 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. 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. Fixes: b5878727c714d813c820ad4a1b695fbbb5ffc84e Signed-off-by: Claudio Fontana --- 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; =20 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; } diff --git a/tests/virhostcpudata/linux-cpustat-24cpu.out b/tests/virhostcp= udata/linux-cpustat-24cpu.out index f3183f5c41..a975702a06 100644 --- a/tests/virhostcpudata/linux-cpustat-24cpu.out +++ b/tests/virhostcpudata/linux-cpustat-24cpu.out @@ -1,16 +1,16 @@ cpu: kernel: 8751170 user: 14128079 -idle: 1816344522 +idle: 1816344521 iowait: 81323 -guest: 5880634 +guest: 5880635 =20 cpu0: kernel: 447603 user: 749021 -idle: 75399242 +idle: 75399241 iowait: 5295 -guest: 331814 +guest: 331815 =20 cpu1: kernel: 167215 diff --git a/tests/virhostcpudata/linux-cpustat-24cpu.stat b/tests/virhostc= pudata/linux-cpustat-24cpu.stat index bc9d449e1c..e13035b5f0 100644 --- a/tests/virhostcpudata/linux-cpustat-24cpu.stat +++ b/tests/virhostcpudata/linux-cpustat-24cpu.stat @@ -1,5 +1,5 @@ -cpu 14126233 1846 7764352 1816344522 81323 395581 591237 0 5880634 0 -cpu0 748997 24 320851 75399242 5295 22050 104702 0 331814 0 +cpu 14126233 1846 7764352 1816344521 81323 395581 591237 0 5880634 1 +cpu0 748997 24 320851 75399241 5295 22050 104702 0 331814 1 cpu1 337325 1 140909 76178612 1121 8962 17344 0 166726 0 cpu2 666860 29 269302 75649696 4298 18473 21155 0 272094 0 cpu3 328387 77 211400 76131634 1219 9701 6573 0 115551 0 --=20 2.35.3