From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linhaifeng Subject: Re: [PATCH] vhost: notify guest to fill buffer when there is no buffer Date: Mon, 9 Feb 2015 12:11:06 +0800 Message-ID: <54D8335A.4090400@huawei.com> References: <1422527404-12424-1-git-send-email-haifeng.lin@huawei.com> <54CA29F4.8080108@huawei.com> <54CA3ABF.3010203@huawei.com> <82F45D86ADE5454A95A89742C8D1410E01C9FC50@shsmsx102.ccr.corp.intel.com> <54CDC1D3.9000806@huawei.com> <82F45D86ADE5454A95A89742C8D1410E01CA1DA3@shsmsx102.ccr.corp.intel.com> <54CF6BB3.7080002@huawei.com> <54D08AFA.2030404@huawei.com> <82F45D86ADE5454A95A89742C8D1410E01CA3197@shsmsx102.ccr.corp.intel.com> <54D0926D.9010304@huawei.com> <82F45D86ADE5454A95A89742C8D1410E01CA3873@shsmsx102.ccr.corp.intel.com> <54D43CCF.1000509@huawei.com> <82F45D86ADE5454A95A89742C8D1410E01CB7717@shsmsx102.ccr.corp.intel.com> <54D593F9.4070200@huawei.com> <82F45D86ADE5454A95A89742C8D1410E01CBABBB@shsmsx102.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: "liuyongan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org" , "dev-VfR2kkLFssw@public.gmane.org" To: "Xu, Qian Q" , "Xie, Huawei" Return-path: In-Reply-To: <82F45D86ADE5454A95A89742C8D1410E01CBABBB-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On 2015/2/9 10:57, Xu, Qian Q wrote: > Haifeng,=20 > No matter mergeable =3D0 or 1, I have not met the issue that the vhost-= user crash when start VM. Have u changed the code? As you said below, vho= st-switch will notify guest after sending every packet, yes, it's the cur= rent code, and Huawei, Xie will plan to optimize it in future. Is the cra= sh caused by changing code or any other step?=20 > What do you want for the vhost-user, changing the notification mechanis= m?=20 > Thx. By the way, sth means something.=20 >=20 Yes,I have modify the code for compile errors(I replace it with memset(&m= sgh, 0, sizeof msgh)). The issue is failed to mmap(memory size not align to hugepage's size).I g= uess this is qemu's bug. In file included from /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhos= t/virtio-net.c:34: /usr/include/linux/vhost.h:33: error: expected specifier-qualifier-list b= efore =E2=80=98pid_t=E2=80=99 =3D=3D Build lib/librte_port cc1: warnings being treated as errors /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -=EF=BC=9A.c: In function =E2=80=98read_fd_message=E2=80=99: /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c:141: error: missing initializer /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c:141: error: (near initialization for =E2=80=98msgh.msg_namelen=E2= =80=99) /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c: In function =E2=80=98send_fd_message=E2=80=99: /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c:213: error: missing initializer /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c:213: error: (near initialization for =E2=80=98msgh.msg_namelen=E2= =80=99) /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c: In function =E2=80=98vserver_new_vq_conn=E2=80=99: /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c:276: error: missing initializer /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/vhost-net= -user.c:276: error: (near initialization for =E2=80=98vdev_ctx.fh=E2=80=99= ) make[5]: *** [vhost_user/vhost-net-user.o] Error 1 make[5]: *** Waiting for unfinished jobs.... cc1: warnings being treated as errors /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/virtio-ne= t-user.c: In function =E2=80=98user_set_mem_table=E2=80=99: /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/virtio-ne= t-user.c:104: error: missing initializer /mnt/sdc/linhf/dpdk-vhost-user/dpdk/lib/librte_vhost/vhost_user/virtio-ne= t-user.c:104: error: (near initialization for =E2=80=98tmp[0].mapped_addr= ess=E2=80=99) > -----Original Message----- > From: Linhaifeng [mailto:haifeng.lin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org]=20 > Sent: Saturday, February 07, 2015 12:27 PM > To: Xu, Qian Q; Xie, Huawei > Cc: lilijun; liuyongan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org; dev-VfR2kkLFssw@public.gmane.org > Subject: Re: [dpdk-dev] [PATCH] vhost: notify guest to fill buffer when= there is no buffer >=20 >=20 >=20 > On 2015/2/6 13:54, Xu, Qian Q wrote: >> Haifeng >> Are you using the latest dpdk branch with vhost-user patches? I have n= ever met the issue. >> When is the vhost sample crashed? When you start VM or when you run st= h in VM? Is your qemu 2.2? How about your memory info? Could you give mor= e details about your steps?=20 >> >> >=20 > I have knew why you never met the issue.Because vhost-switch will notif= y guest after send every packets(performance is not every well). >=20 > static inline int __attribute__((always_inline)) virtio_tx_local(struct= vhost_dev *vdev, struct rte_mbuf *m) { > ... > ret =3D rte_vhost_enqueue_burst(tdev, VIRTIO_RXQ, &m, 1/*you cant try = to fill with rx_count*/);=09 > .. >=20 > } >=20 >> >> -----Original Message----- >> From: Linhaifeng [mailto:haifeng.lin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org] >> Sent: Friday, February 06, 2015 12:02 PM >> To: Xu, Qian Q; Xie, Huawei >> Cc: lilijun; liuyongan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org; dev-VfR2kkLFssw@public.gmane.org >> Subject: Re: [dpdk-dev] [PATCH] vhost: notify guest to fill buffer=20 >> when there is no buffer >> >> >> >> On 2015/2/4 9:38, Xu, Qian Q wrote: >>> 4. Launch the VM1 and VM2 with virtio device, note: you need use qemu= version>2.1 to enable the vhost-user server's feature. Old qemu such as = 1.5,1.6 didn't support it. >>> Below is my VM1 startup command, for your reference, similar for VM2.= =20 >>> /home/qemu-2.2.0/x86_64-softmmu/qemu-system-x86_64 -name us-vhost-vm1= =20 >>> -cpu host -enable-kvm -m 2048 -object=20 >>> memory-backend-file,id=3Dmem,size=3D2048M,mem-path=3D/mnt/huge,share=3D= on=20 >>> -numa node,memdev=3Dmem -mem-prealloc -smp 2 -drive=20 >>> file=3D/home/img/dpdk1-vm1.img -chardev=20 >>> socket,id=3Dchar0,path=3D/home/dpdk-vhost/vhost-net -netdev=20 >>> type=3Dvhost-user,id=3Dmynet1,chardev=3Dchar0,vhostforce -device=20 >>> virtio-net-pci,mac=3D00:00:00:00:00:01, -nographic >>> >>> 5. Then in the VM, you can have the same operations as before, send p= acket from virtio1 to virtio2.=20 >>> >>> Pls let me know if any questions, issues.=20 >> >> Hi xie & xu >> >> When I try to start VM vhost-switch crashed. >> >> VHOST_CONFIG: read message VHOST_USER_SET_MEM_TABLE >> VHOST_CONFIG: mapped region 0 fd:19 to 0xffffffffffffffff sz:0xa0000=20 >> off:0x0 >> VHOST_CONFIG: mmap qemu guest failed. >> VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM >> VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE >> VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR >> run_dpdk_vhost.sh: line 19: 1854 Segmentation fault ${RTE_SDK}/e= xamples/vhost/build/app/vhost-switch -c 0x300 -n 4 --huge-dir /dev/hugepa= ges -m 2048 -- -p 0x1 --vm2vm 2 --mergeable 0 --zero-copy 0 >> >> >> >=20 > -- > Regards, > Haifeng >=20 >=20 > . >=20 --=20 Regards, Haifeng