All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: qemu-s390x@nongnu.org
Cc: qemu-devel@nongnu.org, borntraeger@de.ibm.com,
	pasic@linux.ibm.com, richard.henderson@linaro.org,
	david@redhat.com, thuth@redhat.com, cohuck@redhat.com,
	mst@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org,
	ehabkost@redhat.com, marcel.apfelbaum@gmail.com,
	eblake@redhat.com, armbru@redhat.com, seiden@linux.ibm.com,
	nrb@linux.ibm.com, scgl@linux.ibm.com, frankja@linux.ibm.com,
	berrange@redhat.com, clg@kaod.org
Subject: [PATCH v11 02/11] s390x/cpu topology: add max_threads machine class attribute
Date: Thu,  3 Nov 2022 18:01:41 +0100	[thread overview]
Message-ID: <20221103170150.20789-3-pmorel@linux.ibm.com> (raw)
In-Reply-To: <20221103170150.20789-1-pmorel@linux.ibm.com>

The S390 CPU topology accepts the smp.threads argument while
in reality it does not effectively allow multthreading.

Let's keep this behavior for machines older than 7.3 and
refuse to use threads in newer machines until multithreading
is really proposed to the guest by the machine.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 include/hw/s390x/s390-virtio-ccw.h |  1 +
 hw/s390x/s390-virtio-ccw.c         | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h
index 8a0090a071..4f8a39abda 100644
--- a/include/hw/s390x/s390-virtio-ccw.h
+++ b/include/hw/s390x/s390-virtio-ccw.h
@@ -40,6 +40,7 @@ struct S390CcwMachineClass {
     bool cpu_model_allowed;
     bool css_migration_enabled;
     bool hpage_1m_allowed;
+    int max_threads;
 };
 
 /* runtime-instrumentation allowed by the machine */
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 567498e780..9ab91df5b1 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -85,8 +85,15 @@ out:
 static void s390_init_cpus(MachineState *machine)
 {
     MachineClass *mc = MACHINE_GET_CLASS(machine);
+    S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc);
     int i;
 
+    if (machine->smp.threads > s390mc->max_threads) {
+        error_report("S390 does not support more than %d threads.",
+                     s390mc->max_threads);
+        exit(1);
+    }
+
     /* initialize possible_cpus */
     mc->possible_cpu_arch_ids(machine);
 
@@ -731,6 +738,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
     s390mc->cpu_model_allowed = true;
     s390mc->css_migration_enabled = true;
     s390mc->hpage_1m_allowed = true;
+    s390mc->max_threads = 1;
     mc->init = ccw_init;
     mc->reset = s390_machine_reset;
     mc->block_default_type = IF_VIRTIO;
@@ -859,8 +867,11 @@ static void ccw_machine_7_1_instance_options(MachineState *machine)
 
 static void ccw_machine_7_1_class_options(MachineClass *mc)
 {
+    S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc);
+
     ccw_machine_7_2_class_options(mc);
     compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
+    s390mc->max_threads = S390_MAX_CPUS;
 }
 DEFINE_CCW_MACHINE(7_1, "7.1", false);
 
-- 
2.31.1


  parent reply	other threads:[~2022-11-03 17:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 17:01 [PATCH v11 00/11] s390x: CPU Topology Pierre Morel
2022-11-03 17:01 ` [PATCH v11 01/11] s390x: Register TYPE_S390_CCW_MACHINE properties as class properties Pierre Morel
2022-11-04  6:32   ` Thomas Huth
2022-11-04 10:16     ` Pierre Morel
2022-11-04 10:53       ` Cédric Le Goater
2022-11-04 13:58         ` Pierre Morel
2022-11-04 14:29         ` Thomas Huth
2022-11-04 14:57           ` Pierre Morel
2022-11-06 11:37             ` Thomas Huth
2022-11-07  9:52               ` Pierre Morel
2022-11-03 17:01 ` Pierre Morel [this message]
2022-11-03 17:01 ` [PATCH v11 03/11] s390x/cpu topology: core_id sets s390x CPU topology Pierre Morel
2022-11-15 11:15   ` Cédric Le Goater
2022-11-16 10:17     ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 04/11] s390x/cpu topology: reporting the CPU topology to the guest Pierre Morel
2022-11-15 11:21   ` Cédric Le Goater
2022-11-16 10:27     ` Pierre Morel
2022-11-17  8:40   ` Cédric Le Goater
2022-11-17  9:32     ` Pierre Morel
2022-11-21 14:13       ` Cédric Le Goater
2022-11-22  9:05         ` Pierre Morel
2022-11-27 10:46           ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 05/11] s390x/cpu_topology: resetting the Topology-Change-Report Pierre Morel
2022-11-03 17:01 ` [PATCH v11 06/11] s390x/cpu_topology: CPU topology migration Pierre Morel
2022-11-03 17:01 ` [PATCH v11 07/11] target/s390x: interception of PTF instruction Pierre Morel
2022-11-03 17:01 ` [PATCH v11 08/11] s390x/cpu topology: add topology_capable QEMU capability Pierre Morel
2022-11-15 13:27   ` Cédric Le Goater
2022-11-16 11:23     ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 09/11] s390x/cpu topology: add topology machine property Pierre Morel
2022-11-03 17:20   ` Cornelia Huck
2022-11-04 10:09     ` Pierre Morel
2022-11-15 13:48   ` Cédric Le Goater
2022-11-16 12:39     ` Pierre Morel
     [not found]       ` <PH0PR22MB3210864C22AD57E5B32F626991079@PH0PR22MB3210.namprd22.prod.outlook.com>
2022-11-16 13:17         ` Thank you! s390x/cpu topology Jadon
2022-11-03 17:01 ` [PATCH v11 10/11] s390x/cpu_topology: activating CPU topology Pierre Morel
2022-11-03 17:01 ` [PATCH v11 11/11] docs/s390x: document s390x cpu topology Pierre Morel

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=20221103170150.20789-3-pmorel@linux.ibm.com \
    --to=pmorel@linux.ibm.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=clg@kaod.org \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=nrb@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=scgl@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.