From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id A7DD82C58 for ; Tue, 27 Mar 2018 12:18:55 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 03:18:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,366,1517904000"; d="scan'208";a="28780359" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 27 Mar 2018 03:18:53 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 27 Mar 2018 03:18:53 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.166]) by shsmsx102.ccr.corp.intel.com ([169.254.2.80]) with mapi id 14.03.0319.002; Tue, 27 Mar 2018 18:18:51 +0800 From: "Chen, Junjie J" To: "Tan, Jianfeng" , "maxime.coquelin@redhat.com" , "mtetsuyah@gmail.com" CC: "dev@dpdk.org" Thread-Topic: [PATCH] net/vhost: fix segfault when creating vdev dynamically Thread-Index: AQHTxaVqK0TRGPuZ3E2cc4yFY55MuqPjQbQAgACG9mD//3z3gIAAhwbQ//+B3ICAAIxv4A== Date: Tue, 27 Mar 2018 10:18:50 +0000 Message-ID: References: <1522166726-42025-1-git-send-email-junjie.j.chen@intel.com> <20388d18-796f-7dd5-e596-f8cc290063d0@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODNiYjJjZDQtMjU3Yy00YTJjLTgzODUtNWQwNDg0OWZlZGRjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJIeVZuTlwvYlZLUjJhdlVZOUVCanNsNjJHM1EzbFhJMG9oalp4ZEI0eEJkbXVVaEVOZE1sY0xmTXpHQzVKdlc4VyJ9 x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 10:18:56 -0000 >=20 > 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 q= ueue. > >>>> 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_st= art()." > >>> 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 s= ince > 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. >=20 > 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 cr= eated* > 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.=20 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 pr= eviously commit. So the logical is change to stop creating unix socket before queue setup, w= hat do you think about this?=20 >=20 > > In summary, I think the previously commit fixes the static code path an= d this > patch fixes the dynamic code path (we need to at least setup queue once).