From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 31F03A09E5; Tue, 8 Dec 2020 03:58:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 08343C914; Tue, 8 Dec 2020 03:58:53 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id C1C48C912 for ; Tue, 8 Dec 2020 03:58:51 +0100 (CET) IronPort-SDR: mzGT+nBRbSYoU9aS/zFGq0wCZYpGcCnPAd18jSfBHTdCwM8ZpBWE37aeybHPXSJvT7or1IVejl RqUkcirS+8Hg== X-IronPort-AV: E=McAfee;i="6000,8403,9828"; a="173967358" X-IronPort-AV: E=Sophos;i="5.78,401,1599548400"; d="scan'208";a="173967358" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2020 18:58:49 -0800 IronPort-SDR: Ymr64kd+Ox9nrMHAUO9UR+0ukWcpVIxer6EJ52atEGfZBPZpS7of98ozCWGfuAwNt6O0icdcY+ vZaGlwWx9l2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,401,1599548400"; d="scan'208";a="318257202" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga007.fm.intel.com with ESMTP; 07 Dec 2020 18:58:49 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 7 Dec 2020 18:58:49 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 7 Dec 2020 18:58:48 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 7 Dec 2020 18:58:48 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.171) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 7 Dec 2020 18:58:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WtJzbrREX6NP0ahG5gHot4zJXm0so7vUuwd+ZYDbXxP7b54EXh6RPOAKa7MifDTfBBtd3yrzDmKfYhMyqPVEQsLAMOG7UhOamG1o0x7UrJ8q47capsrw+yrhMIZwBpu4hhq7cOR8L/uDeexfY/xFojmDhUEDlDnKKxo/7SsHg6Y4pPtDGBLaRmYaoFVMFau4hwUgS71vA6mrqwYIGyBan9euzhfatYZPoRb3uZ/VnDQlN77Y+tpRdlhoP2FcGXH9ZgjfvwYaO/L0m1LkvhFcsB12tdP/u+H/DqQMlwDXod+LVQS+0Iu0Y0i6/2YtJoOvCQK1Yi6KagBbKmxxxrjinw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9ZqUGgNKgaQOVWqRjSBcBvhhr3q8+aoQbDPGwSphGE=; b=WAyWGBYF2RgUM4X7Yt6beDYEXX1X22g1xyw/E9W7GzYUezUV/IeSminedIP/grVppn+y3EsHqYSdS2oD7oDX/66k5hRy4BEFI3mb4cWc8LkA+fjtlErYC7d79a9qdtxowARf+MWHAXWgWhIujHwzcrtSuf7wKClRbTd5VMD/kK3t1tFtjTk+I8EkZ3PKdcwsRTfMt1uAdRxD0KTuR9WhHjtxHhf7bxNp1j/4ibggGreub8Dti5EO97FpUST4kwBxwGwUQRmry4yymHR8J0Y5Wc4p/Aa8LOpY0lfcU8+buInkGqIkuPrAWpFfrckcRXI9Tg5wMdEyBFtJKy1as7O41g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9ZqUGgNKgaQOVWqRjSBcBvhhr3q8+aoQbDPGwSphGE=; b=AXcdHEm14SoWVCalHnwOhhj0WjZalvjs9sdw+jhC1iWq2CW8YKb5/XRWmEcTL4gvMPSSKP1z4vnyLtawMCGEpt0C63rRPs9E/ateJvSr9tSUserzJSZYy4qvZW8zaKwFBPVyYAT7myQMEkUm/07kBE0LbYpAYR/FC79ouiH2ylY= Received: from CY4PR11MB1750.namprd11.prod.outlook.com (2603:10b6:903:126::8) by CY4PR11MB1925.namprd11.prod.outlook.com (2603:10b6:903:128::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Tue, 8 Dec 2020 02:58:32 +0000 Received: from CY4PR11MB1750.namprd11.prod.outlook.com ([fe80::5999:7f2b:fc1d:5352]) by CY4PR11MB1750.namprd11.prod.outlook.com ([fe80::5999:7f2b:fc1d:5352%9]) with mapi id 15.20.3632.021; Tue, 8 Dec 2020 02:58:32 +0000 From: "Li, Xiaoyun" To: Prateek Agarwal , "dev@dpdk.org" CC: "thomas@monjalon.net" , Prateek Agarwal Thread-Topic: [dpdk-dev] [PATCH] Remove printf from signal handler. Thread-Index: AQHWymZvFxsdbCg2Rk2SO1JwUaJj+anshPLg Date: Tue, 8 Dec 2020 02:58:31 +0000 Message-ID: References: <20201204175151.11868-1-pratekag@gmail.com> In-Reply-To: <20201204175151.11868-1-pratekag@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a682ed1d-7abe-4a21-3e27-08d89b2525c4 x-ms-traffictypediagnostic: CY4PR11MB1925: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3513; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FSpbpaXkZ1Zhgd4Kmayp0Y2hV59mphQTtkY+Rt207sN9XCvndMbcwybxnasARcYOPVxBuxp2MQIkNqFuU0cfeX7mexDsr7WlD8i315U+CHrzyyDuCA6M0tvuofw0AJ5zXZXqHkI8K7y7f9UxQrNub8xfFyZV/K6sh66kTOSoFz6sPPLafr6Z8Z1yYvd8gIwN4ckbXpP0Y4hoje5fYWyHAetHF9zMZsnJKFFSUJiUxJTBbFmyMMUuFWBbDJQOKoDa7wGb+G03avkrqHWHplutmSWyTBusS3KRXBNailP6CHugMFKcYEPkVG6A/cZrPOtuSCwqXbRpN2+KwEIhZ6QiDQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1750.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(366004)(346002)(39860400002)(376002)(9686003)(83380400001)(4326008)(66946007)(66556008)(66476007)(7696005)(478600001)(8676002)(2906002)(110136005)(33656002)(66446008)(76116006)(55016002)(64756008)(5660300002)(71200400001)(53546011)(26005)(54906003)(316002)(6506007)(186003)(52536014)(86362001)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?M6zb5RjYda9JNaspu5+bBw0gPGpBw4a77Ys/8SfGAG4v8o/ChTi1t5+tWUtX?= =?us-ascii?Q?GM37bbfcEbRESPZLVnFDsGUxWtLR6uXBLHdpEtcRiGSbTKLzniDIjOgZxAYi?= =?us-ascii?Q?lIIyREYIyO9uOij3v4q3+at5ylIxsYdXD2VUBKMkmKwfIMtA0Jzms8OLpny6?= =?us-ascii?Q?i79/hPoWj8ECQLDNLX7z0JhaMJ6IFH47fmRd2YzfLJP5hGDkPN7vg6cl1DGT?= =?us-ascii?Q?eGPDlB6Sw/wQvGEOgnM74AldM26/idZuvLjm3lYxhMq7CdLTrFG2VPZUssd5?= =?us-ascii?Q?zLOEDRhacBFGNTsZue6q9ubsk5oyxUmvF8Wi58e8gNIOTL++3RXQHKLlXIG3?= =?us-ascii?Q?WRirs97zZhmPiSt9WAYrdyyF9mFVGsJCbWRrzVuv4TtL3GCSsWOeVz/C3uJI?= =?us-ascii?Q?7nDAirixW/xof+1TuWoPlmjMqULwqBc3t3ZOzPZAfr55EgockE9267MoXZoG?= =?us-ascii?Q?fiCtN3c9XsjgVjwzTi8xMO26n73S81v437rgyUc1IiRfuueC50iJb3Ic+NVC?= =?us-ascii?Q?AInP73Ehi+UoS09/0rncQPQvEKQz5T6RP8k1KTUMTydLWWer0f3qXr/OBRpj?= =?us-ascii?Q?HZZIOCMkq2+ZN8SZk3UeoXlXZ6iZAYwOcTB3iJ6TY7NPGrzaYgmLNN8+MqDZ?= =?us-ascii?Q?XMAHptpXAf0CMqJaaKVgBUgH/0YdUCqMghHgpu9bWeQpL1sJ+i4CjpwVtvIu?= =?us-ascii?Q?GL4mlluCjweP7sVgnFGlduWsKfVG5fpP2QNLnd6C1r23/pIRjeklHbsLA8t6?= =?us-ascii?Q?rHZQKZ3ncp2OVyvHi9LJI5iNPsWHwut45KUh60KfAOptHVIlJO6UmTvoBjr9?= =?us-ascii?Q?uSF0IL/bmmpbshjaQADgqeAfOMOxdBjoC2rpoa9qeZaHKNW6OYi2X4TwGbiV?= =?us-ascii?Q?NuSQsDDIkLhdJKWep6z0Cx/bObBkT9mrdK443mtEwLEpJekiKuIXQKYQ7gie?= =?us-ascii?Q?h5a02jDnNcjyviPcvvKqFRebKa/BxtPboLVZH8Jx1cw=3D?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1750.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a682ed1d-7abe-4a21-3e27-08d89b2525c4 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2020 02:58:32.0619 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BTzfM5y+iOXkZAMUm3Bx7+X/q/CP//O+poLxGQNdEvCJtKjs9VXxiohyZyogydu3vkCw7jtQjsZ5uGSLO/vgkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1925 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] Remove printf from signal handler. 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi I don't object with all the removing of printf. Just one concern, I don't think you actually solved the problem in this pat= ch. Take testpmd as an example, the signal_handler includes many complicated ac= tions after that very first printf like force_quit() which includes stop po= rt, close port, hotplug... and of course a lot of printf in it. So only removing the first printf doesn't actually solve the issue you ment= ioned. And many examples do similar things as testpmd, they have the same issues t= oo. BRs Xiaoyun > -----Original Message----- > From: dev On Behalf Of Prateek Agarwal > Sent: Saturday, December 5, 2020 01:52 > To: dev@dpdk.org > Cc: thomas@monjalon.net; Prateek Agarwal ; Prateek > Agarwal > Subject: [dpdk-dev] [PATCH] Remove printf from signal handler. >=20 > printf is not async-signal safe. Using printf in signal handlers may lead= to > deadlock. Removed printf from signal handlers present in several applicat= ions. >=20 > Signed-off-by: Prateek Agarwal > --- > app/pdump/main.c | 2 -- > app/test-eventdev/evt_main.c | 4 ---- > app/test-flow-perf/main.c | 3 --- > app/test-pmd/testpmd.c | 2 -- > app/test/test_pmd_perf.c | 1 - > 5 files changed, 12 deletions(-) >=20 > diff --git a/app/pdump/main.c b/app/pdump/main.c index > b34bf3353..380f0ea0f 100644 > --- a/app/pdump/main.c > +++ b/app/pdump/main.c > @@ -573,8 +573,6 @@ static void > signal_handler(int sig_num) > { > if (sig_num =3D=3D SIGINT) { > - printf("\n\nSignal %d received, preparing to exit...\n", > - sig_num); > quit_signal =3D 1; > } > } > diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c > index a8d304bab..51d5897f8 100644 > --- a/app/test-eventdev/evt_main.c > +++ b/app/test-eventdev/evt_main.c > @@ -22,12 +22,8 @@ signal_handler(int signum) { > int i; > static uint8_t once; > - > if ((signum =3D=3D SIGINT || signum =3D=3D SIGTERM) && !once) { > once =3D true; > - printf("\nSignal %d received, preparing to exit...\n", > - signum); > - > if (test !=3D NULL) { > /* request all lcores to exit from the main loop */ > *(int *)test->test_priv =3D true; > diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index > 03d01a8b5..aeb0ef3b0 100644 > --- a/app/test-flow-perf/main.c > +++ b/app/test-flow-perf/main.c > @@ -1001,9 +1001,6 @@ static void > signal_handler(int signum) > { > if (signum =3D=3D SIGINT || signum =3D=3D SIGTERM) { > - printf("\n\nSignal %d received, preparing to exit...\n", > - signum); > - printf("Error: Stats are wrong due to sudden signal!\n\n"); > force_quit =3D true; > } > } > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > 33fc0fddf..7ec87e7fd 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -3794,8 +3794,6 @@ static void > signal_handler(int signum) > { > if (signum =3D=3D SIGINT || signum =3D=3D SIGTERM) { > - printf("\nSignal %d received, preparing to exit...\n", > - signum); > #ifdef RTE_LIB_PDUMP > /* uninitialize packet capture framework */ > rte_pdump_uninit(); > diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index > 4db816a36..58cb84401 100644 > --- a/app/test/test_pmd_perf.c > +++ b/app/test/test_pmd_perf.c > @@ -319,7 +319,6 @@ signal_handler(int signum) { > /* USR1 signal, stop testing */ > if (signum =3D=3D SIGUSR1) { > - printf("Force Stop!\n"); > stop =3D 1; > } >=20 > -- > 2.25.1