qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix RAPL MSR support in staging
@ 2024-07-26 10:26 Anthony Harivel
  2024-07-26 10:26 ` [PATCH 1/2] target/i386: Fix typo that assign same value twice Anthony Harivel
  2024-07-26 10:26 ` [PATCH 2/2] target/i386: Clean output of vmsr_read_thread_stat() Anthony Harivel
  0 siblings, 2 replies; 3+ messages in thread
From: Anthony Harivel @ 2024-07-26 10:26 UTC (permalink / raw)
  To: pbonzini; +Cc: qemu-devel, Anthony Harivel

Hi Paolo,

RAPL MSR has landed in staging with few scratches.

Here a couple of patches to solves CID 1558553 and 1558557.

Anthony

Anthony Harivel (2):
  target/i386: Fix typo that assign same value twice
  target/i386: Clean output of vmsr_read_thread_stat()

 target/i386/kvm/kvm.c         | 4 ++--
 target/i386/kvm/vmsr_energy.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

-- 
2.45.2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] target/i386: Fix typo that assign same value twice
  2024-07-26 10:26 [PATCH 0/2] Fix RAPL MSR support in staging Anthony Harivel
@ 2024-07-26 10:26 ` Anthony Harivel
  2024-07-26 10:26 ` [PATCH 2/2] target/i386: Clean output of vmsr_read_thread_stat() Anthony Harivel
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Harivel @ 2024-07-26 10:26 UTC (permalink / raw)
  To: pbonzini; +Cc: qemu-devel, Anthony Harivel

Should fix: CID 1558553

Signed-off-by: Anthony Harivel <aharivel@redhat.com>
---
 target/i386/kvm/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index b4aab9a410b5..31f149c9902c 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2694,8 +2694,8 @@ static void *kvm_msr_energy_thread(void *data)
 
     while (true) {
         /* Get all qemu threads id */
-        g_autofree pid_t *thread_ids =
-            thread_ids = vmsr_get_thread_ids(vmsr->pid, &num_threads);
+        g_autofree pid_t *thread_ids
+            = vmsr_get_thread_ids(vmsr->pid, &num_threads);
 
         if (thread_ids == NULL) {
             goto clean;
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] target/i386: Clean output of vmsr_read_thread_stat()
  2024-07-26 10:26 [PATCH 0/2] Fix RAPL MSR support in staging Anthony Harivel
  2024-07-26 10:26 ` [PATCH 1/2] target/i386: Fix typo that assign same value twice Anthony Harivel
@ 2024-07-26 10:26 ` Anthony Harivel
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Harivel @ 2024-07-26 10:26 UTC (permalink / raw)
  To: pbonzini; +Cc: qemu-devel, Anthony Harivel

Fix leaking memory of file handle in case of error
Erase unused "pid = -1"
Add clearer error_report

Should fix: CID 1558557

Signed-off-by: Anthony Harivel <aharivel@redhat.com>
---
 target/i386/kvm/vmsr_energy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/i386/kvm/vmsr_energy.c b/target/i386/kvm/vmsr_energy.c
index a1d78f2f2aee..7e064c5aef30 100644
--- a/target/i386/kvm/vmsr_energy.c
+++ b/target/i386/kvm/vmsr_energy.c
@@ -270,7 +270,7 @@ void vmsr_read_thread_stat(pid_t pid,
 
     FILE *file = fopen(path, "r");
     if (file == NULL) {
-        pid = -1;
+        error_report("Error opening %s", path_name);
         return;
     }
 
@@ -279,7 +279,8 @@ void vmsr_read_thread_stat(pid_t pid,
         " %*u %*u %*u %*u %*u %*u %*u %*u %*u %*d %*u %*u %u",
            utime, stime, cpu_id) != 3)
     {
-        pid = -1;
+        fclose(file);
+        error_report("Error fscanf did not report the right amount of items");
         return;
     }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-26 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 10:26 [PATCH 0/2] Fix RAPL MSR support in staging Anthony Harivel
2024-07-26 10:26 ` [PATCH 1/2] target/i386: Fix typo that assign same value twice Anthony Harivel
2024-07-26 10:26 ` [PATCH 2/2] target/i386: Clean output of vmsr_read_thread_stat() Anthony Harivel

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