From nobody Mon Feb 9 13:22:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1571908816; cv=none; d=zoho.com; s=zohoarc; b=lAUnZvHfSRWu+N7PCggJJ8Y95tuQHA3cvESDCyN7PEimA0GVs44JGso/jbcELjg006+g10A7EUBfHfNm+QPVIOPxZnHPdxjtyvvoHw4vfXCdhdGanJ1xsfAo6aNUuN//tSg5YL4IKdMkijylPjMBdsIzKzx1hmemIVz8K9T3HW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571908816; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g8ptL/FmzOqlKzQeiHcDWKV6OEjRAY6Lu7PWxJ/r/0Q=; b=Uc4zZceMGCpaYH3+ffYjobsiTiUp3vxw6LmyB0KyH37c5cGwX401VhCt0sDLdYDMZIOyvVb8EH50mO50kV4MBcu3tEO+39uExhdkjseFvWkccIIjJqudIhQE3J4woobAT3XPE84Kl9Cwj/GadwKB4kYv1dqfEmpHp6emyAE7P2g= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571908814777118.76191992185261; Thu, 24 Oct 2019 02:20:14 -0700 (PDT) Received: from localhost ([::1]:34882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNYPI-0005md-8D for importer@patchew.org; Thu, 24 Oct 2019 04:23:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36560) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNYKT-0004k8-Ah for qemu-devel@nongnu.org; Thu, 24 Oct 2019 04:18:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNYKR-000558-J6 for qemu-devel@nongnu.org; Thu, 24 Oct 2019 04:18:45 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:45981 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNYKR-0004zl-71; Thu, 24 Oct 2019 04:18:43 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 46zKrY36ctz9sRK; Thu, 24 Oct 2019 19:18:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1571905117; bh=UZTZ+rNi2S7nifzD4DHbqXRrfElzrdf4P+U68TJ+Ip4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DxlR9TgEwFtNCW49PwOaOBaEmppb7j4rlJDlFz8Rnctd4pAI55/cM1rkMacssxahP ypOOWPXn3n/oUwQ909xi92qJ+o/dfPLi3wsp240TCqJZObGhtpKHVvuNR/+Y+mobVZ 6CIodkk9dqHTgMSyJ/ZDBRgU9fbBALDixFuU6ZII= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 06/28] spapr: Set VSMT to smp_threads by default Date: Thu, 24 Oct 2019 19:17:51 +1100 Message-Id: <20191024081813.2115-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191024081813.2115-1-david@gibson.dropbear.id.au> References: <20191024081813.2115-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz Support for setting VSMT is available in KVM since linux-4.13. Most distros that support KVM on POWER already have it. It thus seem reasonable enough to have the default machine to set VSMT to smp_threads. This brings contiguous VCPU ids and thus brings their upper bound down to the machine's max_cpus. This is especially useful for XIVE KVM devices, which may thus allocate only one VP descriptor per VCPU. Signed-off-by: Greg Kurz Message-Id: <157010411885.246126.12610015369068227139.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/ppc/spapr.c | 7 ++++++- include/hw/ppc/spapr.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4eb97d3a9b..428b834f30 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2496,6 +2496,7 @@ static CPUArchId *spapr_find_cpu_slot(MachineState *m= s, uint32_t id, int *idx) static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) { MachineState *ms =3D MACHINE(spapr); + SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); Error *local_err =3D NULL; bool vsmt_user =3D !!spapr->vsmt; int kvm_smt =3D kvmppc_smt_threads(); @@ -2522,7 +2523,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *sp= apr, Error **errp) goto out; } /* In this case, spapr->vsmt has been set by the command line */ - } else { + } else if (!smc->smp_threads_vsmt) { /* * Default VSMT value is tricky, because we need it to be as * consistent as possible (for migration), but this requires @@ -2531,6 +2532,8 @@ static void spapr_set_vsmt_mode(SpaprMachineState *sp= apr, Error **errp) * overwhelmingly common case in production systems. */ spapr->vsmt =3D MAX(8, smp_threads); + } else { + spapr->vsmt =3D smp_threads; } =20 /* KVM: If necessary, set the SMT mode: */ @@ -4438,6 +4441,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) smc->irq =3D &spapr_irq_dual; smc->dr_phb_enabled =3D true; smc->linux_pci_probe =3D true; + smc->smp_threads_vsmt =3D true; } =20 static const TypeInfo spapr_machine_info =3D { @@ -4505,6 +4509,7 @@ static void spapr_machine_4_1_class_options(MachineCl= ass *mc) =20 spapr_machine_4_2_class_options(mc); smc->linux_pci_probe =3D false; + smc->smp_threads_vsmt =3D false; compat_props_add(mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); } diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index cbd1a4c9f3..2009eb64f9 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -122,6 +122,7 @@ struct SpaprMachineClass { bool broken_host_serial_model; /* present real host info to the guest = */ bool pre_4_1_migration; /* don't migrate hpt-max-page-size */ bool linux_pci_probe; + bool smp_threads_vsmt; /* set VSMT to smp_threads by default */ =20 void (*phb_placement)(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio,=20 --=20 2.21.0