From nobody Mon Feb 9 23:01:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529377945981544.719009903742; Mon, 18 Jun 2018 20:12:25 -0700 (PDT) Received: from localhost ([::1]:38929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV74D-0003Fy-2P for importer@patchew.org; Mon, 18 Jun 2018 23:12:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5jK-0002rv-8D for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5jJ-0000bD-5E for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:46 -0400 Received: from mail-ot0-x242.google.com ([2607:f8b0:4003:c0f::242]:34694) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5jI-0000aa-W7; Mon, 18 Jun 2018 21:46:45 -0400 Received: by mail-ot0-x242.google.com with SMTP id r18-v6so20784391otk.1; Mon, 18 Jun 2018 18:46:44 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id k47-v6sm9223201otb.50.2018.06.18.18.46.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=TQeRTsFw7TCwjoTDQG9AEckG7e4A2HEOIhT0Wo4z+AE=; b=SNqid+0unnjwwW8/DailOb3Gz63Km8+pMW7Wf4OwNd14cr4f3wMYTSYpw/ZEcg3PKM IZSeZUEyXuH9LkS5HRAzUH1m0BHh54PSDCzvIoI5z5h/C+GDyFB1ARJyr7C8O2AHgvTM MNCa5apxTbpzLxjuRRVJu17LnyhhJ6YqkB9mBFj8tI+HvLTLgWqKiZGefIrlqjmfMl/H WP4c9DKqh3nl8EgsFLQjcHqrHqNj58TJedy0KGFegX2I4CrJ+M5NGxQwX6imwL2yQD7t mvBLaUalXmvCG6xEebN0XuAIxpB7sg5nmjnCu2Km64zyLO8E8J7F57j2NWdQE0/lo/I6 RJ9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=TQeRTsFw7TCwjoTDQG9AEckG7e4A2HEOIhT0Wo4z+AE=; b=SXvqfP36ci2emr4N3/3XfSwapdHorWu8TcMlEP3VTijypoDevTuEzJpHl5wnR/JdJM hextlXX8rcb+HKys0VJooH6KgVyfDcpPwTyrn/VET0hYhB5U5AiK+cz/oIMSAGJjoGx0 Qn9g8R57LKzxQsfvtFBLkzGTlRIBfSr+wqrQEg704R18vdIIs0PRWDE6VVLbE50JxAr7 gdbxbCy74MLNw/MK6ApRAn3dko+M+wd4NMhURYK0qyP6Q3UzWygSlflvvJxULvw5ZjzU ULyrDJqeKlw1ORPXrLStken3PxvGPMX5Ugcehpku9Sy+hPTmmHEB0kQLoDt44w8wIS+o c4gQ== X-Gm-Message-State: APt69E2fS4dbxMBicNLKk1hiXizx4w5sdI+en8ulxi4GAKHDAeOQLlVr PJhGvdYXrWVmFdoIry8AyIJOPkXkSFE= X-Google-Smtp-Source: ADUXVKK0U/GntJFCuqX0JP/tFuAjLfPpKZZTBaPQjIcC1fFSHlm365DOWidEhLd7taIOVTq6g2FKjQ== X-Received: by 2002:a9d:577d:: with SMTP id x58-v6mr9828321oti.196.1529372803862; Mon, 18 Jun 2018 18:46:43 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:41:32 -0500 Message-Id: <20180619014319.28272-7-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::242 Subject: [Qemu-devel] [PATCH 006/113] spapr: Allow some cases where we can't set VSMT mode in the kernel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz , qemu-stable@nongnu.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) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Gibson At present if we require a vsmt mode that's not equal to the kernel's default, and the kernel doesn't let us change it (e.g. because it's an old kernel without support) then we always fail. But in fact we can cope with the kernel having a different vsmt as long as a) it's >=3D the actual number of vthreads/vcore (so that guest threads that are supposed to be on the same core act like it) b) it's a submultiple of the requested vsmt mode (so that guest threads spaced by the vsmt value will act like they're on different cores) Allowing this case gives us a bit more freedom to adjust the vsmt behaviour without breaking existing cases. Signed-off-by: David Gibson Reviewed-by: Laurent Vivier Tested-by: Greg Kurz Reviewed-by: Greg Kurz (cherry picked from commit 1f20f2e0ee61d91abff4e86ed1cda1b5244647d3) Signed-off-by: Greg Kurz --- hw/ppc/spapr.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b57528baf4..37388f1416 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2291,17 +2291,29 @@ static void spapr_set_vsmt_mode(sPAPRMachineState *= spapr, Error **errp) if (kvm_enabled() && (spapr->vsmt !=3D kvm_smt)) { ret =3D kvmppc_set_smt_threads(spapr->vsmt); if (ret) { + /* Looks like KVM isn't able to change VSMT mode */ error_setg(&local_err, "Failed to set KVM's VSMT mode to %d (errno %d)", spapr->vsmt, ret); - if (!vsmt_user) { - error_append_hint(&local_err, "On PPC, a VM with %d thread= s/" - "core on a host with %d threads/core requires= " - " the use of VSMT mode %d.\n", - smp_threads, kvm_smt, spapr->vsmt); + /* We can live with that if the default one is big enough + * for the number of threads, and a submultiple of the one + * we want. In this case we'll waste some vcpu ids, but + * behaviour will be correct */ + if ((kvm_smt >=3D smp_threads) && ((spapr->vsmt % kvm_smt) =3D= =3D 0)) { + warn_report_err(local_err); + local_err =3D NULL; + goto out; + } else { + if (!vsmt_user) { + error_append_hint(&local_err, + "On PPC, a VM with %d threads/core" + " on a host with %d threads/core" + " requires the use of VSMT mode %d.\= n", + smp_threads, kvm_smt, spapr->vsmt); + } + kvmppc_hint_smt_possible(&local_err); + goto out; } - kvmppc_hint_smt_possible(&local_err); - goto out; } } /* else TCG: nothing to do currently */ --=20 2.11.0