qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH] hw/vfio: improve error message when cannot in


From: Jim Quigley
Subject: Re: [Qemu-trivial] [PATCH] hw/vfio: improve error message when cannot init vfio event notifiers
Date: Fri, 10 Nov 2017 10:03:07 +0000
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0



On 16/10/2017 19:07, Michael Tokarev wrote:
10.10.2017 13:22, Jim Quigley wrote:
More information is required to assist trouble-shooting when
QEMU fails to initialise the event notifications for devices
assigned with VFIO-PCI. Instead of supplying the user with a cryptic
error number only, print out a proper error message with strerror()
so that the user has a better way to figure out what the problem is.

Reviewed-by: Liam Merwick <address@hidden>
Signed-off-by: Jim Quigley <address@hidden>
---
Cc: address@hidden
Cc: address@hidden
Cc: address@hidden
Cc: address@hidden
---
 hw/vfio/pci.c | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 31e1edf..3bffb93 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -430,13 +430,16 @@ static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix)
 static void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,
                                   int vector_n, bool msix)
 {
-    int virq;
+    int virq, ret;
 
     if ((msix && vdev->no_kvm_msix) || (!msix && vdev->no_kvm_msi)) {
         return;
     }
 
-    if (event_notifier_init(&vector->kvm_interrupt, 0)) {
+    ret = event_notifier_init(&vector->kvm_interrupt, 0);
+    if (ret) {
+        error_report("vfio (%s): Error: unable to init event notifier: %s (%d)",
+                     __func__, strerror(-ret), -ret);
Since this pattern gets repeated again and again, maybe we can either
use a common wrapper or move that eror reporting into event_notifier_init()?
Note there are other users of this function, besides hw/vfio, and maybe
these, too, can benefit from better error reporting?

    Ideally the strerror() would be included in the error_report() function,
    (as per the error_setg() function), which obviously would involve a more
    extensive change to the code base. Would that be an acceptable solution ?
    Or I can move the reporting into the event_notifier_init() function if that is
    the preferred approach ?
       
        thanks

        regards

        Jim Q.
   

Thanks,

/mjt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]