qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Yin Wang <yin.wang@intel.com>
Cc: qemu-devel@nongnu.org,
	Alistair Francis <alistair.francis@wdc.com>,
	 Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
	LIU Zhiwei <zhiwei_liu@linux.alibaba.com>,
	 Weiwei Li <liweiwei@iscas.ac.cn>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Bin Meng <bin.meng@windriver.com>,
	 "open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>
Subject: Re: [PATCH v5] hw/riscv: qemu crash when NUMA nodes exceed available CPUs
Date: Thu, 25 May 2023 12:24:26 +1000	[thread overview]
Message-ID: <CAKmqyKO1fkvSKLP6Ji2aE_jB3x65P=pqA22EsNSXy0aAFwuZJQ@mail.gmail.com> (raw)
In-Reply-To: <20230519023758.1759434-1-yin.wang@intel.com>

On Fri, May 19, 2023 at 12:38 PM Yin Wang <yin.wang@intel.com> wrote:
>
> Command "qemu-system-riscv64 -machine virt
> -m 2G -smp 1 -numa node,mem=1G -numa node,mem=1G"
> would trigger this problem.Backtrace with:
>  #0  0x0000555555b5b1a4 in riscv_numa_get_default_cpu_node_id  at ../hw/riscv/numa.c:211
>  #1  0x00005555558ce510 in machine_numa_finish_cpu_init  at ../hw/core/machine.c:1230
>  #2  0x00005555558ce9d3 in machine_run_board_init  at ../hw/core/machine.c:1346
>  #3  0x0000555555aaedc3 in qemu_init_board  at ../softmmu/vl.c:2513
>  #4  0x0000555555aaf064 in qmp_x_exit_preconfig  at ../softmmu/vl.c:2609
>  #5  0x0000555555ab1916 in qemu_init  at ../softmmu/vl.c:3617
>  #6  0x000055555585463b in main  at ../softmmu/main.c:47
> This commit fixes the issue by adding parameter checks.
>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
> Signed-off-by: Yin Wang <yin.wang@intel.com>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  hw/riscv/numa.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/hw/riscv/numa.c b/hw/riscv/numa.c
> index 4720102561..e0414d5b1b 100644
> --- a/hw/riscv/numa.c
> +++ b/hw/riscv/numa.c
> @@ -207,6 +207,12 @@ int64_t riscv_numa_get_default_cpu_node_id(const MachineState *ms, int idx)
>  {
>      int64_t nidx = 0;
>
> +    if (ms->numa_state->num_nodes > ms->smp.cpus) {
> +        error_report("Number of NUMA nodes (%d)"
> +                     " cannot exceed the number of available CPUs (%d).",
> +                     ms->numa_state->num_nodes, ms->smp.max_cpus);
> +        exit(EXIT_FAILURE);
> +    }
>      if (ms->numa_state->num_nodes) {
>          nidx = idx / (ms->smp.cpus / ms->numa_state->num_nodes);
>          if (ms->numa_state->num_nodes <= nidx) {
> --
> 2.34.1
>
>


      reply	other threads:[~2023-05-25  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  2:37 [PATCH v5] hw/riscv: qemu crash when NUMA nodes exceed available CPUs Yin Wang
2023-05-25  2:24 ` Alistair Francis [this message]

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='CAKmqyKO1fkvSKLP6Ji2aE_jB3x65P=pqA22EsNSXy0aAFwuZJQ@mail.gmail.com' \
    --to=alistair23@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=liweiwei@iscas.ac.cn \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=yin.wang@intel.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /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 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).