On Thu, Jan 05, 2023 at 03:53:10PM +0100, Pierre Morel wrote: > The modification of the CPU attributes are done through a monitor > commands. > > It allows to move the core inside the topology tree to optimise > the cache usage in the case the host's hypervizor previously > moved the CPU. > > The same command allows to modifiy 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. > > Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx> > --- > qapi/machine-target.json | 29 ++++++++ > include/monitor/hmp.h | 1 + > hw/s390x/cpu-topology.c | 141 +++++++++++++++++++++++++++++++++++++++ > hmp-commands.hx | 16 +++++ > 4 files changed, 187 insertions(+) > > diff --git a/qapi/machine-target.json b/qapi/machine-target.json > index 2e267fa458..75b0aa254d 100644 > --- a/qapi/machine-target.json > +++ b/qapi/machine-target.json > @@ -342,3 +342,32 @@ > 'TARGET_S390X', > 'TARGET_MIPS', > 'TARGET_LOONGARCH64' ] } } > + > +## > +# @change-topology: > +# > +# @core: the vCPU ID to be moved > +# @socket: the destination socket where to move the vCPU > +# @book: the destination book where to move the vCPU > +# @drawer: the destination drawer where to move the vCPU This movement can be done while the guest OS is running ? What happens to guest OS apps ? Every I know will read topology once and assume it never changes at runtime. What's the use case for wanting to re-arrange topology in this manner ? It feels like its going to be a recipe for hard to diagnose problems, as much code in libvirt and apps above will assuming the vCPU IDs are assigned sequentially starting from node=0,book=0,drawer=0,socket=0,core=0, incrementing core, then incrementing socket, then incrementing drawer, etc. > +# @polarity: optional polarity, default is last polarity set by the guest > +# @dedicated: optional, if the vCPU is dedicated to a real CPU > +# > +# Modifies the topology by moving the CPU inside the topology > +# tree or by changing a modifier attribute of a CPU. > +# > +# Returns: Nothing on success, the reason on failure. > +# > +# Since: <next qemu stable release, eg. 1.0> > +## > +{ 'command': 'change-topology', 'set-cpu-topology' > + 'data': { > + 'core': 'int', > + 'socket': 'int', > + 'book': 'int', > + 'drawer': 'int', > + '*polarity': 'int', > + '*dedicated': 'bool' > + }, > + 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] } > +} With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|