From: "Xie, Huawei" <huawei.xie@intel.com>
To: "Ouyang, Changchun" <changchun.ouyang@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 3/3] vhost: call api to unregister vhost driver
Date: Thu, 2 Jul 2015 16:04:00 +0000 [thread overview]
Message-ID: <C37D651A908B024F974696C65296B57B0F555170@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1435807983-20383-4-git-send-email-changchun.ouyang@intel.com>
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 <changchun.ouyang@intel.com>
> ---
> 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 = rte_vhost_driver_unregister((char *)&dev_basename);
> + if (ret != 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);
> +
ignor if duplciated.
sighup->sigint
> /* init EAL */
> ret = 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 = rte_vhost_driver_unregister((char *)&dev_basename);
> + if (ret != 0)
> + rte_exit(EXIT_FAILURE,"vhost driver unregister failure.\n");
> +
> return 0;
>
> }
next prev parent reply other threads:[~2015-07-02 16:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 3:33 [dpdk-dev] [PATCH 0/3] Fix vhost startup issue Ouyang Changchun
2015-07-02 3:33 ` [dpdk-dev] [PATCH 1/3] vhost: add log if fails to bind a socket Ouyang Changchun
2015-07-02 9:29 ` Xie, Huawei
2015-07-03 1:57 ` Ouyang, Changchun
2015-07-02 9:31 ` Xie, Huawei
2015-07-02 3:33 ` [dpdk-dev] [PATCH 2/3] vhost: fix the comments and log Ouyang Changchun
2015-07-02 9:25 ` Xie, Huawei
2015-07-03 1:55 ` Ouyang, Changchun
2015-07-02 9:32 ` Xie, Huawei
2015-07-02 3:33 ` [dpdk-dev] [PATCH 3/3] vhost: call api to unregister vhost driver Ouyang Changchun
2015-07-02 9:38 ` Xie, Huawei
2015-07-03 2:03 ` Ouyang, Changchun
2015-07-02 16:04 ` Xie, Huawei [this message]
2015-07-03 2:04 ` Ouyang, Changchun
2015-07-06 2:26 ` [dpdk-dev] [PATCH v2 0/3] Fix vhost startup issue Ouyang Changchun
2015-07-06 2:26 ` [dpdk-dev] [PATCH v2 1/3] vhost: add log when failing to bind a socket Ouyang Changchun
2015-07-06 2:26 ` [dpdk-dev] [PATCH v2 2/3] vhost: fix the comments and log Ouyang Changchun
2015-07-06 2:26 ` [dpdk-dev] [PATCH v2 3/3] vhost: call api to unregister vhost driver Ouyang Changchun
2015-07-06 8:09 ` [dpdk-dev] [PATCH v2 0/3] Fix vhost startup issue Xu, Qian Q
2015-07-07 2:31 ` Ouyang, Changchun
2015-07-10 14:20 ` Xie, Huawei
2015-07-17 13:13 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C37D651A908B024F974696C65296B57B0F555170@SHSMSX101.ccr.corp.intel.com \
--to=huawei.xie@intel.com \
--cc=changchun.ouyang@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).