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 A70E1A04B0; Fri, 4 Dec 2020 10:25:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 105C84C7B; Fri, 4 Dec 2020 10:25:22 +0100 (CET) Received: from smtp1.iitb.ac.in (smtpd8.iitb.ac.in [103.21.126.63]) by dpdk.org (Postfix) with ESMTP id 523CF375B for ; Fri, 4 Dec 2020 10:20:50 +0100 (CET) Received: from ldns2.iitb.ac.in (ldns2.iitb.ac.in [10.200.12.2]) by smtp1.iitb.ac.in (Postfix) with SMTP id 3503D100FE4A for ; Fri, 4 Dec 2020 14:50:48 +0530 (IST) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.iitb.ac.in 3503D100FE4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iitb.ac.in; s=mail; t=1607073648; bh=agLnptRngRXiOMSVFeaiZu8FFUxi8gTe7VQ17519kHo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XPwmYYxbsF68rXvd9Wr8A4sxzTOUx+woaUPXtjJ9FsjP9bogfBN40At1Ve6WUN/Hh hpPizSjCQCxXuQV8r/e2ONW+HG9i43Agiiw3Mye1R9PYXV/QCyv86/idVXUIS272DP POHlZqqBgxZ4/vyvKlLmwOBDR79bd099pazCLLZ8= Received: (qmail 20665 invoked by uid 510); 4 Dec 2020 14:50:48 +0530 X-Qmail-Scanner-Diagnostics: from 10.200.1.25 by ldns2 (envelope-from , uid 501) with qmail-scanner-2.11 spamassassin: 3.4.1. mhr: 1.0. {clamdscan: 0.100.0/26007} Clear:RC:1(10.200.1.25):SA:0(0.0/7.0):. Processed in 3.225281 secs; 04 Dec 2020 14:50:48 +0530 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ldns2.iitb.ac.in X-Spam-Level: X-Spam-Status: No, score=0.0 required=7.0 tests=BAYES_20,IITB_ORIG, PROPER_IITB_MSGID autolearn=disabled version=3.4.1 X-Spam-Pyzor: Reported 0 times. X-Envelope-From: prateekag@cse.iitb.ac.in X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received: from unknown (HELO ldns2.iitb.ac.in) (10.200.1.25) by ldns2.iitb.ac.in with SMTP; 4 Dec 2020 14:50:44 +0530 Received: from mail.cse.iitb.ac.in (miller.cse.iitb.ac.in [10.129.3.1]) by ldns2.iitb.ac.in (Postfix) with ESMTP id 9FB983414DC for ; Fri, 4 Dec 2020 14:50:44 +0530 (IST) Received: by mail.cse.iitb.ac.in (Postfix, from userid 5001) id 9CFEFF40D1E; Fri, 4 Dec 2020 14:50:44 +0530 (IST) Received: from www.cse.iitb.ac.in (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.cse.iitb.ac.in (Postfix) with ESMTPSA id D995AF40D15; Fri, 4 Dec 2020 14:50:43 +0530 (IST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 04 Dec 2020 14:50:43 +0530 From: prateekag To: Thomas Monjalon Cc: dev@dpdk.org, Stephen Hemminger In-Reply-To: <4079538.OZV0JHgpTk@thomas> References: <77fa0d526982e5fd0a15b293599d973c@cse.iitb.ac.in> <7271567.L1mZBfcePy@thomas> <4079538.OZV0JHgpTk@thomas> Message-ID: <6c909d2e48de9a4bd88f1783798d06c7@cse.iitb.ac.in> X-Sender: prateekag@cse.iitb.ac.in User-Agent: Roundcube Webmail/1.3.9 X-Mailman-Approved-At: Fri, 04 Dec 2020 10:25:21 +0100 Subject: Re: [dpdk-dev] Printfs in 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 can only look at this problem a week later, If someone wants to correct this, they may go ahead. The problem is how to convert an integer to string and what functions to use to create the final string. "itoa" is not a part of C standard, writing custom itoa may pollute the code. strcpy is asyc-safe afaik. The strings in which signal number is not required to printed can be directly converted to write call. Prateek Agarwal On 2020-12-03 02:11, Thomas Monjalon wrote: > 01/12/2020 10:24, Thomas Monjalon: >> 01/12/2020 04:39, prateekag: >> > printf is not signal safe and may lead to deadlock if kept in signal handler >> > and >> > signal comes in two quick succession. It will not lead to incorrect behavior >> > and it is a highly unlikely event. And an expert may understand why this >> > issue happened. Is it worthwhile to change these printfs to unix I/O write >> > call? >> >> Thank you for reporting. >> Please could you describe which files and functions you are talking about? > > I've received a private reply: > Filenames: > testpmd.c > test_pmd_perf.c > evt_main.c > pdump/main.c > Function name: > signal_handler > > > I am OK with removing these printfs. > > Do you want to do the patch with the explanation?