Bug 1880957

Summary: testpmd crash when restarting it with vhost-user 4 queues + vIOMMU[dpdk]
Product: Red Hat Enterprise Linux 8 Reporter: Pei Zhang <pezhang>
Component: dpdkAssignee: Maxime Coquelin <maxime.coquelin>
Status: CLOSED CURRENTRELEASE QA Contact: Pei Zhang <pezhang>
Severity: high Docs Contact:
Priority: high    
Version: 8.3CC: amorenoz, chayang, jinzhao, juzhang, maxime.coquelin, ovs-qe, tredaelli
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-21 07:27:23 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 Pei Zhang 2020-09-21 09:06:11 UTC
This bug was initially created as a copy of Bug #1880299

I am copying this bug because: 



Description of problem:
Boot VM with vhost-user 4 queues, then boot testpmd as vhost-user client. Kill testpmd and start testpmd again, vhost-user connection fails to restart. This will cause both qemu and testpmd crash.

Version-Release number of selected component (if applicable):
4.18.0-237.el8.x86_64
qemu-kvm-5.1.0-7.module+el8.3.0+8099+dba2fe3e.x86_64
dpdk-19.11.3-1.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Boot VM with vhost-user 4 queues 

    <interface type="vhostuser">
      <mac address="88:66:da:5f:dd:02" />
      <source mode="server" path="/tmp/vhost-user1.sock" type="unix" />
      <model type="virtio" />
      <driver ats="on" iommu="on" name="vhost" queues="4" rx_queue_size="1024" />
      <address bus="0x6" domain="0x0000" function="0x0" slot="0x00" type="pci" />
    </interface>



2. Boot testpmd as vhost-user client

# cat testpmd_4q.sh 
testpmd \
-l 2,4,6,8,10,12,14,16,18 \
--socket-mem 1024,1024 \
-n 4  \
--vdev 'net_vhost0,iface=/tmp/vhost-user1.sock,queues=4,client=1,iommu-support=1' \
-d /usr/lib64/librte_pmd_vhost.so \
-- \
--portmask=f \
-i \
--rxd=512 --txd=512 \
--rxq=4 --txq=4 \
--nb-cores=8 \
--forward-mode=txonly

# sh testpmd_4q.sh 

3. Kill testpmd

# pkill testpmd


4. Start testpmd again

# sh testpmd.sh

5. vhost-user connection fails to restart. Both qemu and testpmd crash.

testpmd_4q.sh: line 13:  5227 Segmentation fault      (core dumped) testpmd -l 2,4,6,8,10,12,14,16,18 --socket-mem 1024,1024 -n 4 --vdev 'net_vhost0,iface=/tmp/vhost-user1.sock,queues=4,client=1,iommu-support=1' -d /usr/lib64/librte_pmd_vhost.so -- --portmask=f -i --rxd=512 --txd=512 --rxq=4 --txq=4 --nb-cores=8 --forward-mode=txonly

# dmesg
[ 3782.630934] vhost-events[5239]: segfault at 2d8 ip 00007f5dc8e171cb sp 00007f5db97f9870 error 4 in librte_vhost.so.20.0[7f5dc8e10000+4e000]
[ 3782.643491] Code: 89 40 08 e9 3f ff ff ff e8 22 bc ff ff 66 90 f3 0f 1e fa 41 57 41 56 41 55 41 54 49 89 cc 55 48 89 f5 53 48 89 fb 48 83 ec 48 <4c> 8b af d8 02 00 00 48 89 14 24 44 89 44 24 10 64 48 8b 04 25 28
[ 3784.517001] qemu-kvm[5097]: segfault at 1b0 ip 000055b8b3406540 sp 00007ffded2577f0 error 4 in qemu-kvm[55b8b304d000+a66000]
[ 3784.528225] Code: 75 10 48 8b 05 71 80 ae 00 89 c0 64 48 89 03 0f ae f0 90 48 8b 45 00 31 c9 85 d2 48 89 e7 0f 95 c1 41 b8 01 00 00 00 4c 89 e2 <48> 8b b0 b0 01 00 00 e8 64 d2 f5 ff 48 83 3c 24 00 0f 84 f9 00 00


Actual results:
vhost-user connection fails to restart. Both qemu and testpmd crash.

Expected results:
vhost-user connection should restart well. And qemu and testpmd should work well.

Additional info:
1. This issue can not be reproduced with vhost-user 2 queues. We need to test with vhost-user 4 queues to trigger.

Comment 2 Maxime Coquelin 2020-10-19 14:20:47 UTC
Adrian did the analysis in Bug #1880299.

The issue on DPDK side is that the backend assumes there will be no holes in the device's array of virtqueues pointers,
but it can happen.

Proposed fix is to allocate virtqueues up to requested virtqueue index, so that there are no holes.

Comment 3 Maxime Coquelin 2020-10-19 18:01:19 UTC
DPDK series fixing this issue has been posted upstream:
http://patches.dpdk.org/user/todo/dpdk/?series=13110

Comment 4 Pei Zhang 2021-02-01 05:19:20 UTC
Hello Maxime,

With latest rhel8.4 testing, this issue has gone, both dpdk's testpmd and VM keep working well. Could you confirm this fix from code level? Thanks a lot.


Versions:
dpdk-20.11-1.el8.x86_64
4.18.0-278.rt7.43.el8.dt4.x86_64
qemu-kvm-5.2.0-4.module+el8.4.0+9676+589043b9.x86_64
tuned-2.15.0-1.el8.noarch
libvirt-7.0.0-3.module+el8.4.0+9709+a99efd61.x86_64
python3-libvirt-6.10.0-1.module+el8.4.0+8948+a39b3f3a.x86_64
openvswitch2.13-2.13.0-86.el8fdp.x86_64

Best regards,

Pei

Comment 6 RHEL Program Management 2022-03-21 07:27:23 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.