From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0078.outbound.protection.outlook.com [104.47.41.78]) by dpdk.org (Postfix) with ESMTP id 7F239239 for ; Tue, 24 Jul 2018 13:01:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bqcbzOP3Y+5cFcwZjpV61tsR0o4FqqA7RfxdDmIBDUA=; b=O/iMgD7D/FyJQaNTNbwKWEM+Stf6K/gDkwENRK2rZs0qYIyu/cK1GAH5fyP8JNms6wsAhs4zhwnCiM814W+c6sqsXfUTRZ1HOozJKVN+R33cPeXl5uXBekWJjmFxyzUgEUD68DR49gGA5jTUFLLgG8po1BkUzyvy0dA9/nFOT18= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by DM5PR07MB3468.namprd07.prod.outlook.com (2603:10b6:4:67::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.16; Tue, 24 Jul 2018 11:01:56 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 24 Jul 2018 16:31:32 +0530 Message-Id: <20180724110132.24560-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180717143307.5270-1-pbhagavatula@caviumnetworks.com> References: <20180717143307.5270-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MWHPR18CA0029.namprd18.prod.outlook.com (2603:10b6:320:31::15) To DM5PR07MB3468.namprd07.prod.outlook.com (2603:10b6:4:67::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0837bc9d-ef70-4ca9-cdec-08d5f154dffd X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(2017052603328)(7153060)(7193020); SRVR:DM5PR07MB3468; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 3:rf0R9XYfHDpj8J+pME1ekwP3zg6ie3zs1KDt6wRpglKOuUbKIuE+RRlXTV+VfLJyW3snl1onGzLm1Dz2M5v2d1y7IMELEgExxZLh6xAXA1p63QLMS7EPF0ug3nSgHNikfekU64h6rg/XEYPthIlOElXjWJLCAUzqZz4Q0L/dCYb8keiM0d83ePEtsGGDpZ/rVms7T/BxISqEt160xK62sCJZXQmNcr7E6jSYtM6KPnDueOPnDm9nSzQNoktJT1A+; 25:KtT/gBezSGOoAdmTsEbkz18RwpRHVL1KWGnE6uORwmeyG2gOBCQZ8R7g7pbj5i2I7oP3WbmKSBa3ksgBHc6u2ME8m2cnB189Rlspau+vno4M6uIz/9LRTa22SbDBODwrhqIkyqcUD2QpUH/Xwe9prDPa7CNgT17YphmSdb/pbqyGCb604JrDvmMCVJIfTRwm4NqhfdQPUpjFXohnIE7XrX0lfA5BqcnjnoYYocdMugtQPNMbilU42Fl0hhS2RNA4oBGv38Wm59hRW8WQMD8uKNI9E0wZc+p4mvfgYOsCLicGylNhz/iWWnYsyqazeyboU92cp3o3FKFDzu2wW5SiJQ==; 31:JeP+jJnqlkJcPHfj3+yiDk5wWfudcGKT62hHZWFnfek7MLbqXyhqZOUdvbpn9KqkSNrwudWAeA8URoydMqmjl7TvVa9Mfg2j2u9cQw4PzMUW2cZy7HJdIGmSAFuJypEwCJfMMmsDaSTioMKk5dLcK2rbVDd7MRBNAzxHyM3I9QnIMIbcv3EuAQSmGEVbOu5GJve8d09Bwy5lrHiV1iDMOX75zfwdzo06r4f2DaXNqzs= X-MS-TrafficTypeDiagnostic: DM5PR07MB3468: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 20:KaKelkUFefmmHnOumCEDi9PJUAJwagDTu9CZrtTCGThRSx+nc9OXsroRVMghnIBoZhpChvcUPFJpeowBtWNiH8PRr/ZKX33iqfBi3trMVX57Lqrva1VY8FQaKZG41IJJ7wgdlRfxRf8MbDI2SiUcOhS8CPk0hkw9EChYoj8O3qo47thBn3HES0xFmSPNugK5NMR3OTzzp8NDIfY0dv2BUygLGLW0IX7CoNstfha0M8ZeJ+Sv03ayI+3dRdNlzKoNKxE84bSLTRRf1EVntJBNJM2+fVEJ8nlBa8c1wF5DlYgzT4evY+9OBtlm+/V1f1TYxCBbNJoQvV7JfAXxOkD3Fdr6C3Z46+8yKINbArd2/IInR+o2VftcYAou0twzOyZGmdbVvS4AWRdVqhK2u+OeUlJKRD5jd7kBQIzhSlag76PL0sECKUlOZ7dA2QCf4W4Ryi9i2+cpw18Sg9w1GHmGMYAFTIQHeIL5xxVF8mpi0h8HQxs482F4CLKnOsBiVdcI7Lw8TcmACb8mKQzGjz5OjSQ54hvrby5CQ7wc6Fke/fk6umgv7qs1pLVor++rnSPIp7D1ztu1FFu0LoM0CFJyIYRAikLtU6p8jHnPwthnvjA=; 4:UCIU/9wko7Ottrjbbt+EkM0CC0LuF5H/O1+KKi/wsR9Iw2i4QeEm1O4NbKzYjiA+y8oACseZBxkLhBjrSXa3b3dYkO1M6GZL32KWY+Y72lSoOwrDDcLCGJWozKjXZ3OZzJ9xQuPqXOakeX3w2S5oLBCTFfqj6dnT3zQhdUn8t7KnzRIBrDS7fJAi68tHcHyVHbYQNW+6yq98NTafT0wKi79ual+p5RupXOR4Gr8sgDcDj4+TktyXKNNOITb0rEZ7CYA072EZpwLBtKOfwHOeFg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM5PR07MB3468; BCL:0; PCL:0; RULEID:; SRVR:DM5PR07MB3468; X-Forefront-PRVS: 0743E8D0A6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(346002)(136003)(376002)(39850400004)(366004)(189003)(199004)(81156014)(14444005)(47776003)(7736002)(316002)(37006003)(1076002)(16586007)(305945005)(50226002)(48376002)(2906002)(36756003)(6116002)(3846002)(81166006)(956004)(107886003)(5660300001)(6512007)(6636002)(53936002)(25786009)(6666003)(486006)(72206003)(476003)(2616005)(478600001)(11346002)(97736004)(105586002)(52116002)(26005)(446003)(5009440100003)(53416004)(34206002)(4326008)(69596002)(106356001)(51416003)(42882007)(76176011)(8936002)(8676002)(68736007)(2351001)(2361001)(6486002)(386003)(66066001)(1857600001)(6506007)(50466002)(16526019)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3468; H:ltp-pvn.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3468; 23:syleCU0gdf8a8YXt37LLbfDzRgs7cP5mon3ykKTo7?= =?us-ascii?Q?z14Fn40s1AKEPeVcoFf4X6AnkptmJ1OfyYFqEW15NR11wSTM+jjMYz29Ehkm?= =?us-ascii?Q?VU+Ul1swhIaUcnrlSQgmwwk9OXNJq5z6BabbIpNjORr7i2ngfR4XKQ2ouCxi?= =?us-ascii?Q?2F3hiUn/Y+Yt7V2mTbd2rq0uOYxMP4i1M37RV9tgdcJ6FMVSS1VWoaNlLn12?= =?us-ascii?Q?rv5xzqA6E75PuZM1cyvpXkFAIs39akRBXIRh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Jk7BXKYt1XL9iiS3H9IaK3DR0e9CstpkojpcAMdXUDl0RVtd2XFgZ9y7JaLHJmtxf+6PdpODwoAAwaYtA03i896AqJ7gay6nW12adcJSfEn2YCtvh1VJi+I66OY6EGDAZ+ooex44ieUop9fZiF5fCZoL3xbFew44ovzP5L/QNihrgAQQNgovVbeHH8nh3n49h+L1sMvYlMI+J589UY79odw==; 5:4rRRiyTloEucKYsR0f9HbOYbM8ebhheKvou+RHFBMaYIV14DsQATfISeLClYpLOAeEaitNJNCj5RAAawhW9Ev7k2WAHLEOg2+tdS7kSbgDD70BXsw6ZtJs1vJ4eNnG6lya15fP7GmUiHmGNN9AUNPbstexKoz7unEg+QypOI5xI=; 7:h1s0KIgJSEuCv6BUtZDEQvqU6FatpqTYSCAuZzudE7wjvh01qA2t4QLBUVNe4tVOSn9OlYDTQCJ1taWdZn/Lo8enrTSka8arCzdcusfF/PgGpA5CqdcMoMabitCYJ/666+kRkxa1WBoENQXqXTrf0cDBmlqtsyI9GtPCOP2CBJkFcgZOyZtk3SHUnz/9iNBGrbQiO8pqAFrD2f2XXAoxaYrdz+6yzFxKVSVU6uAys5P4C3430lI7OWOKy76lod/A SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2018 11:01:56.7792 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0837bc9d-ef70-4ca9-cdec-08d5f154dffd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3468 Subject: [dpdk-dev] [PATCH v3] app/eventdev: use proper teardown sequence 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, 24 Jul 2018 11:02:00 -0000 Use proper teardown sequence when SIGINT is caught to prevent eventdev from going into undefined state. Signed-off-by: Pavan Nikhilesh --- v3 Changes: - Segregate ethdev_stop and close to prevent possible SEGFAULT. - handle early shutdown. v2 Changes: - Only stopping the ethdev(producer) is sufficient.(Jerin) app/test-eventdev/evt_main.c | 40 +++++++++++++++--------- app/test-eventdev/test_perf_common.c | 1 - app/test-eventdev/test_pipeline_common.c | 1 - 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c index 57bb94570..0d5028c17 100644 --- a/app/test-eventdev/evt_main.c +++ b/app/test-eventdev/evt_main.c @@ -20,29 +20,39 @@ struct evt_test *test; static void signal_handler(int signum) { - if (signum == SIGINT || signum == SIGTERM) { + int i; + static uint8_t once; + + if ((signum == SIGINT || signum == SIGTERM) && !once) { + once = true; printf("\nSignal %d received, preparing to exit...\n", signum); - /* request all lcores to exit from the main loop */ - *(int *)test->test_priv = true; - rte_wmb(); - rte_eal_mp_wait_lcore(); + if (test != NULL) { + /* request all lcores to exit from the main loop */ + *(int *)test->test_priv = true; + rte_wmb(); + + if (test->ops.ethdev_destroy) + test->ops.ethdev_destroy(test, &opt); - if (test->ops.test_result) - test->ops.test_result(test, &opt); + rte_eal_mp_wait_lcore(); - if (test->ops.eventdev_destroy) - test->ops.eventdev_destroy(test, &opt); + if (test->ops.test_result) + test->ops.test_result(test, &opt); - if (test->ops.ethdev_destroy) - test->ops.ethdev_destroy(test, &opt); + RTE_ETH_FOREACH_DEV(i) + rte_eth_dev_close(i); - if (test->ops.mempool_destroy) - test->ops.mempool_destroy(test, &opt); + if (test->ops.eventdev_destroy) + test->ops.eventdev_destroy(test, &opt); - if (test->ops.test_destroy) - test->ops.test_destroy(test, &opt); + if (test->ops.mempool_destroy) + test->ops.mempool_destroy(test, &opt); + + if (test->ops.test_destroy) + test->ops.test_destroy(test, &opt); + } /* exit with the expected status */ signal(signum, SIG_DFL); diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index d00f91802..6d39f98e0 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -743,7 +743,6 @@ void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt) RTE_ETH_FOREACH_DEV(i) { rte_event_eth_rx_adapter_stop(i); rte_eth_dev_stop(i); - rte_eth_dev_close(i); } } } diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index 719518ff3..96e7c9882 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -467,7 +467,6 @@ pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt) RTE_ETH_FOREACH_DEV(i) { rte_event_eth_rx_adapter_stop(i); rte_eth_dev_stop(i); - rte_eth_dev_close(i); } } -- 2.18.0