Re: [PATCH] doc: cpu topology values should be equal to maxmium vcpus

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

 



On 05/29/2013 11:14 AM, Eric Blake wrote:
On 05/28/2013 08:53 PM, Guannan Ren wrote:
---
  docs/formatdomain.html.in | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

There are little document about how to set values of sockets, cores, threads properly. After going through qemu code, I summarize the package/cores/threads/ algorithm
which can be verified by 'cpuid' tool.

The following only explains the case of all the four number are given in qemu commandline.
smp = n (argument to -smp)
nr_threads = smp / (cores * sockets)
nr_cores = cores

-smp 4, sockets=1,cores=4,threads=2 leads to: 1(physical cpu) *4(cores) *1(thread) One physical cpu contains four cores log processor which each contains one thread logical processor.

0 means only one physical cpu package
pkg_id = cpu_index/nr_threads/nr_cores
0         = 0 / 1 / 4
0         = 1 / 1 / 4
0         = 2 / 1 / 4
0         = 3 / 1 / 4

3 means there are four multi-cores logical processor
core_id = cpu_index/nr_threads % nr_cores
0          = 0 / 1 % 4
1          = 1 / 1 % 4
2          = 2 / 1 % 4
3          = 3 / 1 % 4

0 means only one thread logical processor
smt_id = cpu_index  % nr_threads
0         = 0 % 1
0         = 1 % 1
0         = 2 % 1
0         = 3 % 1

And the result could be verified by 'cpuid' tool running in fedora guest.
1st   vcpu: (APIC synth): PKG_ID=0 CORE_ID=0 SMT_ID=0
2nd  vcpu: (APIC synth): PKG_ID=0 CORE_ID=1 SMT_ID=0
3rd  vcpu: (APIC synth): PKG_ID=0 CORE_ID=2 SMT_ID=0
4th  vcpu: (APIC synth): PKG_ID=0 CORE_ID=3 SMT_ID=0

I tried it on several cpu topology:
-smp 16, sockets=2,cores=2,threads=1 leads to 2 * 2 * 4
There are two physical cpu package. Each of them contains two cores logical processor and
each of the cores contains four hyper-threading logical processor.
The result could be verified by cpuid tool.

If the calculation is true, I think my patch is self-acked.

Guannan


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]