All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv2 for-2.9] pseries: Enforce homogeneous threads-per-core
@ 2017-04-02  6:38 David Gibson
  2017-04-03  3:42 ` Bharata B Rao
  0 siblings, 1 reply; 2+ messages in thread
From: David Gibson @ 2017-04-02  6:38 UTC (permalink / raw)
  To: bharata.rao, imammedo, ehabkost
  Cc: thuth, lvivier, qemu-devel, qemu-ppc, mdroth, David Gibson

For reasons that may be useful in future, CPU core objects, as used on the
pseries machine type have their own nr-threads property, potentially
allowing cores with different numbers of threads in the same system.

If the user/management uses the values specified in query-hotpluggable-cpus
as they're expected to do, this will never matter in pratice.  But that's
not actually enforced - it's possible to manually specify a core with
a different number of threads from that in -smp.  That will confuse the
platform - most immediately, this can be used to create a CPU thread with
index above max_cpus which leads to an assertion failure in
spapr_cpu_core_realize().

For now, enforce that all cores must have the same, standard, number of
threads.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 44c26e4..35db949 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2790,6 +2790,12 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
         goto out;
     }
 
+    if (cc->nr_threads != smp_threads) {
+        error_setg(errp, "invalid nr-threads %d, must be %d",
+                   cc->nr_threads, smp_threads);
+        return;
+    }
+
     core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index);
     if (!core_slot) {
         error_setg(&local_err, "core id %d out of range", cc->core_id);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCHv2 for-2.9] pseries: Enforce homogeneous threads-per-core
  2017-04-02  6:38 [Qemu-devel] [PATCHv2 for-2.9] pseries: Enforce homogeneous threads-per-core David Gibson
@ 2017-04-03  3:42 ` Bharata B Rao
  0 siblings, 0 replies; 2+ messages in thread
From: Bharata B Rao @ 2017-04-03  3:42 UTC (permalink / raw)
  To: David Gibson
  Cc: Igor Mammedov, Eduardo Habkost, Thomas Huth, lvivier, qemu-devel,
	qemu-ppc, Michael Roth

On Sun, Apr 2, 2017 at 12:08 PM, David Gibson <david@gibson.dropbear.id.au>
wrote:

> For reasons that may be useful in future, CPU core objects, as used on the
> pseries machine type have their own nr-threads property, potentially
> allowing cores with different numbers of threads in the same system.
>
> If the user/management uses the values specified in query-hotpluggable-cpus
> as they're expected to do, this will never matter in pratice.  But that's
> not actually enforced - it's possible to manually specify a core with
> a different number of threads from that in -smp.  That will confuse the
> platform - most immediately, this can be used to create a CPU thread with
> index above max_cpus which leads to an assertion failure in
> spapr_cpu_core_realize().
>
> For now, enforce that all cores must have the same, standard, number of
> threads.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  hw/ppc/spapr.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 44c26e4..35db949 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2790,6 +2790,12 @@ static void spapr_core_pre_plug(HotplugHandler
> *hotplug_dev, DeviceState *dev,
>          goto out;
>      }
>
> +    if (cc->nr_threads != smp_threads) {
> +        error_setg(errp, "invalid nr-threads %d, must be %d",
> +                   cc->nr_threads, smp_threads);
> +        return;
> +    }
> +
>      core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id,
> &index);
>      if (!core_slot) {
>          error_setg(&local_err, "core id %d out of range", cc->core_id);
>

Reviewed-by: Bharata B Rao <bharata@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-03  3:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-02  6:38 [Qemu-devel] [PATCHv2 for-2.9] pseries: Enforce homogeneous threads-per-core David Gibson
2017-04-03  3:42 ` Bharata B Rao

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.