CPU Topology confusion

Satish Patel satish.txt at gmail.com
Fri Mar 6 03:01:00 UTC 2020


I am running CentOS 7.6 and it doesn't have RPM available for 4.x
release i have to compile it or try to install fedora one. Let me tell
you why i am doing all these exercise.

We are planning to run Erlang (mongooseIM) application on openstack
instance, before i move to production i started doing some
load-testing on openstack vm and this is what i did.

- I have HP Gen9 server which has 40 core CPU (with HT) so i add this
machine in openstack and reserve 8 cpu for host using vcpu_pin_set.
- I have created 32 vcpu core virtual machine on this compute node
with --property hw:numa_nodes=2 option and also added dedicated and
hugepage properties for best performance
- In lstopo command i can see two numa with 2 socket / 8 core / 2
thread per numa topology on my guest VM
- I have installed erlang (mongooseIM) application and start
load-testing and found very very poor result (i would say worst)
- For experiment i told erlang to bind all process to numa0 (0-16
vcpu) and found benchmark result was good much better.
- Problem is if i run erlang on single numa then i am wasting my CPU
core for second numa (i want to utilize all CPU to get best
performance)
- For experiment i have disable hyperthreading on openstack compute
node and build new VM with hw:numa_node=2 option and found best result
in benchmark.

Now question is why erlang doesn't like dual numa openstack vm with HT
enable, it seems erlang looking at CPU Topology and something is
missing or broken in TOPOLOGY of kvm when trying to utilize both numa
and result poor performance.

last few days i am trying to solve this mystery and even i contact
erlang developer but didn't get any help.

On Thu, Mar 5, 2020 at 8:15 PM Eddie Yen <missile0407 at gmail.com> wrote:
>
> Hi Satish,
>
> Using host-passthrough on KVM is not only passthrough the physical
> host CPU model, but will also "try" passthrough the same CPU flags.
> That means the vcpu will contain the flags same as host CPU, but it
> still depends on how KVM can support. In other words, KVM will only
> set the flags what the host CPU have and what KVM itself can support.
>
> Since QEMU has released to 4.2.0, perhaps you can try the latest
> version and doing the pure KVM running to see if it bring up the
> performance and consider upgrade KVM on compute nodes.
>
> Satish Patel <satish.txt at gmail.com> 於 2020年3月6日 週五 上午1:11寫道:
>>
>> Eddie,
>>
>> I have tried everything to match or fix CPU Topology layout but its
>> never come down to correct as i mentioned in screenshot, I have check
>> on Alicloud and they are also running KVM and their virtual machine
>> lstopo output is really match with physical machine, like L1i / L1d
>> cache layout etc.
>>
>> if you look at following output its strange i am using "-cpu host"
>> option but still there are lots of missing flags on my virtual machine
>> cpuinfo, is that normal?
>>
>> This is my VM output (virtual machine)
>>
>> # grep flags /proc/cpuinfo | uniq
>> flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
>> pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm
>> constant_tsc arch_perfmon rep_good nopl xtopology eagerfpu pni
>> pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt
>> tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm
>> arat fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
>>
>> This is compute machine (physical host)
>>
>> # grep flags /proc/cpuinfo | uniq
>> flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
>> pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
>> pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
>> xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
>> ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1
>> sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c
>> rdrand lahf_lm abm epb invpcid_single intel_ppin ssbd ibrs ibpb stibp
>> tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2
>> smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm ida
>> arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
>>
>> On Thu, Mar 5, 2020 at 11:26 AM Eddie Yen <missile0407 at gmail.com> wrote:
>> >
>> > Hi Satish,
>> >
>> > Since you already set "cpu_mode = host-passthrough", there's no need
>> > to set cpu_model.
>> >
>> > BTW, we're not known about the CPU topology a lot. But IME we always
>> > set "hw_cpu_sockets = 2" in specified image or flavor metadata if running
>> > Windows instance. In default, KVM always allocate all vcpus into sockets
>> > in CPU topology, and this will affect the Windows VM performance since
>> > Windows only support maximum 2 CPU sockets.
>> >
>> > Perhaps you can try limit socket numbers by setting hw_cpu_sockets in
>> > image metadata (or hw:cpu_sockets in flavor metadata.)
>> >
>> > Satish Patel <satish.txt at gmail.com> 於 2020年3月5日 週四 下午10:46寫道:
>> >>
>> >>
>> >> cpu_mode = cpu-passthrough
>> >> cpu_model = none
>> >>
>> >> Do you think cpu_model make difference ?
>> >>
>> >>
>> >> Sent from my iPhone
>> >>
>> >> On Mar 5, 2020, at 7:18 AM, Satish Patel<satish.txt at gmail.com> wrote:
>> >>
>> >> 
>> >>
>> >> cpu-passthrough
>> >>
>> >> Sent from my iPhone
>> >>
>> >> On Mar 4, 2020, at 9:24 PM, rui zang <rui.zang at yandex.com> wrote:
>> >>
>> >> 
>> >> Hi,
>> >>
>> >> What is the value for the "cpu_mode" configuration option?
>> >> https://docs.openstack.org/mitaka/config-reference/compute/hypervisor-kvm.html
>> >>
>> >> Thanks,
>> >> Zang, Rui
>> >>
>> >>
>> >> 05.03.2020, 01:24, "Satish Patel" <satish.txt at gmail.com>:
>> >>
>> >> Folks,
>> >>
>> >> We are running openstack with KVM and i have noticed kvm presenting
>> >> wrong CPU Tolopoly to VM and because of that we are seeing bad
>> >> performance to our application.
>> >>
>> >> This is openstack compute:
>> >>
>> >> # lstopo-no-graphics --no-io
>> >> Machine (64GB total)
>> >>   NUMANode L#0 (P#0 32GB) + Package L#0 + L3 L#0 (25MB)
>> >>     L2 L#0 (256KB) + L1d L#0 (32KB) + L1i L#0 (32KB) + Core L#0
>> >>       PU L#0 (P#0)
>> >>       PU L#1 (P#20)
>> >>     L2 L#1 (256KB) + L1d L#1 (32KB) + L1i L#1 (32KB) + Core L#1
>> >>       PU L#2 (P#1)
>> >>       PU L#3 (P#21)
>> >>
>> >> This is VM running on above compute
>> >>
>> >> # lstopo-no-graphics --no-io
>> >> Machine (59GB total)
>> >>   NUMANode L#0 (P#0 29GB) + Package L#0 + L3 L#0 (16MB)
>> >>     L2 L#0 (4096KB) + Core L#0
>> >>       L1d L#0 (32KB) + L1i L#0 (32KB) + PU L#0 (P#0)
>> >>       L1d L#1 (32KB) + L1i L#1 (32KB) + PU L#1 (P#1)
>> >>     L2 L#1 (4096KB) + Core L#1
>> >>       L1d L#2 (32KB) + L1i L#2 (32KB) + PU L#2 (P#2)
>> >>       L1d L#3 (32KB) + L1i L#3 (32KB) + PU L#3 (P#3)
>> >>
>> >> if you noticed P#0 and P#1 has own (32KB) cache per thread that is
>> >> wrong presentation if you compare with physical CPU.
>> >>
>> >> This is a screenshot of AWS vs Openstack CPU Topology and looking at
>> >> openstack its presentation is little odd, is that normal?
>> >>
>> >> https://imgur.com/a/2sPwJVC
>> >>
>> >> I am running CentOS7.6 with kvm 2.12 version.
>> >>



More information about the openstack-discuss mailing list