[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus
From: |
Cédric Le Goater |
Subject: |
Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus |
Date: |
Fri, 8 Sep 2017 08:38:29 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/06/2017 10:27 AM, Nikunj A Dadhania wrote:
> When the user does not provide the cpu topology, e.g. "-smp 4", machine fails
> to
> initialize 4 cpus. Compute the chip per cores depending on the number of chips
> and smt threads.
I think we could also use the '-numa' options to define the cpus
per chip but this patch defines a good default layout and fixes
an issue.
> Signed-off-by: Nikunj A Dadhania <address@hidden>
Reviewed-by: Cédric Le Goater <address@hidden>
Tested-by: Cédric Le Goater <address@hidden>
I pushed the patch under the latest powernv tree :
https://github.com/legoater/qemu.git tags/powernv-2.10
Thanks,
C.
> ---
> hw/ppc/pnv.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 9724719..3fbaafb 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -642,7 +642,7 @@ static void ppc_powernv_init(MachineState *machine)
> MemoryRegion *ram;
> char *fw_filename;
> long fw_size;
> - int i;
> + int i, cores_per_chip;
> char *chip_typename;
> PCIBus *pbus;
> bool has_gfx = false;
> @@ -710,6 +710,22 @@ static void ppc_powernv_init(MachineState *machine)
> }
>
> pnv->chips = g_new0(PnvChip *, pnv->num_chips);
> +
> + /* If user has specified number of cores, use it. Otherwise, compute it.
> */
> + if (smp_cores != 1) {
> + cores_per_chip = smp_cores;
> + } else {
> + cores_per_chip = smp_cpus / (smp_threads * pnv->num_chips);
> + }
> +
> + if (smp_cpus != (smp_threads * pnv->num_chips * cores_per_chip)) {
> + error_report("cpu topology not balanced: "
> + "chips (%u) * cores (%u) * threads (%u) != "
> + "number of cpus (%u)",
> + pnv->num_chips, cores_per_chip, smp_threads, smp_cpus);
> + exit(1);
> + }
> +
> for (i = 0; i < pnv->num_chips; i++) {
> char chip_name[32];
> Object *chip = object_new(chip_typename);
> @@ -728,7 +744,7 @@ static void ppc_powernv_init(MachineState *machine)
> object_property_add_child(OBJECT(pnv), chip_name, chip,
> &error_fatal);
> object_property_set_int(chip, PNV_CHIP_HWID(i), "chip-id",
> &error_fatal);
> - object_property_set_int(chip, smp_cores, "nr-cores", &error_fatal);
> + object_property_set_int(chip, cores_per_chip, "nr-cores",
> &error_fatal);
> object_property_set_int(chip, 1, "num-phbs", &error_fatal);
> object_property_set_bool(chip, true, "realized", &error_fatal);
> }
>
- [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, Nikunj A Dadhania, 2017/09/06
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus,
Cédric Le Goater <=
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, David Gibson, 2017/09/09
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, Nikunj A Dadhania, 2017/09/11
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, David Gibson, 2017/09/13
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, Nikunj A Dadhania, 2017/09/14
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, David Gibson, 2017/09/15
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, Nikunj A Dadhania, 2017/09/15
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, David Gibson, 2017/09/15
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, Nikunj A Dadhania, 2017/09/15
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, David Gibson, 2017/09/19
- Re: [Qemu-ppc] [PATCH] ppc/pnv: fix cores per chip for multiple cpus, Nikunj A Dadhania, 2017/09/20