Bug 1432302

Summary: Memory-backend-ram is in use when try to remove it from a guest attached with memory back file and pci_dimm beforehand
Product: Red Hat Enterprise Linux 7 Reporter: Min Deng <mdeng>
Component: qemu-kvm-rhevAssignee: Igor Mammedov <imammedo>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: chayang, dgibson, imammedo, juzhang, knoel, michen, qzhang, virt-maint, yuhuang
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-06 07:13:47 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:

Description Min Deng 2017-03-15 03:27:27 UTC
Description of problem:
Memory-backend-ram is in use when try to remove it from a guest attached with memory back file and pci_dimm beforehand.
Version-Release number of selected component (if applicable):
ppc64le:
kernel-3.10.0-600.el7.ppc64le
qemu-kvm-rhev-2.8.0-6.el7.ppc64le
1:SLOF-20160223-6.gitdbbfda4.el7
x86:
kernel-3.10.0-595.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64

How reproducible:
Always
Steps to Reproduce:
1.boot up guest with following cli,
  /usr/libexec/qemu-kvm -name virt-tests-vm1 -sandbox off -machine pseries-rhel7.4.0 -nodefaults -vga std -chardev socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20151207-185515-CKlGrjUv,server,nowait -mon chardev=hmp_id_humanmonitor1,mode=readline -chardev socket,id=qmp_id_qmp1,path=/tmp/monitor-qmp1-20151207-185515-CKlGrjUv,server,nowait -mon chardev=qmp_id_qmp1,mode=control -chardev socket,id=hmp_id_catch_monitor,path=/tmp/monitor-catch_monitor-20151207-185515-CKlGrjUv,server,nowait -mon chardev=hmp_id_catch_monitor,mode=readline -chardev socket,id=serial_id_serial0,path=/tmp/serial-serial0-20151207-185515-CKlGrjUv,server,nowait -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=03,disable-legacy=off,disable-modern=on -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=rhel74-ppc64le-virtio-scsi-latest.qcow2 -device scsi-hd,id=image1,drive=drive_image1 -numa node -qmp tcp:0:4444,server,nowait -vnc :1 -rtc base=utc,clock=host,driftfix=slew -boot order=cdn,once=c,menu=off,strict=off -enable-kvm -monitor stdio -device pci-ohci,id=usb1 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -device usb-tablet,id=input2 -netdev tap,script=/etc/qemu-ifup,downscript=/etc/qemu-down,id=hostnet1,vhost=on -device virtio-net-pci,netdev=hostnet1,id=net1,mac=00:52:11:36:3f:00 -m 4G,slots=32,maxmem=40G -object memory-backend-ram,id=mem1,size=1G  -device pc-dimm,id=dimm1,memdev=mem1
2.Execute unplug operation from HMP
(qemu) device_del dimm1
(qemu) object_del mem1


Actual results:
object 'mem1' is in use, can not be removed.

Expected results:
From QE's perspective,it should be removed as well.


Additional info:
The issue won't happen when the guest was not attached memory-backend-ram and pci_dimm beforehand.
Steps,
(qemu) object_add memory-backend-ram,id=mem1,size=1G
(qemu) device_add pc-dimm,id=dimm1,memdev=mem1
(qemu) device_del dimm1
(qemu) object_del mem1

Comment 2 Yumei Huang 2017-03-16 02:15:59 UTC
In my view, this bug might be duplicate of bz1245892 [1].

[1]Bug 1245892 - hot-unhotplug guest memory fail most of the time because it is in use

Hi Igor,
Could you please help clarify ? Thanks!

Comment 3 Igor Mammedov 2017-03-16 08:29:50 UTC
memory backend is not removable until dimm it's linked to is removed, so one should not try to remove it untill 'device_del dimmX' gets confirmation (i.e. DEVICE_DELETED event) since device_del is async op and it's upto guest to decide
if it can be removed or not.

*** This bug has been marked as a duplicate of bug 1245892 ***

Comment 4 Min Deng 2017-03-22 09:56:05 UTC
(In reply to Igor Mammedov from comment #3)
> memory backend is not removable until dimm it's linked to is removed, so one
> should not try to remove it untill 'device_del dimmX' gets confirmation
> (i.e. DEVICE_DELETED event) since device_del is async op and it's upto guest
> to decide
> if it can be removed or not.
> 
> *** This bug has been marked as a duplicate of bug 1245892 ***

  Thanks for your reply.As far as QE know the implementation mechanism are different for x86 and power,if I was wrong please correct me.
  Thus the bug should not be marked as duplicated simply from QE's opinions.In case of any potential risks I just open it for further investigation on power platform.Thanks a lot.

Best Regards
Min

Comment 5 David Gibson 2017-04-06 00:26:34 UTC
Min,

Sorry for the delay.  I'm not really sure what your question is.

I think Igor is probably right and this is due to the Power variant of bug 1245892, but that is a bit difficult to confirm until we have a fix for that bug.

Comment 6 Min Deng 2017-04-06 07:13:47 UTC
(In reply to David Gibson from comment #5)
> Min,
> 
> Sorry for the delay.  I'm not really sure what your question is.
> 
> I think Igor is probably right and this is due to the Power variant of bug
> 1245892, but that is a bit difficult to confirm until we have a fix for that
> bug.

  QE get your points and close it now.
  Thanks 
  Min

*** This bug has been marked as a duplicate of bug 1245892 ***