qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Laurent Vivier <lvivier@redhat.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eric Blake <eblake@redhat.com>, Thomas Huth <thuth@redhat.com>,
	Peter Xu <peterx@redhat.com>, Yang Zhong <yang.zhong@intel.com>,
	Anand J <anand.indukala@gmail.com>
Subject: [Qemu-devel] [PULL 06/10] accel: cleanup error output
Date: Wed, 2 Aug 2017 00:37:47 +0300	[thread overview]
Message-ID: <1501623438-31419-7-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1501623438-31419-1-git-send-email-mst@redhat.com>

From: Laurent Vivier <lvivier@redhat.com>

Only emit "XXX accelerator not found", if there are not
further accelerators listed. eg

   accel=kvm:tcg

doesn't print a "KVM accelerator not found" warning
when it falls back to tcg, but a

   accel=kvm

prints a warning, since no fallback is given.

Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
---
 accel/accel.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/accel/accel.c b/accel/accel.c
index fa85844..8ae40e1 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -33,6 +33,7 @@
 #include "sysemu/qtest.h"
 #include "hw/xen/xen.h"
 #include "qom/object.h"
+#include "qemu/error-report.h"
 
 static const TypeInfo accel_type = {
     .name = TYPE_ACCEL,
@@ -69,19 +70,20 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)
 
 void configure_accelerator(MachineState *ms)
 {
-    const char *p;
+    const char *accel, *p;
     char buf[10];
     int ret;
     bool accel_initialised = false;
     bool init_failed = false;
     AccelClass *acc = NULL;
 
-    p = qemu_opt_get(qemu_get_machine_opts(), "accel");
-    if (p == NULL) {
+    accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
+    if (accel == NULL) {
         /* Use the default "accelerator", tcg */
-        p = "tcg";
+        accel = "tcg";
     }
 
+    p = accel;
     while (!accel_initialised && *p != '\0') {
         if (*p == ':') {
             p++;
@@ -89,7 +91,6 @@ void configure_accelerator(MachineState *ms)
         p = get_opt_name(buf, sizeof(buf), p, ':');
         acc = accel_find(buf);
         if (!acc) {
-            fprintf(stderr, "\"%s\" accelerator not found.\n", buf);
             continue;
         }
         if (acc->available && !acc->available()) {
@@ -100,9 +101,8 @@ void configure_accelerator(MachineState *ms)
         ret = accel_init_machine(acc, ms);
         if (ret < 0) {
             init_failed = true;
-            fprintf(stderr, "failed to initialize %s: %s\n",
-                    acc->name,
-                    strerror(-ret));
+            error_report("failed to initialize %s: %s",
+                         acc->name, strerror(-ret));
         } else {
             accel_initialised = true;
         }
@@ -110,13 +110,13 @@ void configure_accelerator(MachineState *ms)
 
     if (!accel_initialised) {
         if (!init_failed) {
-            fprintf(stderr, "No accelerator found!\n");
+            error_report("-machine accel=%s: No accelerator found", accel);
         }
         exit(1);
     }
 
     if (init_failed) {
-        fprintf(stderr, "Back to %s accelerator.\n", acc->name);
+        error_report("Back to %s accelerator", acc->name);
     }
 }
 
-- 
MST

  parent reply	other threads:[~2017-08-01 21:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 21:37 [Qemu-devel] [PULL 00/10] pc, acpi, virtio: fixes, test speedup for rc1 Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 01/10] tests: switch pxe and vm gen id tests to use kvm Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 02/10] vhost: fix a memory leak Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 03/10] vhost-user: fix legacy cross-endian configurations Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 04/10] intel_iommu: fix iova for pt Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 05/10] intel_iommu: use access_flags for iotlb Michael S. Tsirkin
2017-08-01 21:37 ` Michael S. Tsirkin [this message]
2017-08-01 21:42   ` [Qemu-devel] [PULL 06/10] accel: cleanup error output Eric Blake
2017-08-01 21:37 ` [Qemu-devel] [PULL 07/10] tests/bios-tables-test: Compiler warning fix Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 08/10] vhost-user: fix watcher need be removed when vhost-user hotplug Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 09/10] pc: make 'pc.rom' readonly when machine has PCI enabled Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 10/10] pc: acpi: force FADT rev1 for 440fx based machine types Michael S. Tsirkin
2017-08-02 10:09 ` [Qemu-devel] [PULL 00/10] pc, acpi, virtio: fixes, test speedup for rc1 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1501623438-31419-7-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=anand.indukala@gmail.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=yang.zhong@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).