From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680042.outbound.protection.outlook.com [40.107.68.42]) by dpdk.org (Postfix) with ESMTP id 7B318239 for ; Tue, 24 Jul 2018 14:15:10 +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=u1lkSvtEe+0WBwPq49iZGrCrQyDGXjm+zfsH3j4Bj2U=; b=QBE3DuZx8BbkC2bJfQvthHFB4caxQb5kbW2DC6tlEkmJWiiFt0n6OR+kB47EYdKnoIzDzh1nsPSYX9KjHDMsbZtfJSJ2bUb9+2otjN+jehUWfyb7yskSQ0uYecVSo4TjYqMChxWPyFF/6FmMLTlCbYG18NgPzeO+XhWtBezGaoo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by CY4PR07MB3461.namprd07.prod.outlook.com (2603:10b6:910:75::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Tue, 24 Jul 2018 12:15:07 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 24 Jul 2018 17:44:50 +0530 Message-Id: <20180724121450.9969-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: MWHPR12CA0068.namprd12.prod.outlook.com (2603:10b6:300:103::30) To CY4PR07MB3461.namprd07.prod.outlook.com (2603:10b6:910:75::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b82f7e79-f4de-4a60-1c69-08d5f15f18f5 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(2017052603328)(7153060)(7193020); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 3:L7stU4f//SOt6zCHlaS8FgFT2zXhXcvizzmI8neB5iZrfPOXxyKJlecM8D2j9+2HgriTq/299aRBi3uGSUitsSNVC+RwLBiD59Bcir3Hah/NB4Isx6lQoPvSKCcnJSyBXudk1q+pt7vG+bIbYgEhTgpunyYU1M+9P3S5JxCvjn66tfxJdKLek49UYZY7IkyzwV9B81mOTZ5ITF8sUzur1TY7b90PGjf+f3uo5yCnsq9UDf0m+exwB+OwtcYMTz3C; 25:t1V2RKUpCX7wQGxonzTwtg8i0rvkIKv7+Bkm2VOnEkY1AY+QpGMxU2xd4Vs7jw2sbiLCmyi/1cYcOoUs5wsmwt9VBalfWHbY4hDrom7PIpjusfR0tOC5GDV01hSOKoJs+jOWBUEiCJqScU3EJQN7Z3B9CbVX/RigErPn4JxkLfhfGOW+phCj1w73ltln9/MEQ+CQNcZ5ERlnv2c2h6WIqzbJLZ5bLthEE9t8JUfCp9mwPEVkj55M7vRYLvipohMRwXoX36GGCq1q5hzDrSzoKZCTBHjd4aFoVWS6XUClKeiL+6wLbQjUQgiv3ltag5Be1upZ0B9m6Ik1WJW6mJqobg==; 31:M8YNCV9rLPiovYi6+llmwNrYnxiLFK8LPjGmxhLl35Y26JVhMcOfDr3+Fr5RozBYKIswz2HbXHTRABjcUZOIjhbUc48+DHYy+gQBUEYxXi2LeD1rV/abGe3it98XFHmOGuC0Va4vKuym7I6HQzm/mGibt5TKEGqvCtld4AAjq7/xRXULYRGAqZdlT0XTefocKf+OMRx/08oDQyujweDQaD6eLadDidxCytwiBbow5mw= X-MS-TrafficTypeDiagnostic: CY4PR07MB3461: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 20:kPLwx8nbkFeID9BRtn8ahPFVDFfgXV383iIAtMsPVM7QWDMuqKJwPvHjC8hmXsHO0KdlDsQc2Sq+726gsQ96Sa2/tr8BjiHJrZ+KQRTDvHrtDziHwl4WMoqmpG/MR8KhgFylY1jUo30iR5f1C/dEqbl6ZpcsMFqLG+1G+/eFGxUUoOS5ObGUVH+I76K2h/egs8CDq1PJNijWDIWcAOrksf6S0b5fhgOWwxA3vfHPTMK9vu0kSHELwnTMeaNNQ6yiioIbiT2Cd5SYYkHocyBLjJcbwnNtiRDPtgRP54h/el504EOFp3bgy1wLWPsSwXUa348txf6ANtrqZwzIsgzj81ezTg+pOvVI3ypGvlroRwn4hcsjq2p2vE5dicv7Hb6AS76786e7Qgp98G16MZauX9MjhWDWlao64AdDJCICqKR+LXaeJgD1NcNElzsHHUgARpLAf1+VHdiIZLk2YwuPDMjYClP+4WvRt9zEXsis/0BVXFplG9DlqlHdRPCur0IX8uUVJ/xopjWK3b7T3eX17FAZ2T9DoT3P99NvQWsz7tbq3TTfpD4LOupNhv6gwnA8fchDey2287pLpwdfjrjs3yn31Afzy+Cd1auCqwcKcT0=; 4:3SN1aPhrAiO/N/RiZzz6iLsXl16I1An3qawxqD2N9LgMe11kJ112/uHLKkIJqPaBq6mOoTuMq09is9uHbbDFyZE281cDbUhW8a6dZbznNBvJVEXuKJhmPxRTw+crsZCjwu/ZWwV7paoLBk5bc8zJ85j2JwrA2ciHU3E1jqzLpsExHQ+bCOzl0kFaIYrh0BUUKUXwrS9TR0M5aheCCWDo5Z6DIap1xa7oR010EJDU1oyYKNuRgVmLWV/d0bEHBICnd75TKcAiT2NnHMID00/sAQ== 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)(5005006)(8121501046)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:CY4PR07MB3461; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3461; X-Forefront-PRVS: 0743E8D0A6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(376002)(396003)(366004)(136003)(189003)(199004)(478600001)(107886003)(42882007)(26005)(66066001)(72206003)(16526019)(47776003)(69596002)(6506007)(7736002)(386003)(2616005)(476003)(5009440100003)(11346002)(76176011)(446003)(2351001)(956004)(105586002)(305945005)(106356001)(53416004)(1076002)(6636002)(486006)(53936002)(52116002)(51416003)(6666003)(6116002)(3846002)(2361001)(81166006)(81156014)(8676002)(25786009)(8936002)(37006003)(5660300001)(68736007)(48376002)(1857600001)(50226002)(14444005)(316002)(16586007)(50466002)(4326008)(2906002)(36756003)(34206002)(6512007)(97736004)(6486002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3461; 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; CY4PR07MB3461; 23:A3XleBoIG8/y7MdIbjLTqtjS13004Fe5xyjEr4RCg?= =?us-ascii?Q?6VmrvM7fwD7NhKdoy1vRsIzyohSwSqhyWxIueWyi71jQ4i68bj0lVDrwt+QN?= =?us-ascii?Q?jmAPDdb1x7D0D8dm7rdCQlhHeol10sNjsObWWFVEnpgI7Hsuf97EfIwoB8Wo?= =?us-ascii?Q?8OQL/4gUcxcOyTaeIuDynVgvGTxJ7/jcYFPcHRFZx9expHzJPJ1D0i4phurB?= =?us-ascii?Q?98zDn1eh1FGG9UR79gitWfki2eI1M/s9peBfcsKZPE89xnsevspdeo6oZuUM?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zb0UC6CJGp2Tz76p27zlvjrgodhTLNVuRoIox?= =?us-ascii?Q?VDsyo4oTR2KMcK5wAWWAkULZuxdZXWl1cm5St1XW2Y1MPyNQR+mBcu+mTeeV?= =?us-ascii?Q?xXoMSi2qg6ebrz+OieLrWca98j3nTPbc7Bka7VewESU+pebsEsfYjvyffmY3?= =?us-ascii?Q?rArO9PbKZ9CCzjmTT1pIeupzyn4Mb47PwC6VGS4blPJm4NzW64CeUpohoL0D?= =?us-ascii?Q?X01Q3J82tkoY+7SXKxe5qWyjRgUhZKssKaEKv2GipfiN77vUKyDoemc9L4yR?= =?us-ascii?Q?DMlpXtOMI/LbtQBo/r/wyMqla5isf8=3D?= X-Microsoft-Antispam-Message-Info: Jj+rAQWhCqtMJZLzMhG3qqaHta7Sq82qUBJpT7VONwToOZqywnRVv9YZwd90/PTipLhGurz1pR63DI+IoBDrWk7usFuMTMhGtja2iuMKf8tZwmD0r7AInKJCQbiJnykPGu9RUA5DgHSetRMZqLEd3UWgE+R1YlPE4LptJXCbkJwcZf6xEOvnpJIY0EoMKFpIJHBD42sxiwKOK/PAlPbCF2/1na92osc/ZKFDdZU+VCPux8UmETS2ju2VBqgCEeeWSlTHwc9QESR3j1ncSZ2iz1lLzXNRf7pN1ZacKbQ4KgHo2Uqfw87y/V+wPxds10K5hYGqZtuUFRXDGnLuuo6kSaNHVGvIDM2fKIfJ/QGyTD4= X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 6:tAlaRpiWQHCNF20RCQP6sgJ0bttUYSk6NpOTIIg4DjUrRxl5BopyMbznCsMcVWWuWoiwYU0A1nCh/YcLorrSMv5end9xpc4scYxJZTbHarCfHnzSgdR08Bi1fGUgk3H0tWZerocsss4ecl0NckhPJYWFnb835+F6qcfrFTf5XLJtBGPaEm5S7uIPkBsPQD2vJPzqgeZYl/zGTq8IL5/GUxOmUkSW5FzshpjIp3wpLPO/jKgOLo32E3xG4TDoyKfdmZK8FZXUDl3HSCKjU2oIY5MHrExKeBHiMHL57VfjGss4KlpF5+5FlUIZrZq/Au89kI0a+b86HM4O+C1H/HHxzelKpRlDa1Lgw29gSNomwJA200AKWEvLAhaD/oQ/S5EwyYXxapycVNlMnnSi8/uAwIr5soKB+3yEehTMPU+pvzTwqqMYlLzhHKJEYOy+euZEyxYPJ5gAiynOfQbbz7Nw5g==; 5:TqjLPsYeQJzqm379os39RVb6Yt5zFxrW/O6kTwjQ87qiUmbNBKpl9HRv6vNzet/A+KftEnr/+M5hlamz2eR0wg9LsdD4d9xSHuV/ZdYncfb4SdEtl/jOHYQxnZRsZi6eEgwxai1ehQuOBeeTbyRnu9cr3/3tYvGQArFcSnlsB+M=; 7:vYf31yzt4RasoYxsbllZEZrVv7H+gPPH2JS1+1n6RXvv73+eP2LLcfMZrjj3BfNffZQdIuIzGhA7/f61C+CtVfr8MchTWCQ3RrnzRUpZ4tZKJ7YVKCXhokKuGX5oSUjNidnUOOTzU609aTqGlvk+Uky5TzcCF4uoPtSqC+v7Z4pNEHtJl38yCYxxNrc2mHnkMYLrsayX1/umhNdVzcy28FLYOyvToO2NFrj1WxOcHqpxYZqKzGtGDz70O2OEMSTt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2018 12:15:07.1790 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b82f7e79-f4de-4a60-1c69-08d5f15f18f5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3461 Subject: [dpdk-dev] [PATCH v4] 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 12:15:11 -0000 Use proper teardown sequence when SIGINT is caught to prevent eventdev from going into undefined state. Signed-off-by: Pavan Nikhilesh --- v4 Changes: - Check opts before closing ethdev. 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 | 42 +++++++++++++++--------- app/test-eventdev/test_perf_common.c | 1 - app/test-eventdev/test_pipeline_common.c | 1 - 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c index 57bb94570..a8d304bab 100644 --- a/app/test-eventdev/evt_main.c +++ b/app/test-eventdev/evt_main.c @@ -20,29 +20,41 @@ 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); + if (opt.prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) { + 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