qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PULL 078/103] memory: add error propagation to file-ba


From: Eric Blake
Subject: Re: [Qemu-devel] [PULL 078/103] memory: add error propagation to file-based RAM allocation
Date: Tue, 17 Jun 2014 14:49:38 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 06/17/2014 11:41 AM, Michael S. Tsirkin wrote:
> From: Paolo Bonzini <address@hidden>
> 
> Right now, -mem-path will fall back to RAM-based allocation in some
> cases.  This should never happen with "-object memory-file", prepare
> the code by adding correct error propagation.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Hu Tao <address@hidden>
> Acked-by: Michael S. Tsirkin <address@hidden>
> ---

> @@ -1035,7 +1036,8 @@ static void *file_ram_alloc(RAMBlock *block,
>      }
>  
>      if (kvm_enabled() && !kvm_has_sync_mmu()) {
> -        fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path 
> unsupported\n");
> +        error_setg(errp,
> +                   "host lacks kvm mmu notifiers, -mem-path unsupported\n");

Please drop the trailing \n in a followup patch.

>  ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
> -                                    const char *mem_path)
> +                                    const char *mem_path,
> +                                    Error **errp)
>  {
>      RAMBlock *new_block;
>  
>      if (xen_enabled()) {
> -        fprintf(stderr, "-mem-path not supported with Xen\n");
> -        exit(1);
> +        error_setg(errp, "-mem-path not supported with Xen\n");
> +        return -1;
>      }
>  
>      if (phys_mem_alloc != qemu_anon_ram_alloc) {
> @@ -1280,16 +1286,22 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, 
> MemoryRegion *mr,
>           * phys_mem_alloc, but we haven't bothered to provide
>           * a hook there.
>           */
> -        fprintf(stderr,
> -                "-mem-path not supported with this accelerator\n");
> -        exit(1);
> +        error_setg(errp,
> +                   "-mem-path not supported with this accelerator\n");

Two more instances.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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