There is a script in the RHV for HANA Guide: https://access.redhat.com/sites/default/files/attachments/deploying_sap_hana_on_red_hat_virtualization_4.4_with_lun_pt_6tb_lm_and_cooper_lake.pdf (search for "Calculate CPU Pinning")

Greetings

Klaas

On 11/14/22 13:43, Liran Rotenberg wrote:


On Mon, Nov 14, 2022 at 11:12 AM <[email protected]> wrote:

    Hello List,

    how can I achieve the best performance with vcpu pinning in KVM?

    Is it better to have 1:1 mapping between virtual and physical
    thread like this:

        <vcpupin vcpu='0' cpuset='0'/>
        <vcpupin vcpu='1' cpuset='1'/>
        <vcpupin vcpu='2' cpuset='2'/>
        <vcpupin vcpu='3' cpuset='3'/>
        <vcpupin vcpu='4' cpuset='4'/>
        <vcpupin vcpu='5' cpuset='5'/>
        <vcpupin vcpu='6' cpuset='6'/>
        <vcpupin vcpu='7' cpuset='7'/>

    Or is it better to allow each vCPU to run on any of the limited
    number of physical threads?

    e.g.
        <vcpupin vcpu='0' cpuset='0,1,2,3,4,5,6,7'/>
        <vcpupin vcpu='1' cpuset='0,1,2,3,4,5,6,7'/>
        <vcpupin vcpu='2' cpuset='0,1,2,3,4,5,6,7'/>
        <vcpupin vcpu='3' cpuset='0,1,2,3,4,5,6,7'/>
        <vcpupin vcpu='4' cpuset='0,1,2,3,4,5,6,7'/>
        <vcpupin vcpu='5' cpuset='0,1,2,3,4,5,6,7'/>
        <vcpupin vcpu='6' cpuset='0,1,2,3,4,5,6,7'/>
        <vcpupin vcpu='7' cpuset='0,1,2,3,4,5,6,7'/>


    The hypervisor host has 2 CPUs. Each CPU has 8 cores and each core
    2 Threads. In total this are 32 threads.

     lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                32
    On-line CPU(s) list:   0-31
    Thread(s) per core:    2
    Core(s) per socket:    8
    Socket(s):             2
    NUMA node(s):          2
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 85
    Model name:            Intel(R) Xeon(R) Gold 6244 CPU @ 3.60GHz
    Stepping:              7
    CPU MHz:               4213.731
    CPU max MHz:           4400.0000
    CPU min MHz:           1200.0000
    BogoMIPS:              7200.00
    Virtualization:        VT-x
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              1024K
    L3 cache:              25344K
    NUMA node0 CPU(s):     0-7,16-23
    NUMA node1 CPU(s):     8-15,24-31

    I need to run 2 VMs on this host. One is for production and should
    have 24 vCPUs and the other one is for test and should have 8
    vCPUs. Test VM workload should not impact Prod VM performance.

    Current configuration is:

    TEST:

      <vcpu placement='static' current='8'>128</vcpu>
      <iothreads>1</iothreads>
      <cputune>
        <vcpupin vcpu='0' cpuset='0'/>
        <vcpupin vcpu='1' cpuset='1'/>
        <vcpupin vcpu='2' cpuset='2'/>
        <vcpupin vcpu='3' cpuset='3'/>
        <vcpupin vcpu='4' cpuset='4'/>
        <vcpupin vcpu='5' cpuset='5'/>
        <vcpupin vcpu='6' cpuset='6'/>
        <vcpupin vcpu='7' cpuset='7'/>
      </cputune>

      <cpu mode='host-passthrough' check='none'>
        <topology sockets='16' cores='4' threads='2'/>
        <numa>
          <cell id='0' cpus='0-7' memory='134217728' unit='KiB'/>
        </numa>
      </cpu>

    PROD:

      <vcpu placement='static' current='24'>192</vcpu>
      <iothreads>1</iothreads>
      <cputune>
        <vcpupin vcpu='0' cpuset='8'/>
        <vcpupin vcpu='1' cpuset='9'/>
        <vcpupin vcpu='2' cpuset='10'/>
        <vcpupin vcpu='3' cpuset='11'/>
        <vcpupin vcpu='4' cpuset='12'/>
        <vcpupin vcpu='5' cpuset='13'/>
        <vcpupin vcpu='6' cpuset='14'/>
        <vcpupin vcpu='7' cpuset='15'/>
        <vcpupin vcpu='8' cpuset='16'/>
        <vcpupin vcpu='9' cpuset='17'/>
        <vcpupin vcpu='10' cpuset='18'/>
        <vcpupin vcpu='11' cpuset='19'/>
        <vcpupin vcpu='12' cpuset='20'/>
        <vcpupin vcpu='13' cpuset='21'/>
        <vcpupin vcpu='14' cpuset='22'/>
        <vcpupin vcpu='15' cpuset='23'/>
        <vcpupin vcpu='16' cpuset='24'/>
        <vcpupin vcpu='17' cpuset='25'/>
        <vcpupin vcpu='18' cpuset='26'/>
        <vcpupin vcpu='19' cpuset='27'/>
        <vcpupin vcpu='20' cpuset='28'/>
        <vcpupin vcpu='21' cpuset='29'/>
        <vcpupin vcpu='22' cpuset='30'/>
        <vcpupin vcpu='23' cpuset='31'/>
      </cputune>

      <cpu mode='host-passthrough' check='none'>
        <topology sockets='16' cores='6' threads='2'/>
        <numa>
          <cell id='0' cpus='0-23' memory='889192448' unit='KiB'/>
        </numa>
      </cpu>

    Versions are:
    ovirt-host-4.3.5
    libvirt-5.7.0-28.el7.x86_64

Hi Martin,
The recommended approach would be to pin the CPUs into specific physical CPUs.
The most important part is to be under the same socket.
VDSM uses physical CPU 1, unless you changed the default VDSM settings, so maybe it would be better to use the second socket. You may also wish to refer to the NUMA topology (using socket 1 that would be - NUMA node1 CPU(s):     8-15,24-31).
Overall:
0#8,24_1#9,25_2#10,26 and so on.
This is also with the thought that physical cpu 8 and 24 are two threads in the same core. You can check it using VDSM API or just # cat /proc/cpuinfo. Note, that physical CPUs you use with this method are in a shared pool and can be used by other VMs. If you wish it to be exclusive to the VM, you may use the dedicated CPU feature under the VM resource allocation tab. Note, it will pin the CPUs for you.

Regards,
Liran.


    Thanks in advance,
    Martin
    _______________________________________________
    Users mailing list -- [email protected]
    To unsubscribe send an email to [email protected]
    Privacy Statement: https://www.ovirt.org/privacy-policy.html
    oVirt Code of Conduct:
    https://www.ovirt.org/community/about/community-guidelines/
    List Archives:
    
https://lists.ovirt.org/archives/list/[email protected]/message/HCNWYSIBMUY7Q3YU25KQL2MUCK42GMJ6/


_______________________________________________
Users mailing list [email protected]
To unsubscribe send an email [email protected]
Privacy Statement:https://www.ovirt.org/privacy-policy.html
oVirt Code of 
Conduct:https://www.ovirt.org/community/about/community-guidelines/
List 
Archives:https://lists.ovirt.org/archives/list/[email protected]/message/UDWR2WVOLY7SCEXQHZQJJK7RMT4HBE3B/
_______________________________________________
Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/[email protected]/message/6XPQQA3CTL5RHJRCBYFKQRYCPGTOXET6/

Reply via email to