From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 16E9EB620 for ; Mon, 16 Feb 2015 18:11:39 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 16 Feb 2015 09:11:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,588,1418112000"; d="scan'208";a="528263260" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by orsmga003.jf.intel.com with ESMTP; 16 Feb 2015 09:02:47 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.117]) by IRSMSX107.ger.corp.intel.com ([169.254.10.35]) with mapi id 14.03.0195.001; Mon, 16 Feb 2015 17:11:16 +0000 From: "Ananyev, Konstantin" To: "Xie, Huawei" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 11/11] lib/librte_vhost: support dynamically registering vhost server Thread-Index: AQHQRoId5hTu1K5brkqEU3rq3CBFkpzzieJg Date: Mon, 16 Feb 2015 17:11:15 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258213EDDD2@irsmsx105.ger.corp.intel.com> References: <1423717649-11818-1-git-send-email-huawei.xie@intel.com> <1423717649-11818-12-git-send-email-huawei.xie@intel.com> In-Reply-To: <1423717649-11818-12-git-send-email-huawei.xie@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 11/11] lib/librte_vhost: support dynamically registering vhost server 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: Mon, 16 Feb 2015 17:11:40 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Huawei Xie > Sent: Thursday, February 12, 2015 5:07 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2 11/11] lib/librte_vhost: support dynamicall= y registering vhost server >=20 > * support calling rte_vhost_driver_register after rte_vhost_driver_sessio= n_start > * add mutext to protect fdset from concurrent access > * add busy flag in fdentry. this flag is set before cb and cleared after = cb is finished. >=20 > mutex lock scenario in vhost: >=20 > * event_dispatch(in rte_vhost_driver_session_start) runs in a seperate th= read, infinitely > processing vhost messages through cb(callback). > * event_dispatch acquires the lock, get the cb and its context, mark the = busy flag, > and releases the mutex. > * vserver_new_vq_conn cb calls fdset_add, which acquires the mutex and ad= d new fd into fdset. > * vserver_message_handler cb frees data context, marks remove flag to req= uest to delete > connfd(connection fd) from fdset. > * after cb returns, event_dispatch > 1. clears busy flag. > 2. if there is remove request, call fdset_del, which acquires mutex, ch= ecks busy flag, and > removes connfd from fdset. > * rte_vhost_driver_unregister(not implemented) runs in another thread, ac= quires the mutex, > calls fdset_del to remove fd(listenerfd) from fdset. Then it could free d= ata context. >=20 > The above steps ensures fd data context isn't freed when cb is using. >=20 > VM(s) should have been shutdown before rte_vhost_driver_unregister. >=20 > Signed-off-by: Huawei Xie Acked-by: Konstantin Ananyev > --- > lib/librte_vhost/vhost_user/fd_man.c | 63 ++++++++++++++++++++++= +++--- > lib/librte_vhost/vhost_user/fd_man.h | 5 ++- > lib/librte_vhost/vhost_user/vhost-net-user.c | 34 +++++++++------ > 3 files changed, 82 insertions(+), 20 deletions(-) >=20