From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 939E14C8F for ; Tue, 27 Mar 2018 15:54:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 06:54:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,367,1517904000"; d="scan'208";a="211692516" Received: from tanjianf-mobl.ccr.corp.intel.com (HELO [10.255.24.246]) ([10.255.24.246]) by orsmga005.jf.intel.com with ESMTP; 27 Mar 2018 06:54:08 -0700 To: "Chen, Junjie J" , "maxime.coquelin@redhat.com" , "mtetsuyah@gmail.com" References: <1522166726-42025-1-git-send-email-junjie.j.chen@intel.com> <20388d18-796f-7dd5-e596-f8cc290063d0@intel.com> Cc: "dev@dpdk.org" From: "Tan, Jianfeng" Message-ID: Date: Tue, 27 Mar 2018 21:54:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Tue, 27 Mar 2018 13:54:11 -0000 On 3/27/2018 6:18 PM, Chen, Junjie J 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. > Yes, I agree this. > In this patch, it just check whether queue is setup or not and give user a chance to setup queue with dev_start, it doesn't revert the logical from previously commit. > > So the logical is change to stop creating unix socket before queue setup, what do you think about this? As you said, we partially revert this back, of delaying the unix socket creation to queue setup, which can be observed by users. So what I'm suggesting is: we still keep unix socket creation at probe. But in the new_device(), check if queues are setup or not: if yes, we just do the queue setting (vid, internal, port); if not, we will delay the queue setting until dev_start(). Thanks, Jianfeng