* [PATCH 0/1] Fix energy calcultation in RAPL MSR
@ 2024-08-07 12:43 Anthony Harivel
2024-08-07 12:43 ` [PATCH 1/1] target/i386: Fix arguments for vmsr_read_thread_stat() Anthony Harivel
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Harivel @ 2024-08-07 12:43 UTC (permalink / raw)
To: pbonzini; +Cc: qemu-devel, Anthony Harivel
Hi Paolo,
The value reported by the calculation was looking very wrong to me.
This should fix it for good.
Calculated value appears now way more accurate from what is expected
from the feature:
with "-smp 4":
[...]
# modprobe intel_rapl_msr.ko
intel_rapl_common: Found RAPL domain package
intel_rapl_common: found 1 domains on package-0
intel_rapl_common: Core CPU package-0:package energy=61035pJ, time=976us, power=125000uW
intel_rapl_common: update package-0 domain package data
#
#
#
# cat /sys/class/powercap/intel-rapl:0/energy_uj
303160
# cat /sys/class/powercap/intel-rapl:0/energy_uj
325621
# cat /sys/class/powercap/intel-rapl:0/energy_uj
325621
# cat /sys/class/powercap/intel-rapl:0/energy_uj
357237
# cat /sys/class/powercap/intel-rapl:0/energy_uj
357237
# cat /sys/class/powercap/intel-rapl:0/energy_uj
388792
[...]
Tested with several SMP architecture.
(i.e -smp 4 / -smp 8,sockets=2,dies=1 / -smp 8,sockets=4,dies=2 )
Anthony Harivel (1):
target/i386: Fix arguments for vmsr_read_thread_stat()
target/i386/kvm/kvm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] target/i386: Fix arguments for vmsr_read_thread_stat()
2024-08-07 12:43 [PATCH 0/1] Fix energy calcultation in RAPL MSR Anthony Harivel
@ 2024-08-07 12:43 ` Anthony Harivel
2024-08-09 10:10 ` Zhao Liu
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Harivel @ 2024-08-07 12:43 UTC (permalink / raw)
To: pbonzini; +Cc: qemu-devel, Anthony Harivel
Snapshot of the stat utime and stime for each thread, taken before and
after the pause, must be stored in separate locations
Signed-off-by: Anthony Harivel <aharivel@redhat.com>
---
target/i386/kvm/kvm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 31f149c9902c..2fa88ef1e373 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2712,8 +2712,8 @@ static void *kvm_msr_energy_thread(void *data)
thd_stat[i].thread_id = thread_ids[i];
vmsr_read_thread_stat(vmsr->pid,
thd_stat[i].thread_id,
- thd_stat[i].utime,
- thd_stat[i].stime,
+ &thd_stat[i].utime[0],
+ &thd_stat[i].stime[0],
&thd_stat[i].cpu_id);
thd_stat[i].pkg_id =
vmsr_get_physical_package_id(thd_stat[i].cpu_id);
@@ -2777,8 +2777,8 @@ static void *kvm_msr_energy_thread(void *data)
for (int i = 0; i < num_threads; i++) {
vmsr_read_thread_stat(vmsr->pid,
thd_stat[i].thread_id,
- thd_stat[i].utime,
- thd_stat[i].stime,
+ &thd_stat[i].utime[1],
+ &thd_stat[i].stime[1],
&thd_stat[i].cpu_id);
if (vmsr->pid < 0) {
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] target/i386: Fix arguments for vmsr_read_thread_stat()
2024-08-07 12:43 ` [PATCH 1/1] target/i386: Fix arguments for vmsr_read_thread_stat() Anthony Harivel
@ 2024-08-09 10:10 ` Zhao Liu
0 siblings, 0 replies; 3+ messages in thread
From: Zhao Liu @ 2024-08-09 10:10 UTC (permalink / raw)
To: Anthony Harivel; +Cc: pbonzini, qemu-devel
On Wed, Aug 07, 2024 at 02:43:20PM +0200, Anthony Harivel wrote:
> Date: Wed, 7 Aug 2024 14:43:20 +0200
> From: Anthony Harivel <aharivel@redhat.com>
> Subject: [PATCH 1/1] target/i386: Fix arguments for vmsr_read_thread_stat()
>
> Snapshot of the stat utime and stime for each thread, taken before and
> after the pause, must be stored in separate locations
>
> Signed-off-by: Anthony Harivel <aharivel@redhat.com>
> ---
> target/i386/kvm/kvm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-09 9:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 12:43 [PATCH 0/1] Fix energy calcultation in RAPL MSR Anthony Harivel
2024-08-07 12:43 ` [PATCH 1/1] target/i386: Fix arguments for vmsr_read_thread_stat() Anthony Harivel
2024-08-09 10:10 ` Zhao Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).