Bug 1346430

Summary: Domain using vcpusched element fails to start on non-RT kernel
Product: Red Hat Enterprise Linux 7 Reporter: Luiz Capitulino <lcapitulino>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: atheurer, krister, mkletzan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-15 19:45:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1175463    

Description Luiz Capitulino 2016-06-14 19:31:23 UTC
Description of problem:

A domain using this vCPU placement & configuration:

  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='14'/>
    <vcpupin vcpu='1' cpuset='15'/>
    <emulatorpin cpuset='0,2,4,6'/>
    <vcpusched vcpus='0-1' scheduler='fifo' priority='1'/>
  </cputune>

Won't start on a system using the NFV profile but running the non-RT kernel:

[root@virtlab508 ~]# virsh start RHEL73-RT
error: Failed to start domain RHEL73-RT
error: Cannot set scheduler parameters for pid 161919: Operation not permitted

[root@virtlab508 ~]# 

However, it starts fine if we do one of the following:

- Run the RT kernel in the host
- Drop the vcpusched line

Version-Release number of selected component (if applicable): libvirt-1.3.4-1.el7.x86_64


How reproducible:


Steps to Reproduce:
1. Install the tuned profile-nfv in the host and isolate some cores (this step might not be needed)
2. Use the cputune and vcpusched elements to pin and assign RT priority to vCPUs
3. Try to start the guest with "virsh start"
4. Guest won't start

Comment 1 Luiz Capitulino 2016-06-14 20:07:05 UTC
Karl Rister debugged this issue some time ago and found the following:

"""
I believe I have traced it back to a cgroup partitioning issue.  Libvirt
is placing the guest process in a specific partition which does not have
any RT runtime allocated to it, by doing so and then propagating the
values through the cgroup hierarchy I am finally able to manually chrt
the vcpu pids:

root@host ~ $ virsh qemu-monitor-command master --hmp info cpus
* CPU #0: pc=0xffffffff8115ac90 thread_id=3784
  CPU #1: pc=0xffffffff8104a086 (halted) thread_id=3785
  CPU #2: pc=0xffffffff8104a086 (halted) thread_id=3786

root@host ~ $ chrt -f -p 1 3785
chrt: failed to set pid 3785's policy: Operation not permitted

root@host ~ $ chrt -f -p 1 3786
chrt: failed to set pid 3786's policy: Operation not permitted

root@host ~ $ cat /sys/fs/cgroup/cpu,cpuacct/cpu.rt_runtime_us
950000

root@host ~ $ cat
/sys/fs/cgroup/cpu,cpuacct/machine.slice/cpu.rt_runtime_us
0

root@host ~ $ echo 950000 >
/sys/fs/cgroup/cpu,cpuacct/machine.slice/cpu.rt_runtime_us

root@host ~ $ cat
/sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2dmaster.scope/cpu.rt_runtime_us

0

root@host ~ $ echo 950000 >
/sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2dmaster.scope/cpu.rt_runtime_us

root@host ~ $ cat
/sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2dmaster.scope/vcpu1/cpu.rt_runtime_us

0

root@host ~ $ echo 950000 >
/sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2dmaster.scope/vcpu1/cpu.rt_runtime_us

root@host ~ $ chrt -f -p 1 3785

root@host ~ $ cat
/sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2dmaster.scope/vcpu2/cpu.rt_runtime_us

0

root@host ~ $ echo 950000 >
/sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2dmaster.scope/vcpu2/cpu.rt_runtime_us

bash: echo: write error: Invalid argument

I have to split the available runtime...
"""

This makes sense because it seems that the RT kernel has less cgroups options enabled, so maybe it's missing a kernel config option that enforces this behavior which makes the guest work on the RT kernel.

Comment 2 Luiz Capitulino 2016-06-15 19:45:14 UTC
Harald Jensås also got this issue when debugged it down to a tuned profile setting. Closing as a dupe.

*** This bug has been marked as a duplicate of bug 1346715 ***