Bug 654540 - "error : cannot set CPU affinity on process 0: Invalid argument"
Summary: "error : cannot set CPU affinity on process 0: Invalid argument"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt
Version: 5.6
Hardware: Unspecified
OS: Unspecified
low
high
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-18 07:05 UTC by yanbing du
Modified: 2011-01-13 23:17 UTC (History)
10 users (show)

Fixed In Version: libvirt-0.8.2-13.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-13 23:17:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0060 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-01-12 17:22:30 UTC

Description yanbing du 2010-11-18 07:05:22 UTC
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 07:19:27 UTC
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 Berrangé 2010-11-22 15:09:00 UTC
> # 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 17:00:38 UTC
Fixed in libvirt-0.8.2-13.el5

Comment 10 yanbing du 2010-11-25 05:50:26 UTC
Verified this bug.
kernel-2.6.18-233.el5
libvirt-0.8.2-14.el5

Comment 13 errata-xmlrpc 2011-01-13 23:17:28 UTC
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.