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 9218CA04B0; Thu, 10 Dec 2020 10:24:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6DC55BE77; Thu, 10 Dec 2020 10:24:43 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 2FCDEBC88 for ; Thu, 10 Dec 2020 10:24:42 +0100 (CET) IronPort-SDR: JuIOlHY/hWlUUHneH5yMeaEsedS0fSqMZhw2+7uPNrp/dFs5X5IBAyVZDQ5SCHdo/XMOu4qA1i a3sfdlJKg6KA== X-IronPort-AV: E=McAfee;i="6000,8403,9830"; a="192536928" X-IronPort-AV: E=Sophos;i="5.78,408,1599548400"; d="scan'208";a="192536928" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2020 01:24:40 -0800 IronPort-SDR: T6Nids5LJd/qLPf51X+BmTtZg68OlpRsFzYzEH6W1nCw7g+4Q9U+9YGDOD1zn4n+6Fpqo0DpMi L3fMQr+LF7WQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,408,1599548400"; d="scan'208";a="371449765" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 10 Dec 2020 01:24:40 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 10 Dec 2020 01:24:39 -0800 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) 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; Thu, 10 Dec 2020 01:24:39 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 10 Dec 2020 01:24:39 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.104) 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; Thu, 10 Dec 2020 01:24:39 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FGdO7GkKfgHmyM8l1RGN4WkuCMpCE400PfyZgQ8/+1FEgwhZoJDxpORjsT8+pLgRCsBlgYwq8eobfvjBUodBBGKxPnN4SUSPAFR+2SuIaVlqbj1bQKC95ltZpPTqliIoX1ItQmEdVW6SI8RUv7XiLlbJ0A3GOriozjUryS+Qod1txSxBx5kcIyxWg9SzAdkYUWg+kmUmp0AAVzAj1TSqr7jdQhJtQtRFEiYq1WIO95SJcBu5+bSMSMe5i2aIHF66BU2nmhzvyjFQFw88GPTjqEfVhKP83Ge1xKI41NivekzysnPgz2H1SA0JrCgCZgOjcqfgI9ltp2RSRbO1WylO2A== 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=m7UH+XoWpW1bOTYlpQLn3WxkWqFbIyGoTgO0IEC+084=; b=Uzs7/sqxrdIB7zC7p4lz/8TxGB3RorrgDN8mXdbCT+rMYCHajTvugDV4ffbu6Yyz9QwWmrffY7cx4fTsW/atJZo6NNg9fVPWEEwWnuxd0x5pJWPwEK644M+0r4F+mb/B75JO0mtBAqrjmZoRTRVhbF+vQWeDnp/JJFBvPc8mqiVvaaXGng0dAuZcRhJhgmV2qkAxTHDtKW9kMe1hmQuqsuz5uOcMxANI+IK1T2er9hJhKheAjN3ShVVsUoAvO0YF62XtaDO6zbkskqgMxKjdJVXCRvG1FM7oRyfAP0u3hGnkZQhnRk0uunvZAgB9rOUZnJmiRXsSFUmu2GMhVTSMsg== 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=m7UH+XoWpW1bOTYlpQLn3WxkWqFbIyGoTgO0IEC+084=; b=HW8zvk5dg9EzTnX/zsjR90x/7gfvKYHUv2rOYZXfJ8ZlxR4Q1NaKHmXxdvgn+KMqG24R6BgB3dfTmPQIGmG3unfrhUzInsq9tGoE2bqA8m8NpKIqbhNout4a5GhkremOdNDSjrkz5yCMFSLM6xjGRcUg1/zdKVXtntcPj0G+28M= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB2677.namprd11.prod.outlook.com (2603:10b6:a02:cd::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Thu, 10 Dec 2020 09:24:37 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::7101:335e:1c9b:cad8]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::7101:335e:1c9b:cad8%4]) with mapi id 15.20.3611.038; Thu, 10 Dec 2020 09:24:37 +0000 From: "Ananyev, Konstantin" To: "Li, Xiaoyun" , prateekag CC: Prateek Agarwal , "dev@dpdk.org" , "thomas@monjalon.net" Thread-Topic: [dpdk-dev] [PATCH] Remove printf from signal handler. Thread-Index: AQHWymZtqjXo/5e2AUm8TNAyWrduYanshPLggAL8/YCAACnd4IAAau2Q Date: Thu, 10 Dec 2020 09:24:37 +0000 Message-ID: References: <20201204175151.11868-1-pratekag@gmail.com> <92a8857e311142921587ec49fc41b2ab@cse.iitb.ac.in> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [46.7.39.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 210bea29-56b1-4189-e0da-08d89ced6a67 x-ms-traffictypediagnostic: BYAPR11MB2677: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XfN+3PgisuPNU0aWcfCcSoJyxgtj/B+jk56cyeB0ggKNvF3nqv0kK1lLPfp/rIHkUDCBHOmO1Iidz2l3GJAhrpNiMSc3IeZADi/osFTe/Hhc0MzYnYWt6BpjKcU3bITTWvPEDE/sHUMjte3jPmvVNTRVHZ989gHXP1Qorz4dEZNFatMuiLTgzFhdvtg2FpMbkt3+RFEvspsy8f/P5CW9MFmF0uRgPycq7lpXDeDVL5PF0802vFtdyOstplw7iIQN422Z3uV8JhnX3sn/UDZvcRz2tiTl6znn6GPIZDkeAxhiW8c7kUdNUYb9KObvwIIQsMhDxRYJx0k+cJHvkXTqlA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(136003)(346002)(376002)(9686003)(186003)(52536014)(5660300002)(54906003)(83380400001)(26005)(2906002)(4326008)(53546011)(8676002)(64756008)(71200400001)(66476007)(8936002)(66946007)(66556008)(6506007)(66446008)(55016002)(7696005)(508600001)(86362001)(110136005)(33656002)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?BhD9v5IwwV2tFi9NdIKk1LxwW/AbtjSMzU6s5844m6iGp2mE1x5glzLcIk5u?= =?us-ascii?Q?Senngb6m548cBtdu9eJIBe1obCYG+6KVwVW+dpixQ7ZXWVEUvz8cW+6Mxu/z?= =?us-ascii?Q?H4nvEQ3LJaDhGGwytDzM8Mu+lPjeAd1v5tyN6TfuJm5ssNiTl6KH3s91zYXK?= =?us-ascii?Q?wyr30iBJa9KbyBlvjLomTIh9URHx2YFEshAILCB8wZl6OA1iV2Q0gNDcDiHn?= =?us-ascii?Q?UKgWTdgbe7r2PALhUfc72/hKP6P3bnYwgYC/KEzH5fVA3uFX1tj0j1gvceQB?= =?us-ascii?Q?JF8xU4ipV3gOjmR8xEeao1C9MyhppQzmM8A2RNVzy9e3ntaJLoB49b/jlJOT?= =?us-ascii?Q?pjhWAWrAd7Tcd7biYG7j2/ZNrdbd7OEa4mLloAy+Cyn+ZJiwUNx28ypP5+R7?= =?us-ascii?Q?eQwHScsjJB1F0Yk/2+Nl18W94jq3eeCHNx62+H42F1Wg0lzqLcMAEEWm9wXk?= =?us-ascii?Q?/od25AdIj/vcjHjgr9U5r9LNZrwLHHMFpz7rYfsxHCG+FRTz3bMqq34VzUqK?= =?us-ascii?Q?dMUFmGyjdlwlprUXqToGCeoIt56JiaE4b2cPFlM8UDVxiny+7VD4oTYzO844?= =?us-ascii?Q?4lPZ9aJUGMAeIosM2YmLwk02FFhB3dFm3y5jM8nMU7E34vvrWRHoPjWYmVdR?= =?us-ascii?Q?53RKPHAX7fy0LyIEqJMdFImo+ql0HSGwRoa3lXQwcARL0XwiL7aUe3VAF+PD?= =?us-ascii?Q?gzBS0d+F52RvLWImFLJOhFjafaUebMdzRD4eYm5UTBh0DtSeqZFBd4Yq4Gm2?= =?us-ascii?Q?uCmtNJ60g2ZwZFFn56zffkVQHjTH+GMLVcMOaOTt8bVvls+mFTSmw/yHeUPT?= =?us-ascii?Q?4/v5zP6IgQs3aHQgfKM4gKvkbR66OdUnRSfNNtmeJMeoI6RPvoZjJw54+S9T?= =?us-ascii?Q?gn1PJgp9OPLs9+wjWyyztd6oKdjaXtwZOCAWmC+A8cpHsYc66y04XCXtrdi7?= =?us-ascii?Q?SD9/QMsVO4bQlYVfdo0Yw6kvBGiqaYli0c7lj1SCOjQ=3D?= 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: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 210bea29-56b1-4189-e0da-08d89ced6a67 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2020 09:24:37.8220 (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: 4rliUXUmwWiWVeU8v/wUru770kOrFtQYx0coq6k44YrIp2QWUVcYgcHqcQcdanQhlPFa03zjUHLXRKpRw9WLtkKJ6HE1G4DR0jKWTDYN3Oc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2677 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 have a good solution here. > Removing doesn't seem a good idea because there are many important alerts= or reminders in all of those function calls and they may be > called in other places too. > I think replacing with "write" can't solve the problem too. Because behav= ior like stopping port will call driver functions. It's not very > reasonable to me that replacing all possible logs. > Use a flag and check the flag for each possible thread? Most examples alr= eady do this way. But for complicated app, it will be tricky and > may cause other issues. I wonder do we really have to try to 'fix' that? I don't remember anyone complained about such problem in 10 years DPDK exis= ts. Konstantin >=20 > Maybe other people have better ideas? >=20 > BRs > Xiaoyun >=20 > > -----Original Message----- > > From: prateekag > > Sent: Thursday, December 10, 2020 08:28 > > To: Li, Xiaoyun > > Cc: Prateek Agarwal ; dev@dpdk.org; > > thomas@monjalon.net > > Subject: Re: [dpdk-dev] [PATCH] Remove printf from signal handler. > > > > Hi > > Agree. What is the way out? The printfs you mentioned look like importa= nt > > messages and may have been called outside signal handler routines. > > Shall they be removed as well or converted to "write" function call? Or= we live > > with the possiblity of deadlock howsoever unlikely. > > Regards > > Prateek Agarwal > > > > > > On 2020-12-08 08:28, Li, Xiaoyun wrote: > > > 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 patch. > > > > > > Take testpmd as an example, the signal_handler includes many > > > complicated actions after that very first printf like force_quit() > > > which includes stop port, close port, hotplug... and of course a lot = of printf in it. > > > So only removing the first printf doesn't actually solve the issue yo= u > > > mentioned. > > > > > > And many examples do similar things as testpmd, they have the same > > > issues too. > > > > > > 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. > > >> > > >> printf is not async-signal safe. Using printf in signal handlers may > > >> lead to deadlock. Removed printf from signal handlers present in > > >> several applications. > > >> > > >> 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(-) > > >> > > >> 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; > > >> } > > >> > > >> -- > > >> 2.25.1