From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 735103792 for ; Fri, 3 Jul 2015 04:05:03 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 02 Jul 2015 19:05:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,396,1432623600"; d="scan'208";a="722120724" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by orsmga001.jf.intel.com with ESMTP; 02 Jul 2015 19:05:01 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 3 Jul 2015 10:04:58 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.146]) with mapi id 14.03.0224.002; Fri, 3 Jul 2015 10:04:56 +0800 From: "Ouyang, Changchun" To: "Xie, Huawei" , "dev@dpdk.org" Thread-Topic: [PATCH 3/3] vhost: call api to unregister vhost driver Thread-Index: AQHQtHfcPM/uRQZO70S5LVcAZLuYx53JACnw Date: Fri, 3 Jul 2015 02:04:56 +0000 Message-ID: References: <1435807983-20383-1-git-send-email-changchun.ouyang@intel.com> <1435807983-20383-4-git-send-email-changchun.ouyang@intel.com> In-Reply-To: Accept-Language: zh-CN, 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 Subject: Re: [dpdk-dev] [PATCH 3/3] vhost: call api to unregister vhost driver 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, 03 Jul 2015 02:05:03 -0000 > -----Original Message----- > From: Xie, Huawei > Sent: Friday, July 3, 2015 12:04 AM > To: Ouyang, Changchun; dev@dpdk.org > Cc: Cao, Waterman; Xu, Qian Q > Subject: Re: [PATCH 3/3] vhost: call api to unregister vhost driver >=20 > On 7/2/2015 11:33 AM, Ouyang, Changchun wrote: > > The commit will break vhost sample when it runs in second time: > > 292959c71961acde0cda6e77e737bb0a4df1559c > > > > It should call api to unregister vhost driver when sample exit/quit, > > then the socket file will be removed(by calling unlink), and thus make > > vhost sample work correctly in second time startup. > > > > Signed-off-by: Changchun Ouyang > > --- > > examples/vhost/main.c | 18 ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > > diff --git a/examples/vhost/main.c b/examples/vhost/main.c index > > 72c4773..90666b3 100644 > > --- a/examples/vhost/main.c > > +++ b/examples/vhost/main.c > > @@ -2871,6 +2871,16 @@ setup_mempool_tbl(int socket, uint32_t index, > char *pool_name, > > } > > } > > > > +/* When we receive a HUP signal, unregister vhost driver */ static > > +void sighup_handler(__rte_unused int signum) { > > + /* Unregister vhost driver. */ > > + int ret =3D rte_vhost_driver_unregister((char *)&dev_basename); > > + if (ret !=3D 0) > > + rte_exit(EXIT_FAILURE, "vhost driver unregister failure.\n"); > > + exit(0); > > +} > > > > /* > > * Main function, does initialisation and calls the per-lcore > > functions. The CUSE @@ -2887,6 +2897,8 @@ main(int argc, char *argv[]) > > uint16_t queue_id; > > static pthread_t tid; > > > > + signal(SIGINT, sighup_handler); > > + >=20 > ignor if duplciated. > sighup->sigint Make sense, will update it in v2 >=20 > > /* init EAL */ > > ret =3D rte_eal_init(argc, argv); > > if (ret < 0) > > @@ -3060,6 +3072,12 @@ main(int argc, char *argv[]) > > > > /* Start CUSE session. */ > > rte_vhost_driver_session_start(); > > + > > + /* Unregister vhost driver. */ > > + ret =3D rte_vhost_driver_unregister((char *)&dev_basename); > > + if (ret !=3D 0) > > + rte_exit(EXIT_FAILURE,"vhost driver unregister failure.\n"); > > + > > return 0; > > > > }