Nina Schoetterl-Glausch <[email protected]> writes:
> From: Pierre Morel <[email protected]>
>
> The modification of the CPU attributes are done through a monitor
> command.
>
> It allows to move the core inside the topology tree to optimize
> the cache usage in the case the host's hypervisor previously
> moved the CPU.
>
> The same command allows to modify the CPU attributes modifiers
> like polarization entitlement and the dedicated attribute to notify
> the guest if the host admin modified scheduling or dedication of a vCPU.
>
> With this knowledge the guest has the possibility to optimize the
> usage of the vCPUs.
>
> The command has a feature unstable for the moment.
>
> Signed-off-by: Pierre Morel <[email protected]>
> Reviewed-by: Nina Schoetterl-Glausch <[email protected]>
> Co-developed-by: Nina Schoetterl-Glausch <[email protected]>
> Signed-off-by: Nina Schoetterl-Glausch <[email protected]>
> ---
> qapi/machine-target.json | 42 +++++++++++++
> hw/s390x/cpu-topology.c | 132 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 174 insertions(+)
>
> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
> index 93cbf1c128..3fd8390922 100644
> --- a/qapi/machine-target.json
> +++ b/qapi/machine-target.json
> @@ -4,6 +4,8 @@
> # This work is licensed under the terms of the GNU GPL, version 2 or later.
> # See the COPYING file in the top-level directory.
>
> +{ 'include': 'machine-common.json' }
> +
> ##
> # @CpuModelInfo:
> #
> @@ -375,3 +377,43 @@
> 'data': [ 'horizontal', 'vertical' ],
> 'if': 'TARGET_S390X'
> }
> +
> +##
> +# @set-cpu-topology:
> +#
> +# Modifies the topology by moving the CPU inside the topology
Imperative mood, please: Modify the topology ...
> +# tree or by changing a modifier attribute of a CPU.
Comma after tree.
> +# Absent values will not be modified.
> +#
> +# @core-id: the vCPU ID to be moved
> +#
> +# @socket-id: destination socket to move the vCPU to
> +#
> +# @book-id: destination book to move the vCPU to
> +#
> +# @drawer-id: destination drawer to move the vCPU to
> +#
> +# @entitlement: entitlement to set
> +#
> +# @dedicated: whether the provisioning of real to virtual CPU is dedicated
> +#
> +# Features:
> +#
> +# @unstable: This command may still be modified.
The conventional phrasing is "This command is experimental."
> +#
> +# Returns: Nothing on success, the reason on failure.
Scratch ", the reason on failure". You get a QMP error reply on
failure.
> +#
> +# Since: 8.2
> +##
> +{ 'command': 'set-cpu-topology',
> + 'data': {
> + 'core-id': 'uint16',
> + '*socket-id': 'uint16',
> + '*book-id': 'uint16',
> + '*drawer-id': 'uint16',
> + '*entitlement': 'CpuS390Entitlement',
> + '*dedicated': 'bool'
> + },
> + 'features': [ 'unstable' ],
> + 'if': { 'all': [ 'TARGET_S390X' , 'CONFIG_KVM' ] }
> +}
[...]