* [Qemu-devel] [PATCH v2] accel: cleanup error output
@ 2017-07-17 14:45 Laurent Vivier
2017-07-17 15:19 ` Eric Blake
2017-07-18 6:19 ` Thomas Huth
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Vivier @ 2017-07-17 14:45 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Michael S . Tsirkin, Thomas Huth, Ben Warren,
Daniel P . Berrange, Peter Maydell, qemu-devel, Laurent Vivier
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>
---
v2: replace "fprintf(stderr, ...)" by error_report()
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);
}
}
--
2.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] accel: cleanup error output
2017-07-17 14:45 [Qemu-devel] [PATCH v2] accel: cleanup error output Laurent Vivier
@ 2017-07-17 15:19 ` Eric Blake
2017-07-18 6:19 ` Thomas Huth
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2017-07-17 15:19 UTC (permalink / raw)
To: Laurent Vivier, Paolo Bonzini
Cc: Peter Maydell, Thomas Huth, Ben Warren, Michael S . Tsirkin, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 748 bytes --]
On 07/17/2017 09:45 AM, Laurent Vivier wrote:
> 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>
> ---
> v2: replace "fprintf(stderr, ...)" by error_report()
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] accel: cleanup error output
2017-07-17 14:45 [Qemu-devel] [PATCH v2] accel: cleanup error output Laurent Vivier
2017-07-17 15:19 ` Eric Blake
@ 2017-07-18 6:19 ` Thomas Huth
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2017-07-18 6:19 UTC (permalink / raw)
To: Laurent Vivier, Paolo Bonzini
Cc: Michael S . Tsirkin, Ben Warren, Daniel P . Berrange,
Peter Maydell, qemu-devel
On 17.07.2017 16:45, Laurent Vivier wrote:
> 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>
> ---
> v2: replace "fprintf(stderr, ...)" by error_report()
I gave it a try, and it seems to work fine, thanks!
Tested-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-18 6:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 14:45 [Qemu-devel] [PATCH v2] accel: cleanup error output Laurent Vivier
2017-07-17 15:19 ` Eric Blake
2017-07-18 6:19 ` Thomas Huth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.