Received: from eggs.gnu.org ([2001:4830:134:3::10]:41261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAXuE-0000gf-VN for qemu-devel@nongnu.org; Thu, 02 Jul 2015 02:23:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAXuD-0002LQ-O7 for qemu-devel@nongnu.org; Thu, 02 Jul 2015 02:23:30 -0400 From: David Gibson Date: Thu, 2 Jul 2015 16:23:02 +1000 Message-Id: <1435818208-11808-2-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1435818208-11808-1-git-send-email-david@gibson.dropbear.id.au> References: <1435818208-11808-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 01/27] spapr: ensure we have at least one XICS server List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: agraf@suse.de, afaerber@suse.de Cc: lvivier@redhat.com, thuth@redhat.com, aik@ozlabs.ru, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, David Gibson , Greg Kurz From: Greg Kurz XICS needs to know the upper value for cpu_index as it is used to compute the number of servers: smp_cpus * kvmppc_smt_threads() / smp_threads When passing -smp cpus=1,threads=9 on a POWER8 host, we end up with: 1 * 8 / 9 = 0 ... which leads to an assertion in both emulated: Number of servers needs to be greater 0 Aborted (core dumped) ... and in-kernel XICS: xics_kvm_realize: Assertion `icp->nr_servers' failed. Aborted (core dumped) With this patch, we are sure that nr_servers > 0. Passing the same bogus -smp option then leads to: qemu-system-ppc64: Cannot support more than 8 threads on PPC with KVM ... which is a lot more explicit than the XICS errors. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index f174e5a..10ca866 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1467,7 +1467,8 @@ static void ppc_spapr_init(MachineState *machine) /* Set up Interrupt Controller before we create the VCPUs */ spapr->icp = xics_system_init(machine, - smp_cpus * kvmppc_smt_threads() / smp_threads, + DIV_ROUND_UP(smp_cpus * kvmppc_smt_threads(), + smp_threads), XICS_IRQS); /* init CPUs */ -- 2.4.3