All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] exec: file_ram_alloc(): print error when prealloc fails
@ 2014-09-08 18:08 Luiz Capitulino
  2014-09-08 19:28 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Capitulino @ 2014-09-08 18:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, mtosatti, qemu-stable

If memory allocation fails when using the -mem-prealloc command-line
option, QEMU exits without printing any error information to
the user:

 # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages
 # echo $?
 1

This commit adds an error message, so that we print instead:

 # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages
 qemu: unable to map backing store for hugepages: Cannot allocate memory

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 exec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/exec.c b/exec.c
index 7dddcc8..cb73d16 100644
--- a/exec.c
+++ b/exec.c
@@ -1130,6 +1130,7 @@ static void *file_ram_alloc(RAMBlock *block,
 
 error:
     if (mem_prealloc) {
+        error_report("%s\n", error_get_pretty(*errp));
         exit(1);
     }
     return NULL;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] exec: file_ram_alloc(): print error when prealloc fails
  2014-09-08 18:08 [Qemu-devel] [PATCH] exec: file_ram_alloc(): print error when prealloc fails Luiz Capitulino
@ 2014-09-08 19:28 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2014-09-08 19:28 UTC (permalink / raw)
  To: Luiz Capitulino, qemu-devel; +Cc: peter.maydell, mtosatti, qemu-stable

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

On 09/08/2014 12:08 PM, Luiz Capitulino wrote:
> If memory allocation fails when using the -mem-prealloc command-line
> option, QEMU exits without printing any error information to
> the user:
> 
>  # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages
>  # echo $?
>  1
> 
> This commit adds an error message, so that we print instead:
> 
>  # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages
>  qemu: unable to map backing store for hugepages: Cannot allocate memory
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  exec.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-08 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08 18:08 [Qemu-devel] [PATCH] exec: file_ram_alloc(): print error when prealloc fails Luiz Capitulino
2014-09-08 19:28 ` Eric Blake

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.