On Tue, Sep 28, 2021 at 11:57:44AM +0800, Yanan Wang wrote: > We are currently using maxcpus to calculate the omitted sockets > but using cpus to calculate the omitted cores/threads. This makes > cmdlines like: > -smp cpus=8,maxcpus=16 > -smp cpus=8,cores=4,maxcpus=16 > -smp cpus=8,threads=2,maxcpus=16 > work fine but the ones like: > -smp cpus=8,sockets=2,maxcpus=16 > -smp cpus=8,sockets=2,cores=4,maxcpus=16 > -smp cpus=8,sockets=2,threads=2,maxcpus=16 > break the sanity check. > > Since we require for a valid config that the product of "sockets * cores > * threads" should equal to the maxcpus, we should uniformly use maxcpus > to calculate their omitted values. > > Also the if-branch of "cpus == 0 || sockets == 0" was split into two > branches of "cpus == 0" and "sockets == 0" so that we can clearly read > that we are parsing the configuration with a preference on cpus over > sockets over cores over threads. > > Note: change in this patch won't affect any existing working cmdlines > but improves consistency and allows more incomplete configs to be valid. > > Signed-off-by: Yanan Wang <wangyana...@huawei.com> > Reviewed-by: Andrew Jones <drjo...@redhat.com> > Reviewed-by: Pankaj Gupta <pankaj.gu...@ionos.com> > --- > hw/core/machine.c | 30 +++++++++++++++--------------- > hw/i386/pc.c | 30 +++++++++++++++--------------- > 2 files changed, 30 insertions(+), 30 deletions(-)
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> 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 :|