Fix RAPL MSR support in staging
cover Fix RAPL MSR support in staging
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(-)
Signature · 1 line
2.45.2
PATCH 1/2 target/i386: Fix typo that assign same value twice
Should fix: CID 1558553
Signed-off-by Anthony Harivel <[email protected]>
--- target/i386/kvm/kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/kvm/kvm.c +2 -2
@@ -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;
Signature · 1 line
2.45.2
PATCH 2/2 target/i386: Clean output of vmsr_read_thread_stat()
In reply to Anthony HarivelFix 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 <[email protected]>
--- target/i386/kvm/vmsr_energy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
target/i386/kvm/vmsr_energy.c +3 -2
@@ -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 ; }
Signature · 1 line
2.45.2