Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1091206 - libvirtd crashed after hot-unplug the vcpus which is pinned to host cpus
libvirtd crashed after hot-unplug the vcpus which is pinned to host cpus
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.6
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Ján Tomko
Virtualization Bugs
: ZStream
Depends On: 1088165
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-25 04:18 EDT by Jan Kurik
Modified: 2014-05-27 12:27 EDT (History)
13 users (show)

See Also:
Fixed In Version: libvirt-0.10.2-29.el6_5.8
Doc Type: Bug Fix
Doc Text:
Cause: When unplugging a virtual CPU, libvirt kept a pointer to freed memory if the CPU was pinned. Consequence: The daemon crashed when it tried to access this memory. Fix: Remove the pointer after the memory is freed. Result: Reading pinning information after unplugging a CPU does not lead to a crash anymore.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-05-27 12:27:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2014:0560 normal SHIPPED_LIVE Moderate: libvirt security and bug fix update 2014-05-27 16:25:33 EDT

  None (edit)
Description Jan Kurik 2014-04-25 04:18:19 EDT
This bug has been copied from bug #1088165 and has been proposed
to be backported to 6.5 z-stream (EUS).
Comment 8 Xuesong Zhang 2014-05-20 02:04:03 EDT
Verify this bug with the following package version, it is fixed.

Packages version:
libvirt-0.10.2-29.el6_5.8.x86_64
qemu-kvm-0.12.1.2-2.415.el6_5.9.x86_64
kernel-2.6.32-431.20.2.el6.x86_64


Steps:
1. start one, guest, which contains 2 vcpus.
# virsh start rhel6.5
Domain rhel6.5 started

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

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

# virsh dumpxml rhel6.5|grep cpu
  <vcpu placement='static' current='2'>4</vcpu>
  <cputune>
    <vcpupin vcpu='1' cpuset='0,3'/>
  </cputune>

3. hot-unplug the last vcpu from guest
# virsh setvcpus rhel6.5 1

# virsh dumpxml rhel6.5|grep cpu
  <vcpu placement='static' current='1'>4</vcpu>

4. check the libvirtd service status, it is working well. No dead.
# service libvirtd status
libvirtd (pid  2272) is running...
Comment 9 Xuesong Zhang 2014-05-21 02:28:17 EDT
(In reply to Zhang Xuesong from comment #8)
> Verify this bug with the following package version, it is fixed.
> 
> Packages version:
> libvirt-0.10.2-29.el6_5.8.x86_64
> qemu-kvm-0.12.1.2-2.415.el6_5.9.x86_64
> kernel-2.6.32-431.20.2.el6.x86_64
> 
> 
> Steps:
> 1. start one, guest, which contains 2 vcpus.
> # virsh start rhel6.5
> Domain rhel6.5 started
> 
> # virsh dumpxml rhel6.5|grep cpu
>   <vcpu placement='static' current='2'>4</vcpu>
> 
> 2. pin the 2nd vcpu to host cpus
> # virsh vcpupin rhel6.5 1 0,3
> 
> # virsh dumpxml rhel6.5|grep cpu
>   <vcpu placement='static' current='2'>4</vcpu>
>   <cputune>
>     <vcpupin vcpu='1' cpuset='0,3'/>
>   </cputune>
> 

Checking in the guest, and make sure the vcpu number in guest is right.
Login the guest, and check the vcpuinfo, 
# cat /proc/cpuinfo |grep processor |wc -l
2

> 3. hot-unplug the last vcpu from guest
> # virsh setvcpus rhel6.5 1
> 
> # virsh dumpxml rhel6.5|grep cpu
>   <vcpu placement='static' current='1'>4</vcpu>

After hot-unplug. login the guest, and check the vcpuinfo, 
# cat /proc/cpuinfo |grep processor |wc -l
1


> 
> 4. check the libvirtd service status, it is working well. No dead.
> # service libvirtd status
> libvirtd (pid  2272) is running...


Ad-hoc testing some other related testing, all of them are working well:
1. check the cpu-stats, vcpuinfo, vcpupin, vcpucount, all of them are working well. 
# virsh cpu-stats rhel6.5
CPU0:
	cpu_time            17.710181082 seconds
	vcpu_time           12.951564011 seconds
CPU1:
	cpu_time             8.207106669 seconds
	vcpu_time            2.712824892 seconds
CPU2:
	cpu_time            16.484833647 seconds
	vcpu_time            8.101443002 seconds
CPU3:
	cpu_time            10.336857805 seconds
	vcpu_time            5.647272634 seconds
Total:
	cpu_time            52.738979203 seconds
	user_time            3.550000000 seconds
	system_time         17.980000000 seconds

# virsh vcpuinfo rhel6.5
VCPU:           0
CPU:            2
State:          running
CPU time:       29.4s
CPU Affinity:   yyyy

# virsh vcpupin rhel6.5
VCPU: CPU Affinity
----------------------------------
   0: 0-3

# virsh vcpucount rhel6.5
maximum      config         4
maximum      live           4
current      config         2
current      live           1


2. Hot-plug vcpus, the vcpu number in vcpucount is working well.
# virsh setvcpus rhel6.5 2

# virsh vcpucount rhel6.5
maximum      config         4
maximum      live           4
current      config         2
current      live           2

3. check in the guest, the vcpu number is increased as expected.
# cat /proc/cpuinfo |grep processor |wc -l
2


4. hot-unplug vcpus, the vcpu number in vcpucount is working well.
# virsh setvcpus rhel6.5 1

# virsh vcpucount rhel6.5
maximum      config         4
maximum      live           4
current      config         2
current      live           1

5. check in the guest, the vcpu number is decreased as expected.
# cat /proc/cpuinfo |grep processor |wc -l
1
Comment 11 errata-xmlrpc 2014-05-27 12:27:07 EDT
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/RHSA-2014-0560.html

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