Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-7536

Cpu affinity info from vcpuinfo and vcpupin are different after host cpu back online

    • None
    • Moderate
    • rhel-sst-virtualization
    • ssg_virtualization
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • If docs needed, set a value
    • None

      Description of problem:Make the host cpu offline, check the cpu affinity with virsh vcpuinfo and virsh cpupin. Then make the host cpu online and check cpu affinity again, find cpu affinity from vcpuinfo remains same as cpu offline, even destroy and start the guest again the cpu affinity info from vcpuinfo remains unchanged. But cpu affinity from virsh vcpupin would vary according to cpu online status.

      Version-Release number of selected component (if applicable):

      1. rpm -q libvirt qemu-kvm
        libvirt-8.0.0-19.module+el8.8.0+18453+e0bf0d1d.x86_64
        qemu-kvm-6.2.0-32.module+el8.8.0+18361+9f407f6e.x86_64

      How reproducible:
      100%

      Steps to Reproduce:
      1 Start a guest vm with below vcpu setting:
      <vcpu placement='static'>2</vcpu>

      2 Check the cpu affinity with vcpuinfo and vcpupin

      1. virsh vcpuinfo vm1
        VCPU: 0
        CPU: 12
        State: running
        CPU time: 19.7s
        CPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      VCPU: 1
      CPU: 44
      State: running
      CPU time: 13.6s
      CPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      1. virsh vcpupin vm1
        VCPU CPU Affinity
        ----------------------
        0 0-47
        1 0-47

      3 Make one host cpu offline

      1. echo 0 > /sys/devices/system/cpu/cpu2/online

      4 Check the cpu affinity with vcpuinfo and vcpupin again

      1. virsh vcpuinfo vm1
        VCPU: 0
        CPU: 12
        State: running
        CPU time: 19.8s
        CPU Affinity: yy-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      VCPU: 1
      CPU: 44
      State: running
      CPU time: 13.7s
      CPU Affinity: yy-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      1. virsh vcpupin vm1
        VCPU CPU Affinity
        ----------------------
        0 0-1,3-47
        1 0-1,3-47

      5 Check the cgroup cpuset.cpus

      1. cat /sys/fs/cgroup/cpuset/cpuset.cpus
        0-1,3-47
      2. cat /sys/fs/cgroup/cpuset/machine.slice/cpuset.cpus
        0-1,3-47
      3. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d1
        x2dvm1.scope/cpuset.cpus
        0-1,3-47
      4. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d1
        x2dvm1.scope/libvirt/cpuset.cpus
        0-1,3-47
      5. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d1
        x2dvm1.scope/libvirt/emulator/cpuset.cpus
        0-1,3-47
      6. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d1
        x2dvm1.scope/libvirt/vcpu*/cpuset.cpus
        0-1,3-47
        0-1,3-47

      6 Make the cpu back online

      1. echo 1 > /sys/devices/system/cpu/cpu2/online

      7 Check the cpu affinity with vcpuinfo and vcpupin

      1. virsh vcpuinfo vm1
        VCPU: 0
        CPU: 12
        State: running
        CPU time: 19.8s
        CPU Affinity: yy-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      VCPU: 1
      CPU: 44
      State: running
      CPU time: 13.8s
      CPU Affinity: yy-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      1. virsh vcpupin vm1
        VCPU CPU Affinity
        ----------------------
        0 0-47
        1 0-47

      7 Destroy and start the guest

      1. virsh destroy vm1
        Domain 'vm1' destroyed
      1. virsh start vm1
        Domain 'vm1' started

      8 Check the cpu affinity with vcpuinfo and vcpupin

      1. virsh vcpuinfo vm1
        VCPU: 0
        CPU: 35
        State: running
        CPU time: 1.8s
        CPU Affinity: yy-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      VCPU: 1
      CPU: 9
      State: running
      CPU Affinity: yy-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

      1. virsh vcpupin vm1
        VCPU CPU Affinity
        ----------------------
        0 0-47
        1 0-47

      9 Check cgroup cpuset.cpus

      1. cat /sys/fs/cgroup/cpuset/cpuset.cpus
        0-47
      2. cat /sys/fs/cgroup/cpuset/machine.slice/cpuset.cpus
        0-1,3-47
      3. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d2
        x2dvm1.scope/cpuset.cpus
        0-1,3-47
      4. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d2
        x2dvm1.scope/libvirt/cpuset.cpus
        0-1,3-47
      5. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d2
        x2dvm1.scope/libvirt/emulator/cpuset.cpus
        0-1,3-47
      6. cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2d2
        x2dvm1.scope/libvirt/vcpu*/cpuset.cpus
        0-1,3-47
        0-1,3-47

      Actual results:
      Cpu affinity info from vcpuinfo and vcpupin are different after cpu back online

      Expected results:
      Cpu affinity info from vcpuinfo and vcpupin should be same

      Additional info:
      1 This issue can not be reproduced on rhel9.2 and rhel9.3(cgroupv2)
      2 virsh emulatorpin has the same behavior with vcpupin

              mkletzan@redhat.com Martin Kletzander
              lcong@redhat.com Liang Cong
              Martin Kletzander Martin Kletzander
              Han Han Han Han
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: