From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [Qemu-devel] [PULL 03/17] accel: cleanup error output
Date: Tue, 1 Aug 2017 18:17:11 +0200 [thread overview]
Message-ID: <1501604245-33460-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@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>
Message-Id: <20170717144527.24534-1-lvivier@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@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);
}
}
--
1.8.3.1
next prev parent reply other threads:[~2017-08-01 16:17 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 16:17 [Qemu-devel] [PULL 00/17] Misc changes for QEMU 2.10-rc1 (?) Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 01/17] vl.c/exit: pause cpus before closing block devices Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 02/17] cpu_physical_memory_sync_dirty_bitmap: Fix alignment check Paolo Bonzini
2017-08-01 17:56 ` Peter Maydell
2017-08-01 18:04 ` Dr. David Alan Gilbert
2017-08-02 7:39 ` Paolo Bonzini
2017-08-07 10:07 ` Alex Bennée
2017-08-01 16:17 ` Paolo Bonzini [this message]
2017-08-01 16:17 ` [Qemu-devel] [PULL 04/17] char-fd: remove useless chr pointer Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 05/17] char: don't exit on hmp 'chardev-add help' Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 06/17] docs: document deprecation policy & deprecated features in appendix Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 07/17] target-i386: kvm_get/put_vcpu_events don't handle sipi_vector Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 08/17] exec: Add lock parameter to qemu_ram_ptr_length Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 09/17] bt: stop the sdp memory allocation craziness Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 10/17] qemu-options: document existance of versioned machine types Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 11/17] migration: optimize the downtime Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 12/17] hw/scsi/vmw_pvscsi: Remove the dead error handling Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 13/17] hw/scsi/vmw_pvscsi: Convert to realize Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 14/17] rtc-test: cleanup register_b_set_flag test Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 15/17] rtc-test: introduce more update tests Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 16/17] mc146818rtc: simplify check_update_timer Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 17/17] mc146818rtc: implement UIP latching as intended Paolo Bonzini
2017-08-01 16:48 ` [Qemu-devel] [PULL 00/17] Misc changes for QEMU 2.10-rc1 (?) no-reply
2017-08-01 16:50 ` Paolo Bonzini
2017-08-01 17:10 ` Peter Maydell
2017-08-01 17:17 ` Paolo Bonzini
2017-08-01 17:22 ` Peter Maydell
2017-08-01 17:26 ` Paolo Bonzini
2017-08-01 17:56 ` Peter Maydell
2017-08-02 5:48 ` Paolo Bonzini
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=1501604245-33460-4-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=lvivier@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).