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 873FCA04DB; Thu, 10 Dec 2020 04:15:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E652BC8A; Thu, 10 Dec 2020 04:15:04 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7F5ADBC88 for ; Thu, 10 Dec 2020 04:15:01 +0100 (CET) IronPort-SDR: qqvZCPRmEHdFXfa1hHBShVCd+iY1LOlIVVVEv6fA9NVW5cscvV4+0fn7vqLsqG4pf+leVVRSD7 B0XCV0PP6/Sg== X-IronPort-AV: E=McAfee;i="6000,8403,9830"; a="171617299" X-IronPort-AV: E=Sophos;i="5.78,407,1599548400"; d="scan'208";a="171617299" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2020 19:14:59 -0800 IronPort-SDR: 819Dc6IEsGtKUDVyFJdXa6T0fwYKNmIWnBmmrqoml9Drl7fXPFGVnj+Cfq1k1c97bGOwQSCjyY yWp/VmBXYDlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,407,1599548400"; d="scan'208";a="484251581" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga004.jf.intel.com with ESMTP; 09 Dec 2020 19:14:59 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 9 Dec 2020 19:14:58 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 9 Dec 2020 19:14:58 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.46) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 9 Dec 2020 19:14:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oT0zHuD7FHNU7VoYjQ22tuurvFRDlonOWT9JBCnEMYDLWqgsri4DwccNGA4aCKmH3/TGjxD2+uQ1lLDrThPrAbGQ+Q5m08PYr8D6eRfV0ZSj14JnDMbCdRgG1bDVXEHt02F9/3VBuz17YcHpRzzG/mi8Aky0ClcTQWNhG03C0oSwaQUP5a3Q3Qvc3kygJ4IKM6+dHxUURCqkQn+MdIIZJclbBPiKc98I7ZsFbM/aY5e+4XnXreSQpMJlk0pAPl+sQ9LLgFD4PrC4VLFDjBmxthKZSQCFNnvRWGSLsc2PTNOWUX0TG/uVhhC/5bANmqnu0EgEaW4CMvJ4xuLu6PqADg== 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=SwEzsQmcBuQR7Dl6E0d4O/51/14R4Kz3DjTpc4/LKD8=; b=cglXaUbXApwbi4y7QHTwgCNjEiIXaIOfebVPAdkr/w2X5CgC5URtBNxfJjFzBDNOG9d8Y/xttrc/vP8oHt3Pq/tKcIjPssZMynkeKU8nTX9ZN5I8SgTyjTXZkMtk3dzl8p2woROEjRBuhHWjNp4BrZpJUhWqNBXV0lp8ghEOUJ+9QMfz0TIXm34F6F+nFfNP0Q4b0UBBR35HkPs/nDjN6EQMMaTSZ6BL2SFeOgTdWs/n1vYIxLwnYzsoHuV8HOtB48BMlY//pOe4PhJU7RK1+tgXPtVaokhSJu2QJjAFj397uYDMCyCeDYMRerf2nhnGbuWtIKAx4iZX9JFlKEplOw== 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=SwEzsQmcBuQR7Dl6E0d4O/51/14R4Kz3DjTpc4/LKD8=; b=s5WfNrKNNDGrwzuLTLA9PWg7yEdNLllOVOErrOrPwWawrFyyXls7IIWlOMJOt+6leBS0oHNKAS2BWxyIsvN9bLuZVlPViB3pORUe6naN924pMO/ZhO+/ZNCu8NV6XiXMFVQMMI8f6mB2kkxxTE/J6TE9aZ4mfrtTS2qnVConWwo= Received: from CY4PR11MB1750.namprd11.prod.outlook.com (2603:10b6:903:126::8) by CY4PR11MB1336.namprd11.prod.outlook.com (2603:10b6:903:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12; Thu, 10 Dec 2020 03:14:57 +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.3654.013; Thu, 10 Dec 2020 03:14:57 +0000 From: "Li, Xiaoyun" To: prateekag CC: Prateek Agarwal , "dev@dpdk.org" , "thomas@monjalon.net" Thread-Topic: [dpdk-dev] [PATCH] Remove printf from signal handler. Thread-Index: AQHWymZvFxsdbCg2Rk2SO1JwUaJj+anshPLggAL8/YCAACnd4A== Date: Thu, 10 Dec 2020 03:14:57 +0000 Message-ID: References: <20201204175151.11868-1-pratekag@gmail.com> <92a8857e311142921587ec49fc41b2ab@cse.iitb.ac.in> In-Reply-To: <92a8857e311142921587ec49fc41b2ab@cse.iitb.ac.in> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: cse.iitb.ac.in; dkim=none (message not signed) header.d=none;cse.iitb.ac.in; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.210] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 57c58f6d-0575-463e-2492-08d89cb9c5bf x-ms-traffictypediagnostic: CY4PR11MB1336: 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: I7h/f74KS9SZXCnSz5W3KpgFdw6UTewYrHQBYzKg57GWYtcoT74BsFAfvayld2ms7vVZjq9zokIdsSKOkhhtDosq/MGcwJdDcqddxDrG/GObPjSQwCE647ezet7noNuKmmxmRhPd6skpL0XEJGdFDd0jkd6Zmld42txi1x7f4tCvRJDigUIyuJQCp4qHAz1FMz61RAhKNtogXcxfXBuVTisnfAn+mDvKx6Db34Pp69T5XQUY2R39dhCUNTWW7QijDabqaxEoXROoutERNWH40hQ9kHCtRFzOn+WEZ7ggNPHW/XtVVirepm6PJtPuUp45LrYp1XAGP7St67AhaEIfOA== 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)(376002)(346002)(366004)(136003)(66476007)(66946007)(5660300002)(86362001)(54906003)(26005)(52536014)(66446008)(76116006)(186003)(508600001)(64756008)(66556008)(83380400001)(33656002)(7696005)(71200400001)(55016002)(6506007)(8936002)(4326008)(8676002)(6916009)(2906002)(9686003)(53546011); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?tzRABQ+nEaQ0yNlXLxbqS+lsM3uqVAovI2h06jJ4UfXM9S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8W/cBHbKWLxB32Vz8I0m3wlwP1xxAIptpM8U?= =?us-ascii?Q?9y38zz6I2OMCplCmkKWPYDDsH5rMFvn8rl2j5OzVb7I=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: 57c58f6d-0575-463e-2492-08d89cb9c5bf X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2020 03:14:57.1946 (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: hO2v5ItBv4Q7PrqLNFr1r3VxWakZBz1Qm/laQU75I1Id7oJceynndmpXh18HOdGctRnKUDlqm+gvrJ8i3GVPEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1336 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 o= r 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 behavio= r like stopping port will call driver functions. It's not very reasonable t= o me that replacing all possible logs.=20 Use a flag and check the flag for each possible thread? Most examples alrea= dy do this way. But for complicated app, it will be tricky and may cause ot= her issues. Maybe other people have better ideas? BRs Xiaoyun > -----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. >=20 > Hi > Agree. What is the way out? The printfs you mentioned look like important > messages and may have been called outside signal handler routines. > Shall they be removed as well or converted to "write" function call? Or w= e live > with the possiblity of deadlock howsoever unlikely. > Regards > Prateek Agarwal >=20 >=20 > 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 you > > 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