Skip to contentSkip to conversation

hw/virtio-pci: Replace error_report() by qemu_log_mask(GUEST_ERROR)

PATCH Applied Philippe Mathieu-Daudé 4 participants 7 messages Dec 10, 2020 – Jan 12, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/virtio-pci: Replace error_report() by qemu_log_mask(GUEST_ERROR)

Replace I/O write error reported with error_report() by qemu_log_mask(GUEST_ERROR) which allow filtering.

---
 hw/virtio/virtio-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/virtio/virtio-pci.c +4 -2
index f863f69ede4..094c36aa3ea 100644
@@ -27,6 +27,7 @@
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
+#include "qemu/log.h"
 #include "qemu/module.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
@@ -365,8 +366,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         virtio_queue_set_vector(vdev, vdev->queue_sel, val);
         break;
     default:
-        error_report("%s: unexpected address 0x%x value 0x%x",
-                     __func__, addr, val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: unexpected address 0x%x value 0x%x\n",
+                      __func__, addr, val);
         break;
     }
 }
Signature · 1 line
2.26.2
#1 lore raw

ping?

Quoted 33 lines · Philippe Mathieu-Daudé

Replace I/O write error reported with error_report() by qemu_log_mask(GUEST_ERROR) which allow filtering.

---
 hw/virtio/virtio-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/virtio/virtio-pci.c +4 -2
index f863f69ede4..094c36aa3ea 100644
@@ -27,6 +27,7 @@
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
+#include "qemu/log.h"
 #include "qemu/module.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
@@ -365,8 +366,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         virtio_queue_set_vector(vdev, vdev->queue_sel, val);
         break;
     default:
-        error_report("%s: unexpected address 0x%x value 0x%x",
-                     __func__, addr, val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: unexpected address 0x%x value 0x%x\n",
+                      __func__, addr, val);
         break;
     }
 }
Reviewed-by on v1 1/1
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 22 lines · Philippe Mathieu-Daudé

Replace I/O write error reported with error_report() by qemu_log_mask(GUEST_ERROR) which allow filtering.

---
  hw/virtio/virtio-pci.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
hw/virtio/virtio-pci.c +1 -0
index f863f69ede4..094c36aa3ea 100644
@@ -27,6 +27,7 @@
  #include "hw/qdev-properties.h"
  #include "qapi/error.h"
  #include "qemu/error-report.h"
+#include "qemu/log.h"
  #include "qemu/module.h"
  #include "hw/pci/msi.h"
  #include "hw/pci/msix.h"
@@ -365,8 +366,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
          virtio_queue_set_vector(vdev, vdev->queue_sel, val);

hw/virtio/virtio-pci.c static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) · line 374

Quoted 10 lines
hw/virtio/virtio-pci.c +3 -2
          break;
      default:
-        error_report("%s: unexpected address 0x%x value 0x%x",
-                     __func__, addr, val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: unexpected address 0x%x value 0x%x\n",
+                      __func__, addr, val);
          break;
      }
  }
Reviewed-by on v1 1/1
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 13 lines · Philippe Mathieu-Daudé

Replace I/O write error reported with error_report() by qemu_log_mask(GUEST_ERROR) which allow filtering.

---
hw/virtio/virtio-pci.c | 6 ++++--

1 file changed, 4 insertions(+), 2 deletions(-)
hw/virtio/virtio-pci.c +0 -0
index f863f69ede4..094c36aa3ea 100644

hw/virtio/virtio-pci.c line 29

Quoted 3 lines
hw/virtio/virtio-pci.c +0 -0
@@ -27,6 +27,7 @@
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
            ^

Just a little thing, could we remove this inclusion since we are not using error_report() anymore in this file?

Anyway the patch LGTM:

Quoted 20 lines
hw/virtio/virtio-pci.c +4 -2
+#include "qemu/log.h"
 #include "qemu/module.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
@@ -365,8 +366,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
        virtio_queue_set_vector(vdev, vdev->queue_sel, val);
        break;
    default:
-        error_report("%s: unexpected address 0x%x value 0x%x",
-                     __func__, addr, val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: unexpected address 0x%x value 0x%x\n",
+                      __func__, addr, val);
        break;
    }
 }
Signature · 1 line
2.26.2
#4 lore raw
Quoted 9 lines · Stefano Garzarella
Quoted 8 lines · Philippe Mathieu-Daudé

Replace I/O write error reported with error_report() by qemu_log_mask(GUEST_ERROR) which allow filtering.

---
hw/virtio/virtio-pci.c | 6 ++++--

1 file changed, 4 insertions(+), 2 deletions(-)
Quoted 11 lines

hw/virtio/virtio-pci.c line 29

Quoted 8 lines
hw/virtio/virtio-pci.c +0 -0
index f863f69ede4..094c36aa3ea 100644
@@ -27,6 +27,7 @@
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"

            ^
Just a little thing, could we remove this inclusion since we are not using error_report() anymore in this file?

We can't because virtio_pci_device_plugged() calls warn_report() twice :/

Quoted 3 lines

Anyway the patch LGTM:

Thanks!

Phil.

#5 lore raw
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Stefano Garzarella
Quoted 8 lines · Philippe Mathieu-Daudé

Replace I/O write error reported with error_report() by qemu_log_mask(GUEST_ERROR) which allow filtering.

---
hw/virtio/virtio-pci.c | 6 ++++--

1 file changed, 4 insertions(+), 2 deletions(-)
Quoted 11 lines

hw/virtio/virtio-pci.c line 29

Quoted 8 lines
hw/virtio/virtio-pci.c +0 -0
index f863f69ede4..094c36aa3ea 100644
@@ -27,6 +27,7 @@
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"

            ^
Just a little thing, could we remove this inclusion since we are not using error_report() anymore in this file?

Quoted 2 lines

We can't because virtio_pci_device_plugged() calls warn_report() twice :/

Of course you are right :-)

Stefano

Quoted 9 lines
Quoted 4 lines

Anyway the patch LGTM:

Thanks!

Phil.

#6 lore raw
In reply to Philippe Mathieu-Daudé

Le 10/12/2020 à 18:28, Philippe Mathieu-Daudé a écrit :

Quoted 23 lines

Replace I/O write error reported with error_report() by qemu_log_mask(GUEST_ERROR) which allow filtering.

---
 hw/virtio/virtio-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/virtio/virtio-pci.c +1 -0
index f863f69ede4..094c36aa3ea 100644
@@ -27,6 +27,7 @@
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
+#include "qemu/log.h"
 #include "qemu/module.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
@@ -365,8 +366,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         virtio_queue_set_vector(vdev, vdev->queue_sel, val);

hw/virtio/virtio-pci.c static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) · line 374

Quoted 10 lines
hw/virtio/virtio-pci.c +3 -2
         break;
     default:
-        error_report("%s: unexpected address 0x%x value 0x%x",
-                     __func__, addr, val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: unexpected address 0x%x value 0x%x\n",
+                      __func__, addr, val);
         break;
     }
 }

Applied to my trivial-patches branch.

Thanks,
Laurent