qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for 2.1] numa: handle mmaped memory allocation failure correctly
@ 2014-06-17 10:17 Igor Mammedov
  2014-06-17 11:22 ` Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Mammedov @ 2014-06-17 10:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: hutao, pbonzini, gaowanlong, mst

when memory_region_init_ram_from_file() fails
memory_region_size() will still return size that was
provided at region init time.
Instead use errp to properly detect error condition.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
patch depends on current PCI tree that stages last NUMA series

 numa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/numa.c b/numa.c
index eef0717..e471afe 100644
--- a/numa.c
+++ b/numa.c
@@ -238,7 +238,7 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,
         /* Legacy behavior: if allocation failed, fall back to
          * regular RAM allocation.
          */
-        if (!memory_region_size(mr)) {
+        if (err) {
             qerror_report_err(err);
             error_free(err);
             memory_region_init_ram(mr, owner, name, ram_size);
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH for 2.1] numa: handle mmaped memory allocation failure correctly
  2014-06-17 10:17 [Qemu-devel] [PATCH for 2.1] numa: handle mmaped memory allocation failure correctly Igor Mammedov
@ 2014-06-17 11:22 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2014-06-17 11:22 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: hutao, qemu-devel, gaowanlong, pbonzini

On Tue, Jun 17, 2014 at 12:17:05PM +0200, Igor Mammedov wrote:
> when memory_region_init_ram_from_file() fails
> memory_region_size() will still return size that was
> provided at region init time.
> Instead use errp to properly detect error condition.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Obviously correct, applied.
Thanks!

> ---
> patch depends on current PCI tree that stages last NUMA series
> 
>  numa.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/numa.c b/numa.c
> index eef0717..e471afe 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -238,7 +238,7 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,
>          /* Legacy behavior: if allocation failed, fall back to
>           * regular RAM allocation.
>           */
> -        if (!memory_region_size(mr)) {
> +        if (err) {
>              qerror_report_err(err);
>              error_free(err);
>              memory_region_init_ram(mr, owner, name, ram_size);
> -- 
> 1.7.1

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

end of thread, other threads:[~2014-06-17 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-17 10:17 [Qemu-devel] [PATCH for 2.1] numa: handle mmaped memory allocation failure correctly Igor Mammedov
2014-06-17 11:22 ` Michael S. Tsirkin

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).