From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id D579B2BB1 for ; Thu, 29 Mar 2018 14:35:36 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 642CB402314E; Thu, 29 Mar 2018 12:35:36 +0000 (UTC) Received: from [10.36.112.54] (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C5C984441; Thu, 29 Mar 2018 12:35:35 +0000 (UTC) To: "Tan, Jianfeng" , "Chen, Junjie J" , "mtetsuyah@gmail.com" Cc: "dev@dpdk.org" References: <1522166726-42025-1-git-send-email-junjie.j.chen@intel.com> <20388d18-796f-7dd5-e596-f8cc290063d0@intel.com> <45023f15-9ddd-ec64-8e06-bef74c2ca533@intel.com> From: Maxime Coquelin Message-ID: <154a606b-a225-7926-f6c0-a29e4701d36e@redhat.com> Date: Thu, 29 Mar 2018 14:35:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <45023f15-9ddd-ec64-8e06-bef74c2ca533@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 29 Mar 2018 12:35:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 29 Mar 2018 12:35:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: Re: [dpdk-dev] [PATCH] net/vhost: fix segfault when creating vdev dynamically X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2018 12:35:37 -0000 On 03/27/2018 04:01 PM, Tan, Jianfeng wrote: > > > On 3/27/2018 7:28 PM, Maxime Coquelin wrote: >> >> >> On 03/27/2018 11:42 AM, Tan, Jianfeng wrote: >>> >>> >>> On 3/27/2018 5:24 PM, Chen, Junjie J wrote: >>>>>>> On 3/28/2018 12:05 AM, Junjie Chen wrote: >>>>>>>> when creating vdev dynamically, vhost pmd driver start directly >>>>>>>> without checking TX/RX queues ready or not, and thus cause >>>>>>>> segmentation fault when vhost library accessing queues. This patch >>>>>>>> add flag to check whether queues setup or not, and add driver start >>>>>>>> call into dev_start to allow user start it after setting up queue. >>>>>>> The issue is clear now. But this patch just puts the situation >>>>>>> before below >>>>> fix: >>>>>>> "it doesn't create the actual datagram socket until you call >>>>>>> .dev_start()." >>>>>> No, if the queue exist, the datagram socket still get created in >>>>>> vhost_create >>>>> API, since the vhost_driver_register still exist in vhost_create. >>>>> >>>>> The queue can never be created, as it's still not probed. >>>> I think we need to separate this into two cases: >>>>     Statically create vdev, the datagram recreate logical is still >>>> there since queues are exist already, this patch doesn't change >>>> anything. >>>>     Dynamic create vdev, as you pointed out, queue can never be >>>> created, while this should be not valid since In normal process of >>>> creating vdev dynamically, we always need to config queues. Correct >>>> me if I'm wrong. >>> >>> My point is, either vdev is created statically or dynamically, when >>> probe(), queues are not setup yet definitely, then *the unix socket >>> will not be created* until we set up the queues and do dev_start(). >>> If the unix socket is not created, then VM cannot connect to it. >> >> FYI, I think I reproduced such an issue with the vdev statically created >> in the past, while doing some experiments. I didn't went further into >> the analysis at that time, but it looks like the issue Junjie is trying >> to address with this patch for dynamically created vdev. > > Yes, I have noticed that this issue mostly happens at dynamic case. Just > try to suggest a proper way to fix. Please check if my suggestion in > another email makes sense. Yes, it makes sense, that's the right thing to do I think. Thanks, Maxime > > Thanks, > Jianfeng > >> >> Cheers, >> Maxime >