qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v25 02/21] CPU topology: extend with s390 specifics


From: Markus Armbruster
Subject: Re: [PATCH v25 02/21] CPU topology: extend with s390 specifics
Date: Thu, 12 Oct 2023 13:02:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Nina Schoetterl-Glausch <nsg@linux.ibm.com> writes:

> From: Pierre Morel <pmorel@linux.ibm.com>
>
> S390 adds two new SMP levels, drawers and books to the CPU
> topology.
> S390 CPUs have specific topology features like dedication and
> entitlement. These indicate to the guest information on host
> vCPU scheduling and help the guest make better scheduling decisions.
>
> Let us provide the SMP properties with books and drawers levels
> and S390 CPU with dedication and entitlement,

This is vague.  Peeking at the patch, I can see it adds properties
"socket-id", "book-id", "drawer-id", "dedicated", and "entitlement" to
"s390x-cpu" objects.  Suggest to spell that out here.

> Add machine-common.json so we can later include it in
> machine-target.json also.
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Co-developed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> ---
>  MAINTAINERS                         |  1 +
>  qapi/machine-common.json            | 21 +++++++++++++
>  qapi/machine.json                   | 17 +++++++++-
>  qapi/qapi-schema.json               |  1 +
>  include/hw/boards.h                 | 10 +++++-
>  include/hw/qdev-properties-system.h |  4 +++
>  target/s390x/cpu.h                  |  6 ++++
>  hw/core/machine-smp.c               | 48 ++++++++++++++++++++++++-----
>  hw/core/machine.c                   |  4 +++
>  hw/core/qdev-properties-system.c    | 13 ++++++++
>  hw/s390x/s390-virtio-ccw.c          |  4 +++
>  softmmu/vl.c                        |  6 ++++
>  target/s390x/cpu.c                  |  7 +++++
>  qapi/meson.build                    |  1 +
>  qemu-options.hx                     |  7 +++--
>  15 files changed, 139 insertions(+), 11 deletions(-)
>  create mode 100644 qapi/machine-common.json
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 81625f036b..3f6888aa86 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1775,6 +1775,7 @@ F: hw/core/null-machine.c
>  F: hw/core/numa.c
>  F: hw/cpu/cluster.c
>  F: qapi/machine.json
> +F: qapi/machine-common.json
>  F: qapi/machine-target.json
>  F: include/hw/boards.h
>  F: include/hw/core/cpu.h
> diff --git a/qapi/machine-common.json b/qapi/machine-common.json
> new file mode 100644
> index 0000000000..fa6bd71d12
> --- /dev/null
> +++ b/qapi/machine-common.json
> @@ -0,0 +1,21 @@
> +# -*- Mode: Python -*-
> +# vim: filetype=python
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the COPYING file in the top-level directory.
> +
> +##
> +# = Machines S390 data types
> +##
> +
> +##
> +# @CpuS390Entitlement:
> +#
> +# An enumeration of CPU entitlements that can be assumed by a virtual
> +# S390 CPU
> +#
> +# Since: 8.2
> +##
> +{ 'enum': 'CpuS390Entitlement',
> +  'prefix': 'S390_CPU_ENTITLEMENT',
> +  'data': [ 'auto', 'low', 'medium', 'high' ] }
> diff --git a/qapi/machine.json b/qapi/machine.json
> index 40b835e28e..7aacd26af0 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -9,6 +9,7 @@
>  ##
>  
>  { 'include': 'common.json' }
> +{ 'include': 'machine-common.json' }
>  
>  ##
>  # @SysEmuTarget:
> @@ -904,7 +905,13 @@
>  #
>  # @node-id: NUMA node ID the CPU belongs to
>  #
> -# @socket-id: socket number within node/board the CPU belongs to
> +# @drawer-id: drawer number within node/board the CPU belongs to
> +#     (since 8.2)
> +#
> +# @book-id: book number within drawer/node/board the CPU belongs to
> +#     (since 8.2)
> +#
> +# @socket-id: socket number within book/node/board the CPU belongs to
>  #
>  # @die-id: die number within socket the CPU belongs to (since 4.1)
>  #
   # @cluster-id: cluster number within die the CPU belongs to (since
   #     7.1)
   #
   # @core-id: core number within cluster the CPU belongs to
   #
   # @thread-id: thread number within core the CPU belongs to

