Bug 610341

Summary: fork causes trouble for vcpu threads
Product: Red Hat Enterprise Linux 5 Reporter: RHEL Program Management <pm-rhel>
Component: kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 5.5CC: armbru, ehabkost, gcosta, kcao, kraxel, llim, michen, mkenneth, pm-eus, tburke, virt-maint, ykaul
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kvm-83-164.el5_5.14 Doc Type: Bug Fix
Doc Text:
In the kvm kernel module, some internal KVM memory slots were incorrectly being handled by copy-on-write after a fork() function call, which caused issues when qemu-kvm ran child processes. This update fixes the handling of internal KVM memory slots on fork() to avoid those issues.
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-07-29 05:49:42 UTC Type: ---
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: 606953    
Bug Blocks:    

Description RHEL Program Management 2010-07-02 06:21:56 UTC
This bug has been copied from bug #606953 and has been proposed
to be backported to 5.5 z-stream (EUS).

Comment 6 Cao, Chen 2010-07-06 10:01:12 UTC
using migrate with protocol exec

reproduced on:
# cat /sys/module/kvm/version
kvm-83-164.el5_5.13


verified on:
# cat /sys/module/kvm/version
kvm-83-164.el5_5.14


source vm command:
qemu-kvm -name 'vm1' -monitor stdio -drive file=./RHEL-Server-6.0-64.qcow2,if=ide,cache=none -m 2048 -smp 1  -redir tcp:5000::22 -vnc :1  -usbdevice tablet -rtc-td-hack -cpu qemu64,+sse2 -no-kvm-pit-reinjection -serial unix:/tmp/serial-20100621-154308-EK1X,server,nowait -no-hpet

dst vm command:
qemu-kvm -name 'vm1' -monitor stdio -drive file=./RHEL-Server-6.0-64.qcow2,if=ide,cache=none -m 2048 -smp 1  -redir tcp:5000::22 -vnc :1  -usbdevice tablet -rtc-td-hack -cpu qemu64,+sse2 -no-kvm-pit-reinjection -serial unix:/tmp/serial-20100621-154308-EK1X,server,nowait -no-hpet -incoming "exec: gzip -c -d STATEFILE.gz"


migrating command:
migrate "exec:gzip -c > STATEFILE.gz"

Comment 10 Eduardo Habkost 2010-07-23 18:53:59 UTC
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

New Contents:
Cause: On the KVM kernel module, if a process with a memory slot is COWed, the page will change its address
(despite having an elevated reference count).  This breaks internal memory
slots which have their physical addresses loaded into vmcs registers (see
the APIC access memory slot)

Consequence: Guest stops running when qemu receives a SIGCHLD signal. This happens when, for example, a netdev setup script returns.

Fix: Prevent internal KVM slot pages from being moved by fork()/COW.

Result: KVM guests don't hang anymore when a qemu-kvm child process exits.

Comment 11 Douglas Silas 2010-07-28 15:41:12 UTC
Technical note updated. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

Diffed Contents:
@@ -1,10 +1 @@
-Cause: On the KVM kernel module, if a process with a memory slot is COWed, the page will change its address
+In the kvm kernel module, some internal KVM memory slots were incorrectly being handled by copy-on-write after a fork() function call, which caused issues when qemu-kvm ran child processes. This update fixes the handling of internal KVM memory slots on fork() to avoid those issues.-(despite having an elevated reference count).  This breaks internal memory
-slots which have their physical addresses loaded into vmcs registers (see
-the APIC access memory slot)
-
-Consequence: Guest stops running when qemu receives a SIGCHLD signal. This happens when, for example, a netdev setup script returns.
-
-Fix: Prevent internal KVM slot pages from being moved by fork()/COW.
-
-Result: KVM guests don't hang anymore when a qemu-kvm child process exits.

Comment 12 errata-xmlrpc 2010-07-29 05:49:42 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/RHBA-2010-0536.html