Bug 2039210

Summary: [vDPA+DPDK]Disable SELinux will cause qemu crash with ERROR:../qom/object.c:1183:object_unref: assertion failed: (obj->ref > 0)
Product: Red Hat Enterprise Linux 9 Reporter: Pei Zhang <pezhang>
Component: qemu-kvmAssignee: Laurent Vivier <lvivier>
qemu-kvm sub component: Networking QA Contact: Pei Zhang <pezhang>
Status: CLOSED DUPLICATE Docs Contact:
Severity: high    
Priority: high CC: aadam, chayang, jasowang, jinzhao, juzhang, leiyang, lulu, virt-maint, wquan
Version: 9.0Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-15 01:47:23 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:

Description Pei Zhang 2022-01-11 09:17:33 UTC
Description of problem:
Disable SELinux on the host. Then boot VM with vhost-vdpa ports and start testpmd in VM, then hot unplug the vhost-vdpa port will cause qemu crash.

Version-Release number of selected component (if applicable):
5.14.0-39.el9.x86_64
qemu-kvm-6.2.0-2.el9.x86_64
libvirt-7.10.0-1.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Disable SElinux

# setenforce 0

# getenforce 
Permissive

2. Setup vDPA env
# modprobe vhost_vdpa
# modprobe mlx5_vdpa

# echo 1 > /sys/bus/pci/devices/0000\:3b\:00.0/sriov_numvfs
# echo 1 > /sys/bus/pci/devices/0000\:3b\:00.1/sriov_numvfs

# vdpa mgmtdev show
pci/0000:3b:00.2: 
  supported_classes net
pci/0000:3b:01.2: 
  supported_classes net

# vdpa dev add name vdpa0 mgmtdev pci/0000:3b:00.2
# vdpa dev add name vdpa1 mgmtdev pci/0000:3b:01.2

3. Boot VM with 2 vhost-vdpa ports

<interface type="vdpa">
  <mac address="18:66:da:5f:dd:22" />
  <source dev="/dev/vhost-vdpa-0" />
  <model type="virtio" />
  <address bus="0x6" domain="0x0000" function="0x0" slot="0x00" type="pci" />
</interface>
<interface type="vdpa">
  <mac address="18:66:da:5f:dd:23" />
  <source dev="/dev/vhost-vdpa-1" />
  <model type="virtio" />
  <address bus="0x7" domain="0x0000" function="0x0" slot="0x00" type="pci" />
</interface>


4. Boot testpmd in VM and stop it.

# modprobe vfio enable_unsafe_noiommu_mode=Y
# modprobe vfio-pci

# dpdk-devbind.py --bind=vfio-pci 0000:06:00.0
# dpdk-devbind.py --bind=vfio-pci 0000:07:00.0

# dpdk-testpmd -l 1,2,3 -n 4  -d /usr/lib64/librte_net_virtio.so  -- --nb-cores=2 -i --disable-rss --rxd=512 --txd=512 --rxq=1 --txq=1
testpmd> stop

5. Hot unplug a vhost-vdpa device. Qemu crash. 

# cat /tmp/rhel9.0_vdpa_nic1.xml 
<interface type="vdpa">
  <mac address="18:66:da:5f:dd:22" />
  <source dev="/dev/vhost-vdpa-0" />
  <model type="virtio" />
  <address bus="0x6" domain="0x0000" function="0x0" slot="0x00" type="pci" />
</interface>

# virsh detach-device rhel9.0 /tmp/rhel9.0_vdpa_nic1.xml

Actual results:
qemu crash.

Expected results:
Qemu should not crash.

Additional info:
1. Disable SELinux is a key step to trigger this issue. If enable SElinux, this issue cannot be triggered.  

2. Physical cards: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]

Comment 3 Laurent Vivier 2022-02-09 08:19:13 UTC
The backtrace looks really like BZ 2027208

Comment 5 Laurent Vivier 2022-02-11 17:55:24 UTC
The backtrace really looks like the one of BZ 2027208, so I think the same fix should apply.

Comment 9 Laurent Vivier 2022-02-14 12:18:26 UTC
Pei,

do you agree to close this BZ as a duplicate of BZ 2027208 ?

BZ 2027208 is easier to reproduce for me.

Thanks

Comment 10 Pei Zhang 2022-02-15 01:47:23 UTC
(In reply to Laurent Vivier from comment #9)
> Pei,
> 
> do you agree to close this BZ as a duplicate of BZ 2027208 ?
> 
> BZ 2027208 is easier to reproduce for me.
> 
> Thanks

Yes, I agree. 

Best regards,

Pei

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