Bug 654540 - "error : cannot set CPU affinity on process 0: Invalid argument"
"error : cannot set CPU affinity on process 0: Invalid argument"
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
5.6
Unspecified Unspecified
low Severity high
: rc
: ---
Assigned To: Jiri Denemark
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-18 02:05 EST by yanbing du
Modified: 2011-01-13 18:17 EST (History)
10 users (show)

See Also:
Fixed In Version: libvirt-0.8.2-13.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-01-13 18:17:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description yanbing du 2010-11-18 02:05:22 EST
Description of problem:
On the x3950 machine(which has 96 cpus), start or install a kvm guest by virsh command, get an error, and guest can not start or install.
The error is: "ERROR    internal error Process exited while reading console log output: libvir: error : cannot set CPU affinity on process 0: Invalid argument".
But use qemu-kvm command can start the guest well.

Version-Release number of selected component (if applicable):
# uname -r
2.6.18-232.el5
# rpm -qa|grep kvm
kvm-83-207.el5
kvm-qemu-img-83-207.el5
etherboot-roms-kvm-5.4.4-13.el5
kmod-kvm-83-207.el5
kvm-tools-83-207.el5
etherboot-zroms-kvm-5.4.4-13.el5
# rpm -q libvirt
libvirt-0.8.2-12.el5


How reproducible:
always

Steps to Reproduce:
1.Prepare a guest which can work well on other machine, copy its image file and define a new guest on the x3950 machine.
# virsh dumpxml kvm-rhels1
<domain type='kvm'>
  <name>kvm-rhels1</name>
  <uuid>d4db98bd-b684-c5b6-413e-b6d77c7a17b9</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel5.4.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'>
    <timer name='pit' tickpolicy='delay'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/kvm-rhels1'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'/>
    <interface type='network'>
      <mac address='52:54:00:c5:83:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
</domain>

2.Start the guest
# virsh start kvm-rhels1
error: Failed to start domain kvm-rhels1
error: internal error Process exited while reading console log output: libvir: error : cannot set CPU affinity on process 0: Invalid argument

3.Install a new guest on thex 3950 machine 
  # virt-install -n kvm-test -r 512 -f /var/lib/libvirt/images/rhel6-64- -s 2 -l http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.0-RC-4/6.0/Server/x86_64/os -x http://home.englab.nay.redhat.com/~nzhang/http/ks-rhel6-x86_64.cfg


Starting install...
Retrieving file .treeinfo...                                                                                                          | 1.6 kB     00:00     
Retrieving file vmlinuz...                                                                                                            | 3.6 MB     00:00     
Retrieving file initrd.img...                                                                                                         |  29 MB     00:00     
ERROR    internal error Process exited while reading console log output: libvir: error : cannot set CPU affinity on process 0: Invalid argument

Domain installation may not have been
 successful.  If it was, you can restart your domain
 by running 'virsh start kvm-test'; otherwise, please
 restart your installation.
ERROR    internal error Process exited while reading console log output: libvir: error : cannot set CPU affinity on process 0: Invalid argument
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 892, in ?
    main()
  File "/usr/sbin/virt-install", line 754, in main
    start_time, guest.start_install)
  File "/usr/sbin/virt-install", line 816, in do_install
    dom = install_func(conscb, progresscb, wait=(not wait))
  File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 541, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 633, in _do_install
    self.domain = self.conn.createLinux(install_xml, 0)
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 1277, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output: libvir: error : cannot set CPU affinity on process 0: Invalid argument


Actual results:
Guest can not start or install.

Expected results:
Can start the guest which define from xml file.
Can install a new guest use virsh command or virt-manager.

Additional info:
The guest can start by qemu-kvm command.
Searching the error info in libvirt debug src, it seems that the error related with the host CPU.
Comment 4 Jiri Denemark 2010-11-19 02:19:27 EST
https://www.redhat.com/archives/libvir-list/2010-November/msg00863.html is a starting point for a discussion on how to deal with this bug.
Comment 6 Daniel Berrange 2010-11-22 10:09:00 EST
> # virsh nodeinfo
> CPU model:           x86_64
> CPU(s):              96
> CPU frequency:       2398 MHz
> CPU socket(s):       16
> Core(s) per socket:  6
> Thread(s) per core:  1
> NUMA cell(s):        4
> Memory size:         1006708712 kB

This tells us that there are 16*6*4 CPUs == 384.

THe virsh capabilities XML meanwhile says there are 96 CPUs.

When setting the CPU affinity, we use VIR_NODEINFO_MAXCPUS(). So what's happening is that we're probably telling the kernel to run the guest on 384 CPUs, when only 96 exist. Thus -EINVAL is returned
Comment 8 Jiri Denemark 2010-11-24 12:00:38 EST
Fixed in libvirt-0.8.2-13.el5
Comment 10 yanbing du 2010-11-25 00:50:26 EST
Verified this bug.
kernel-2.6.18-233.el5
libvirt-0.8.2-14.el5
Comment 13 errata-xmlrpc 2011-01-13 18:17:28 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0060.html

Note You need to log in before you can comment on or make changes to this bug.