All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Cc: ehabkost@redhat.com
Subject: Re: [PATCH 2/2] numa: prevent usage of -M memory-backend and -numa memdev at the same time
Date: Thu, 21 May 2020 15:46:44 +0200	[thread overview]
Message-ID: <7d40862d-972f-8189-07df-af043a430ee6@redhat.com> (raw)
In-Reply-To: <20200511141103.43768-3-imammedo@redhat.com>

On 11/05/20 16:11, Igor Mammedov wrote:
> Options -M memory-backend and -numa memdev are mutually exclusive,
> and if used together, it might lead to a crash in the worst case.
> For example when the same backend is used with these options together:
>   -m 4G \
>   -object memory-backend-ram,id=mem0,size=4G \
>   -M pc,memory-backend=mem0 \
>   -numa node,memdev=mem0
> QEMU will abort with:
>    exec.c:2006: qemu_ram_set_idstr: Assertion `!new_block->idstr[0]' failed.
> 
> and following backtrace:
>     abort ()
>     qemu_ram_set_idstr ()
>     vmstate_register_ram ()
>     vmstate_register_ram_global ()
>     machine_consume_memdev ()
>     numa_init_memdev_container ()
>     numa_complete_configuration ()
>     machine_run_board_init ()
> 
> add a check to error out in case the user tries to use both options at
> the same time.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/core/numa.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/hw/core/numa.c b/hw/core/numa.c
> index 316bc50d75..5f81900f88 100644
> --- a/hw/core/numa.c
> +++ b/hw/core/numa.c
> @@ -757,6 +757,11 @@ void numa_complete_configuration(MachineState *ms)
>          }
>  
>          if (!numa_uses_legacy_mem() && mc->default_ram_id) {
> +            if (ms->ram_memdev_id) {
> +                error_report("'-machine memory-backend' and '-numa memdev'"
> +                             " properties are mutually exclusive");
> +                exit(1);
> +            }
>              ms->ram = g_new(MemoryRegion, 1);
>              memory_region_init(ms->ram, OBJECT(ms), mc->default_ram_id,
>                                 ram_size);
> 

Queued, thanks.

Paolo



  reply	other threads:[~2020-05-21 13:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 14:11 [PATCH 0/2] make -M memory-backend and -numa memdev mutually exclusive Igor Mammedov
2020-05-11 14:11 ` [PATCH 1/2] vl.c: run preconfig loop before creating default RAM backend Igor Mammedov
2020-05-11 14:11 ` [PATCH 2/2] numa: prevent usage of -M memory-backend and -numa memdev at the same time Igor Mammedov
2020-05-21 13:46   ` Paolo Bonzini [this message]
2020-05-19 14:44 ` [PATCH 0/2] make -M memory-backend and -numa memdev mutually exclusive Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d40862d-972f-8189-07df-af043a430ee6@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.