So...

* A thread can only be within a core

* A core can only be within a cluster

* A cluster can only be within a die

* A die can only be within a socket

* A socket can be within a book, node, or board

* A book can be within a drawer, node, or board

* A drawer can be within a node, or board

* A node is a NUMA node

* A board is what exactly?  can we have more than one?  is node always
  within a/the board?

Asked differently: what are the possible hierarchies of things?

> @@ -923,6 +930,8 @@
>  { 'struct': 'CpuInstanceProperties',
>    # Keep these in sync with the properties device_add accepts
>    'data': { '*node-id': 'int',
> +            '*drawer-id': 'int',
> +            '*book-id': 'int',
>              '*socket-id': 'int',
>              '*die-id': 'int',
>              '*cluster-id': 'int',
> @@ -1481,6 +1490,10 @@
>  #
>  # @cpus: number of virtual CPUs in the virtual machine
>  #
> +# @drawers: number of drawers in the CPU topology (since 8.2)
> +#
> +# @books: number of books in the CPU topology (since 8.2)
> +#
>  # @sockets: number of sockets in the CPU topology

Total numer of sockets?  Or number of sockets per whatever thing
contains sockets?

Same question for @books, @drawers, and @cpus.

The documentation is less than clear before your patch; your patch
merely makes me look at it.  We may decide that addressing the lack of
clarity is not your patch's job, and leave it for later.

>  #
>  # @dies: number of dies per socket in the CPU topology
> @@ -1499,6 +1512,8 @@
>  ##
>  { 'struct': 'SMPConfiguration', 'data': {
>       '*cpus': 'int',
> +     '*drawers': 'int',
> +     '*books': 'int',
>       '*sockets': 'int',
>       '*dies': 'int',
>       '*clusters': 'int',
> diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
> index 6594afba31..c01ec335e6 100644
> --- a/qapi/qapi-schema.json
> +++ b/qapi/qapi-schema.json
> @@ -66,6 +66,7 @@
>  { 'include': 'introspect.json' }
>  { 'include': 'qom.json' }
>  { 'include': 'qdev.json' }
> +{ 'include': 'machine-common.json' }
>  { 'include': 'machine.json' }
>  { 'include': 'machine-target.json' }
>  { 'include': 'replay.json' }

[...]

> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index df167493c3..74405beb51 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -31,6 +31,7 @@
>  #include "qapi/qapi-types-machine.h"
>  #include "sysemu/hw_accel.h"
>  #include "hw/qdev-properties.h"
> +#include "hw/qdev-properties-system.h"
>  #include "fpu/softfloat-helpers.h"
>  #include "disas/capstone.h"
>  #include "sysemu/tcg.h"
> @@ -292,6 +293,12 @@ static gchar *s390_gdb_arch_name(CPUState *cs)
>  static Property s390x_cpu_properties[] = {
>  #if !defined(CONFIG_USER_ONLY)
>      DEFINE_PROP_UINT32("core-id", S390CPU, env.core_id, 0),
> +    DEFINE_PROP_INT32("socket-id", S390CPU, env.socket_id, -1),
> +    DEFINE_PROP_INT32("book-id", S390CPU, env.book_id, -1),
> +    DEFINE_PROP_INT32("drawer-id", S390CPU, env.drawer_id, -1),
> +    DEFINE_PROP_BOOL("dedicated", S390CPU, env.dedicated, false),
> +    DEFINE_PROP_CPUS390ENTITLEMENT("entitlement", S390CPU, env.entitlement,
> +                                   S390_CPU_ENTITLEMENT_AUTO),
>  #endif
>      DEFINE_PROP_END_OF_LIST()
>  };

[...]

I suspect the patch could be split into a part that updates
CpuInstanceProperties and SMPConfiguration, and a part that adds the
properties.  Since the series is at v25, I'm *not* asking you explore
that.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]