From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
npiggin@gmail.com, qemu-ppc@nongnu.org
Cc: danielhb413@gmail.com, clg@kaod.org, david@gibson.dropbear.id.au,
qemu-devel@nongnu.org
Subject: Re: [PATCH v2 2/2] ppc/spapr: Initialize max_cpus limit to SPAPR_NR_IPIS.
Date: Thu, 23 Nov 2023 10:33:32 +0530 [thread overview]
Message-ID: <504a8c39-711c-2fcf-ffc7-396898d5e84b@linux.ibm.com> (raw)
In-Reply-To: <4eaf8cf4-94b1-425b-a712-c006abb114c3@linaro.org>
Hi Philippe,
On 11/22/23 16:46, Philippe Mathieu-Daudé wrote:
> Hi Harsh,
>
> On 22/11/23 10:28, Harsh Prateek Bora wrote:
>> Initialize the machine specific max_cpus limit as per the maximum range
>> of CPU IPIs available. Keeping between 4096 to 8192 will throw IRQ not
>> free error due to XIVE/XICS limitation and keeping beyond 8192 will hit
>> assert in tcg_region_init or spapr_xive_claim_irq.
>>
>> Logs:
>>
>> Without patch fix:
>>
>> [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=4097
>> qemu-system-ppc64: IRQ 4096 is not free
>> [root@host build]#
>>
>> On LPAR:
>> [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=8193
>> **
>> ERROR:../tcg/region.c:774:tcg_region_init: assertion failed:
>> (region_size >= 2 * page_size)
>> Bail out! ERROR:../tcg/region.c:774:tcg_region_init: assertion failed:
>> (region_size >= 2 * page_size)
>> Aborted (core dumped)
>> [root@host build]#
>>
>> On x86:
>> [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=8193
>> qemu-system-ppc64: ../hw/intc/spapr_xive.c:596: spapr_xive_claim_irq:
>> Assertion `lisn < xive->nr_irqs' failed.
>> Aborted (core dumped)
>> [root@host build]#
>>
>> With patch fix:
>> [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=4097
>> qemu-system-ppc64: Invalid SMP CPUs 4097. The max CPUs supported by
>> machine 'pseries-8.2' is 4096
>> [root@host build]#
>>
>> Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
>> ---
>> hw/ppc/spapr.c | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index df09aa9d6a..0de11a4458 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -4647,13 +4647,10 @@ static void
>> spapr_machine_class_init(ObjectClass *oc, void *data)
>> mc->block_default_type = IF_SCSI;
>> /*
>> - * Setting max_cpus to INT32_MAX. Both KVM and TCG max_cpus values
>> - * should be limited by the host capability instead of hardcoded.
>> - * max_cpus for KVM guests will be checked in kvm_init(), and TCG
>> - * guests are welcome to have as many CPUs as the host are capable
>> - * of emulate.
>> + * While KVM determines max cpus in kvm_init() using
>> kvm_max_vcpus(),
>> + * In TCG the limit is restricted by the range of CPU IPIs
>> available.
>> */
>> - mc->max_cpus = INT32_MAX;
>> + mc->max_cpus = SPAPR_NR_IPIS;
>
> Is SPAPR_NR_IPIS also the upper limit for KVM?
In KVM mode, the limit is restricted to what is supported by KVM which
is checked using kvm_ioctl via wrappers in kvm_init and appears to be
evaluating to 2048. So, having a larger default works for both case.
regards,
Harsh
>
>> mc->no_parallel = 1;
>> mc->default_boot_order = "";
>
next prev parent reply other threads:[~2023-11-23 5:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 9:28 [PATCH RESEND v2 0/2] Introduce SPAPR_NR_IPIS and fix max-cpus Harsh Prateek Bora
2023-11-22 9:28 ` [PATCH v2 1/2] ppc/spapr: Introduce SPAPR_NR_IPIS to refer IRQ range for CPU IPIs Harsh Prateek Bora
2023-11-22 11:12 ` Philippe Mathieu-Daudé
2023-11-22 11:13 ` Philippe Mathieu-Daudé
2023-11-22 11:16 ` Cédric Le Goater
2023-11-22 11:31 ` Cédric Le Goater
2023-11-23 5:04 ` Harsh Prateek Bora
2023-11-22 9:28 ` [PATCH v2 2/2] ppc/spapr: Initialize max_cpus limit to SPAPR_NR_IPIS Harsh Prateek Bora
2023-11-22 11:16 ` Philippe Mathieu-Daudé
2023-11-23 5:03 ` Harsh Prateek Bora [this message]
2023-11-23 8:47 ` Cédric Le Goater
2023-11-23 10:26 ` Philippe Mathieu-Daudé
2023-11-23 13:51 ` Cédric Le Goater
-- strict thread matches above, loose matches on Subject: below --
2023-11-22 9:24 [PATCH v2 1/2] ppc/spapr: Introduce SPAPR_NR_IPIS to refer IRQ range for CPU IPIs Harsh Prateek Bora
2023-11-22 9:24 ` [PATCH v2 2/2] ppc/spapr: Initialize max_cpus limit to SPAPR_NR_IPIS Harsh Prateek Bora
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=504a8c39-711c-2fcf-ffc7-396898d5e84b@linux.ibm.com \
--to=harshpb@linux.ibm.com \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=npiggin@gmail.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 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).