From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0061.outbound.protection.outlook.com [104.47.40.61]) by dpdk.org (Postfix) with ESMTP id E19B91B11A; Fri, 2 Nov 2018 16:45:32 +0100 (CET) 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=Jmii6ZPnMlCX8pqqT34JL+a39h3uy0iPlEvG0rwVxTY=; b=cBCDAYw3YpLmKWkTwE9z8QM4lF7Ud7I0dPcot+IxbUgA+hb1n70Rc1+CSmtFcx6YtM8PUbqLIuHyoq+xcIdQYI0nxZwN9ADoHspq5AvF3ZBizWW/Oj+zv4b5XNV9Z9jQ8notGRjAf3UTW5n/AQ79wvXSxdBbzW8kt2PRUP0/O3A= Received: from BYAPR07MB4997.namprd07.prod.outlook.com (52.135.238.214) by BYAPR07MB4903.namprd07.prod.outlook.com (52.135.205.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.27; Fri, 2 Nov 2018 15:45:30 +0000 Received: from BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::2d56:eab:242f:fdfc]) by BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::2d56:eab:242f:fdfc%2]) with mapi id 15.20.1273.030; Fri, 2 Nov 2018 15:45:30 +0000 From: Jerin Jacob To: Ferruh Yigit CC: Bruce Richardson , "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] eal: fix API to get error string Thread-Index: AQHUcTWNU4juxDsXM0KZSomqKKn5TqU8nNeAgAAFHACAAAG/gA== Date: Fri, 2 Nov 2018 15:45:30 +0000 Message-ID: <20181102154517.GA20440@jerin> References: <20181031171928.61110-1-ferruh.yigit@intel.com> <20181102095046.GA32112@jerin> <6b854290-7835-4a05-1273-ddab0b740957@intel.com> In-Reply-To: <6b854290-7835-4a05-1273-ddab0b740957@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [115.113.156.3] x-clientproxiedby: BM1PR01CA0110.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::26) To BYAPR07MB4997.namprd07.prod.outlook.com (2603:10b6:a03:5b::22) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB4903; 6:yt4dNpQDumJcx4h2ccfZ8EEGGgizjEY2m5zAmW0UxJmhVWXPSVvsQrm57A9VqzWj62w2WLuqCdnm3rS+sX5hNJW75+E1rNWoQ3Ml0PW+mQItqqsn6ElRz9mHXa8MOrscIii58r3aqoBZt1/kLME3KINaaJ4Nxv6cu+IlC/Zpy0eaDKx1Ov+bdw1IXu4wOcXfdAndTbJgffqJDF0vSxVm/peLeF/K/gcIc/FCJ/PJgtbMddy6bGeWv4vk2eAfNCCFFYSrsuAicYpt1wHaie6+0ykhpyovnsYPndh+6GC7QeXLCXBkSxbn59ih8gg8Jj9poSbTmd3kI6R84kOsLfUZUdCbYHT5CKIsRGE52FhCqE5v30o2scZIx/x44/Bzk3FIEU8Gcr4lG7MS+uUjgw2NC7pBymjOtQqFKTKir3hUSaqoEMqpDNeRD4fDm8j0xa+pqrudbCsvDJ0DbDr35F8rqQ==; 5:KLuHjxi7QyHwJUOuqyNXrCtvpuevmilqMQI2Qenphqgmud9DxqzKDtp5IVnGdYvIQXuUW5xHCX1gpXfYeZycopz8+Vk6aOajzZSuVkGOhVNnM5GvH8RnACNiGW1dPBxJSwDvKjoOJrmmkFf3HgtA0htH2yZdRJ/+/IrrMvAjI2I=; 7:E33INVza3xqUVUUOYlOLfvZGpn0TQmAP659JYF2Ec5vMXAp6BUnQkdZYDxwZUlz2WkVz/kxYfvUhK3if8bRm5DzgdiXvCXUol8Fcjfs86zYuBH8pDNsszcvHUP0J4G+1HLq418J7/n97m1R7txYKig== x-ms-office365-filtering-correlation-id: 02663354-0c43-4f0e-b198-08d640da37b4 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4903; x-ms-traffictypediagnostic: BYAPR07MB4903: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(163750095850)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231382)(944501410)(4982022)(52105095)(93006095)(3002001)(10201501046)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:BYAPR07MB4903; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4903; x-forefront-prvs: 08444C7C87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(7916004)(39860400002)(346002)(376002)(136003)(396003)(366004)(13464003)(199004)(189003)(1076002)(2900100001)(106356001)(68736007)(8936002)(81166006)(81156014)(3846002)(8676002)(14454004)(6116002)(305945005)(72206003)(66066001)(33656002)(186003)(966005)(2906002)(97736004)(7736002)(105586002)(53936002)(6246003)(5660300001)(52116002)(316002)(478600001)(14444005)(26005)(6916009)(256004)(4326008)(11346002)(71190400001)(9686003)(6512007)(6306002)(71200400001)(446003)(42882007)(25786009)(476003)(229853002)(33896004)(54906003)(53546011)(102836004)(99286004)(575784001)(386003)(6506007)(6436002)(33716001)(76176011)(55236004)(6486002)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4903; H:BYAPR07MB4997.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: VM0+nID5EDhF6S9X84ya/vKa0Zc0i0IcEx43b4k1RnS5IhZk9nyMkbOD9yiccDGkU/I5XK2w3oA2oXiiDm8X6M8R5piE2m1f2vQoI7h6NCH6ySqjMqKRiSLLvOh6+t6ejZqngUMgJp0VJ9uuP2t5prsnoOIIkIRsR+cbjBoEGtj077CKQE+enPJo4PWzkY91SAapJhFZBJdhzds060y5czRBUVxPEBLKQc+DqkS5CpYI1JsAtR9Cg61BAlArON/K7e/AFQbVuFpHrJgrBSi9/MhV8GT86MvX2MlMP8kNc8GkdxR+aanZjCO04JXMVEB8HN5WuTtaCiNeElhgnPszbu/dgmeTlmVy6aAzw6ZNAmk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02663354-0c43-4f0e-b198-08d640da37b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2018 15:45:30.7390 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4903 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] eal: fix API to get error string X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 15:45:33 -0000 -----Original Message----- > Date: Fri, 2 Nov 2018 15:39:04 +0000 > From: Ferruh Yigit > To: Jerin Jacob > CC: Bruce Richardson , "dev@dpdk.org" > , "stable@dpdk.org" > Subject: Re: [dpdk-dev] [PATCH] eal: fix API to get error string > User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 > Thunderbird/52.9.1 >=20 >=20 > On 11/2/2018 9:51 AM, Jerin Jacob wrote: > > -----Original Message----- > >> Date: Wed, 31 Oct 2018 17:19:28 +0000 > >> From: Ferruh Yigit > >> To: Bruce Richardson > >> CC: dev@dpdk.org, Ferruh Yigit , stable@dpdk.o= rg > >> Subject: [dpdk-dev] [PATCH] eal: fix API to get error string > >> X-Mailer: git-send-email 2.17.2 > >> > >> External Email > >> > >> rte_strerror uses strerror_r(), and strerror_r() has two version of it= . > >> - XSI-compliant version, (_POSIX_C_SOURCE >=3D 200112L) && ! _GNU_SOU= RCE > >> - GNU-specific version > >> > >> Those two has different return types, so the exiting return type check > >> is not correct for GNU-specific version. > >> > >> And this is causing failure in errno_autotest unit test. > >> > >> Adding different implementation for FreeBSD and Linux. > >> > >> Fixes: 016c32bd3e3d ("eal: cleanup strerror function") > >> Cc: stable@dpdk.org > >> > >> Signed-off-by: Ferruh Yigit > >> --- > >> lib/librte_eal/common/eal_common_errno.c | 8 ++++++++ > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/lib/librte_eal/common/eal_common_errno.c b/lib/librte_eal= /common/eal_common_errno.c > >> index 56b492f5f..fbbc71b0b 100644 > >> --- a/lib/librte_eal/common/eal_common_errno.c > >> +++ b/lib/librte_eal/common/eal_common_errno.c > >> @@ -38,9 +38,17 @@ rte_strerror(int errnum) > >> case E_RTE_NO_CONFIG: > >> return "Missing rte_config structure"; > >> default: > >> +#ifdef RTE_EXEC_ENV_BSDAPP > >> if (strerror_r(errnum, ret, RETVAL_SZ) !=3D 0) > >> snprintf(ret, RETVAL_SZ, "Unknown erro= r%s %d", > >> sep, errnum); > >> +#else > >> + /* > >> + * _GNU_SOURCE version, error string is not al= ways > >> + * strored in "ret" buffer, need to use return= value > >> + */ > >> + ret =3D strerror_r(errnum, ret, RETVAL_SZ); > > > > Probably this will fail in musl c version. > > https://git.musl-libc.org/cgit/musl/tree/src/string/strerror_r.c >=20 > You are right, it will fail with musl. It may not be good idea to separat= e this > as BSD and Linux. >=20 > Instead of playing with strerror_r(), what about use strerror() and copy = string > to RTE_PER_LCORE(retval)? I will send a patch for it. I thought we used strerror_r() to enable thread safety.IMO, strerror() is not thread safe. >=20 > > > > Another alternative of this patch. > > > > http://patches.dpdk.org/patch/47706/ >=20 > I think this works, but I am not sure if it will have any side effect. An= d if we > want to add more functions to this file, that may be effected. I am more = to fix > this locally in rte_strerror() function. If we can then it is good. >=20 > > > >> +#endif > >> } > >> > >> return ret; > >> -- > >> 2.17.2 > >> >=20