diff mbox series

[2/2] target/i386/kvm: Change error_report() to tracepoint in vmsr_read_thread_stat()

Message ID 20250313101902.835556-3-aharivel@redhat.com (mailing list archive)
State New
Headers show
Series Add AMD CPU for RAPL MSR support | expand

Commit Message

Anthony Harivel March 13, 2025, 10:19 a.m. UTC
Threads in QEMU are frequently created and destroyed, leading to
non-critical errors. Replace `error_report()` with a tracepoint to
prevent flooding the serial terminal with non-essential error messages.

Signed-off-by: Anthony Harivel <aharivel@redhat.com>
---
 target/i386/kvm/trace-events  | 3 +++
 target/i386/kvm/vmsr_energy.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/target/i386/kvm/trace-events b/target/i386/kvm/trace-events
index 74a6234ff7f5..527750e3b23d 100644
--- a/target/i386/kvm/trace-events
+++ b/target/i386/kvm/trace-events
@@ -13,3 +13,6 @@  kvm_xen_soft_reset(void) ""
 kvm_xen_set_shared_info(uint64_t gfn) "shared info at gfn 0x%" PRIx64
 kvm_xen_set_vcpu_attr(int cpu, int type, uint64_t gpa) "vcpu attr cpu %d type %d gpa 0x%" PRIx64
 kvm_xen_set_vcpu_callback(int cpu, int vector) "callback vcpu %d vector %d"
+
+# vmsr_energy.c
+vmsr_read_thread_stat(const char *path) "Error opening path %s"
diff --git a/target/i386/kvm/vmsr_energy.c b/target/i386/kvm/vmsr_energy.c
index f3861d0607bb..f99aa9cfeb94 100644
--- a/target/i386/kvm/vmsr_energy.c
+++ b/target/i386/kvm/vmsr_energy.c
@@ -19,6 +19,7 @@ 
 #include "hw/boards.h"
 #include "cpu.h"
 #include "host-cpu.h"
+#include "trace.h"
 
 char *vmsr_compute_default_paths(void)
 {
@@ -280,7 +281,7 @@  void vmsr_read_thread_stat(pid_t pid,
 
     FILE *file = fopen(path, "r");
     if (file == NULL) {
-        error_report("Error opening %s", path_name);
+        trace_vmsr_read_thread_stat(path_name);
         return;
     }