Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1088165

Summary: libvirtd crashed after hot-unplug the vcpus which is pined to host cpus
Product: Red Hat Enterprise Linux 6 Reporter: Xuesong Zhang <xuzhang>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.6CC: dyuan, gsun, honzhang, jmiao, mkalinin, mtessun, mzhan, rbalakri, tdosek
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-34.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 04:21:16 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: 1091206    
Attachments:
Description Flags
libvirt crashed bt info none

Description Xuesong Zhang 2014-04-16 07:34:25 UTC
Description of problem:
libvirtd crashed after hot-unplug the vcpus which is pined to some host cpus.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-32.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.423.el6.x86_64
kernel-2.6.32-457.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare one shutoff guest, revise the dumpxml as following:
......
  <vcpu placement='static' current='2'>4</vcpu>
......

2. start the guest

3. check the cpu settings in the dumpxml
# virsh dumpxml rhel6.5|grep cpu
  <vcpu placement='static' current='2'>4</vcpu>

4. pin the 2nd cpu to some host cpus.
# virsh vcpupin rhel6.5 1 0,3

5. check the cpu settings in the dumpxml again, the result is as expected.
# virsh dumpxml rhel6.5|grep cpu
  <vcpu placement='static' current='2'>4</vcpu>
  <cputune>
    <vcpupin vcpu='1' cpuset='0,3'/>
  </cputune>


6. hot-unplug the vcpus
# virsh setvcpus rhel6.5 1


7. check the cpu settings in the dumpxml again, then libvirtd dead.
# virsh dumpxml rhel6.5|grep cpu
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

# service libvirtd status
libvirtd dead but pid file exists




Actual results:
As step 7

Expected results:
libvirt should not crashed, should prompt the user the hot-unplug cpus are pined to host cpus and forbid to hot-unplug it.


Addtional info:
attached is the bt info for reference.

Comment 1 Xuesong Zhang 2014-04-16 07:35:49 UTC
Created attachment 886775 [details]
libvirt crashed bt info

Comment 2 Ján Tomko 2014-04-22 12:54:04 UTC
Patch posted upstream:
https://www.redhat.com/archives/libvir-list/2014-April/msg00825.html

Comment 3 Ján Tomko 2014-04-22 14:50:46 UTC
Now pushed upstream:
commit a0a8dc695e9e20fa8b4ebe9c7ad697a4e9b3ac41
Author:     Ján Tomko <jtomko>
CommitDate: 2014-04-22 14:49:25 +0200

    Properly free vcpupin info for unplugged CPUs
    
    Remove the pointer from def->cputune.vcpupin after unplugging
    the CPU and also free the bitmap contained in the structure
    by calling virDomainVcpuPinDel instead of VIR_FREE.
    
    Introduced by commit 0df1a79.
    
    This makes virDomainLookupVcpuPin redundant.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1088165
                                 
git describe: v1.2.3-144-ga0a8dc6

Posted downstream:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2014-April/msg00455.html

Comment 6 Jincheng Miao 2014-05-04 08:05:44 UTC
The latest libvirt-0.10.2-34.el6 will not crash after hot-unplug the vcpu which is pined.

# virsh start r6
Domain r6 started

# virsh vcpupin r6
VCPU: CPU Affinity
----------------------------------
   0: 0-7
   1: 0-7

# virsh vcpupin r6 1 0,3

# virsh dumpxml r6 | grep cputune
  <cputune>
  </cputune>

# virsh dumpxml r6 | grep -1 cputune
  <vcpu placement='static' current='2'>4</vcpu>
  <cputune>
    <vcpupin vcpu='1' cpuset='0,3'/>
  </cputune>
  <os>

# virsh setvcpus r6 1

# service libvirtd status
libvirtd (pid  7850) is running...

Comment 8 errata-xmlrpc 2014-10-14 04:21:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1374.html