qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] accel: cleanup error output


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH] accel: cleanup error output
Date: Mon, 17 Jul 2017 15:54:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 17.07.2017 15:21, 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 <address@hidden>
> Suggested-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
>  accel/accel.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/accel/accel.c b/accel/accel.c
> index fa85844..ababeb8 100644
> --- a/accel/accel.c
> +++ b/accel/accel.c
> @@ -69,19 +69,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 +90,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()) {
> @@ -110,7 +110,8 @@ void configure_accelerator(MachineState *ms)
>  
>      if (!accel_initialised) {
>          if (!init_failed) {
> -            fprintf(stderr, "No accelerator found!\n");
> +            fprintf(stderr, "-machine accel=%s: No accelerator found!\n",
> +                    accel);
>          }
>          exit(1);
>      }

Maybe use error_report() instead of fprintf(stderr, ...) ?

Apart from that, looks fine to me, so feel free to add my:

Reviewed-by: Thomas Huth <address@hidden>





reply via email to

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