Skip to contentSkip to conversation

virtio: Only display errors if GUEST_ERROR is enabled

RFC PATCH In review Philippe Mathieu-Daudé 1 participant 2 messages Dec 10, 2020

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 virtio: Only display errors if GUEST_ERROR is enabled

Do not display virtio guest errors until the user request it.

---
 hw/virtio/virtio.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
hw/virtio/virtio.c +5 -3
index eff35fab7ce..bde0d31c5d9 100644
@@ -3622,9 +3622,11 @@ void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...)
 {
     va_list ap;
 
-    va_start(ap, fmt);
-    error_vreport(fmt, ap);
-    va_end(ap);
+    if (qemu_loglevel_mask(LOG_GUEST_ERROR)) {
+        va_start(ap, fmt);
+        error_vreport(fmt, ap);
+        va_end(ap);
+    }
 
     if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
         vdev->status = vdev->status | VIRTIO_CONFIG_S_NEEDS_RESET;
Signature · 1 line
2.26.2
#1 lore raw
Quoted 12 lines · Philippe Mathieu-Daudé

Do not display virtio guest errors until the user request it.

---
 hw/virtio/virtio.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
hw/virtio/virtio.c +0 -0
index eff35fab7ce..bde0d31c5d9 100644

hw/virtio/virtio.c void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...) · line 3625

Quoted 7 lines
hw/virtio/virtio.c +1 -3
@@ -3622,9 +3622,11 @@ void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...)
 {
     va_list ap;
 
-    va_start(ap, fmt);
-    error_vreport(fmt, ap);
-    va_end(ap);
+    if (qemu_loglevel_mask(LOG_GUEST_ERROR)) {

Hmm could move the 'va_list ap;' declaration here.

Quoted 8 lines
hw/virtio/virtio.c +4 -0
+        va_start(ap, fmt);
+        error_vreport(fmt, ap);
+        va_end(ap);
+    }
 
     if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
         vdev->status = vdev->status | VIRTIO_CONFIG_S_NEEDS_RESET;