From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B84F4935C for ; Fri, 13 Nov 2015 04:50:48 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 12 Nov 2015 19:50:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,285,1444719600"; d="scan'208";a="849482900" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 12 Nov 2015 19:50:47 -0800 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 12 Nov 2015 19:50:47 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 12 Nov 2015 19:50:47 -0800 Received: from shsmsx152.ccr.corp.intel.com ([169.254.6.193]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.88]) with mapi id 14.03.0248.002; Fri, 13 Nov 2015 11:50:45 +0800 From: "Wang, Zhihong" To: Tetsuya Mukawa , "dev@dpdk.org" , "Liu, Yuanhan" Thread-Topic: [dpdk-dev] [PATCH v3 2/2] vhost: Add VHOST PMD Thread-Index: AQHRGq4PEMLA9T3mPk2+1Znj979fCJ6YPiLwgACH6ICAAJFL0A== Date: Fri, 13 Nov 2015 03:50:44 +0000 Message-ID: <8F6C2BD409508844A0EFC19955BE0941832A14@SHSMSX152.ccr.corp.intel.com> References: <1446436737-25606-2-git-send-email-mukawa@igel.co.jp> <1447046221-20811-1-git-send-email-mukawa@igel.co.jp> <1447046221-20811-3-git-send-email-mukawa@igel.co.jp> <8F6C2BD409508844A0EFC19955BE09418328A9@SHSMSX152.ccr.corp.intel.com> <5645547D.2060409@igel.co.jp> In-Reply-To: <5645547D.2060409@igel.co.jp> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "ann.zhuangyanying@huawei.com" Subject: Re: [dpdk-dev] [PATCH v3 2/2] vhost: Add VHOST PMD X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2015 03:50:49 -0000 > -----Original Message----- > From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] > Sent: Friday, November 13, 2015 11:10 AM > To: Wang, Zhihong ; dev@dpdk.org; Liu, Yuanhan > > Cc: ann.zhuangyanying@huawei.com > Subject: Re: [dpdk-dev] [PATCH v3 2/2] vhost: Add VHOST PMD >=20 > On 2015/11/12 21:52, Wang, Zhihong wrote: > > Hi Tetsuya, > > > > In my test I created 2 vdev using "--vdev > 'eth_vhost0,iface=3D/tmp/sock0,queues=3D1' --vdev > 'eth_vhost1,iface=3D/tmp/sock1,queues=3D1'", and the qemu message got han= dled > in wrong order. > > The reason is that: 2 threads are created to handle message from 2 sock= ets, but > their fds are SHARED, so each thread are reading from both sockets. > > > > This can lead to incorrect behaviors, in my case sometimes the > VHOST_USER_SET_MEM_TABLE got handled after VRING initialization and lead = to > destroy_device(). > > > > Detailed log as shown below: thread 69351 & 69352 are both reading fd 2= 5. > Thanks Yuanhan for helping debugging! > > >=20 > Hi Zhihong and Yuanhan, >=20 > Thank you so much for debugging the issue. > I will fix vhost PMD not to create multiple message handling threads. >=20 > I am going to submit the PMD today. > Could you please check it again using latest one? >=20 Looking forward to it! > Tetsuya >=20 >=20 > > Thanks > > Zhihong > > > > > > ---------------------------------------------------------------------- > > ------------------------------------------- > > > > ----> debug: setting up new vq conn for fd: 23, tid: 69352 > > VHOST_CONFIG: new virtio connection is 25 > > VHOST_CONFIG: new device, handle is 0 > > ----> debug: vserver_message_handler thread id: 69352, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_OWNER > > ----> debug: vserver_message_handler thread id: 69352, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_GET_FEATURES > > ----> debug: vserver_message_handler thread id: 69352, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL > > VHOST_CONFIG: vring call idx:0 file:26 > > ----> debug: vserver_message_handler thread id: 69352, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL > > VHOST_CONFIG: vring call idx:1 file:27 > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL > > VHOST_CONFIG: vring call idx:0 file:28 > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL > > VHOST_CONFIG: vring call idx:1 file:26 > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_FEATURES > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_MEM_TABLE > > ----> debug: device_fh: 0: user_set_mem_table > > VHOST_CONFIG: mapped region 0 fd:27 to 0x7ff6c0000000 sz:0xa0000 > > off:0x0 > > VHOST_CONFIG: mapped region 1 fd:29 to 0x7ff680000000 sz:0x40000000 > > off:0xc0000 > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_KICK > > VHOST_CONFIG: vring kick idx:0 file:30 > > ----> debug: vserver_message_handler thread id: 69352, fd: 25 > > VHOST_CONFIG: virtio is not ready for processing. > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR > > ----> debug: vserver_message_handler thread id: 69351, fd: 25 > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_KICK > > VHOST_CONFIG: vring kick idx:1 file:31 > > VHOST_CONFIG: virtio is now ready for processing. > > PMD: New connection established > > VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM > > > > ---------------------------------------------------------------------- > > ------------------------------------------- > > > >> ... > >> + > >> +static void *vhost_driver_session(void *param __rte_unused) { > >> + static struct virtio_net_device_ops *vhost_ops; > >> + > >> + vhost_ops =3D rte_zmalloc(NULL, sizeof(*vhost_ops), 0); > >> + if (vhost_ops =3D=3D NULL) > >> + rte_panic("Can't allocate memory\n"); > >> + > >> + /* set vhost arguments */ > >> + vhost_ops->new_device =3D new_device; > >> + vhost_ops->destroy_device =3D destroy_device; > >> + if (rte_vhost_driver_pmd_callback_register(vhost_ops) < 0) > >> + rte_panic("Can't register callbacks\n"); > >> + > >> + /* start event handling */ > >> + rte_vhost_driver_session_start(); > >> + > >> + rte_free(vhost_ops); > >> + pthread_exit(0); > >> +} > >> + > >> +static void vhost_driver_session_start(struct pmd_internal > >> +*internal) { > >> + int ret; > >> + > >> + ret =3D pthread_create(&internal->session_th, > >> + NULL, vhost_driver_session, NULL); > >> + if (ret) > >> + rte_panic("Can't create a thread\n"); } > >> + > >> ...