From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D1B2A0524; Wed, 5 May 2021 08:14:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EB2140040; Wed, 5 May 2021 08:14:09 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by mails.dpdk.org (Postfix) with ESMTP id 3989F4003C for ; Wed, 5 May 2021 08:14:07 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 99E8013AD; Wed, 5 May 2021 02:14:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 05 May 2021 02:14:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= NRNzFuBHWJ19yaYa+aixSTSQrXq8LkJD6SBK0QLqTGE=; b=CyHQ4bg6OopQmFWR oWZhzuXxsuaYRR21p8fAlC8BLPxiUpkpgvPJPxB89qAtqmp74xMEimVt6r2ncDhE 28QYTejZA766d0La+UUiZs/zVhPqD+RMmpiYZFNjnjDfRHJiA0Go+ECaEVJ1VnrO 05S1JZO14POuux/mJoqZLDaUmKpVpOXT8evi3aHKNgPsJFGrogwKWzVwPODEV6Jk DRhncg2AnnJMJ7SczoSiCjlIBpX5e6tRCmUrVlWi4ye4FpBbcEUfaFDqFSfxd17/ Sr4A7aRvCpEu0cz1wG1ip6TigYPm6YYneLpmX3qMlUuYK+NqRl8TNNhmXllV7bQZ PX4qiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=NRNzFuBHWJ19yaYa+aixSTSQrXq8LkJD6SBK0QLqT GE=; b=OThAz0d4aZwlRfkBB/5LX6v3U4OcSoeI13wEa7jm7DLo3CNrxX/a3Ndqm Z2Fvb5gUa2r02mlNiZXUk1Hh62X+BHSpwIYu7MsR6c9vdSq7A3vXjELrelNTQ2ye RogzMoLzh6KcUvzrpOaRPhJ+huv50yN02ShauAxHVgSS+jRn8ch4z9X7ClTu+K/c wdSQPLyfPSzIi9nrqi3Tu2rGCPGBr3N0KWX2zkD/XXxm/QQm+mCJlgKgYw+YdHCp JCjyi9s3HPjsO7wCtTt01rD5rcQPCI/FVfyvuNXJGTKH2fqnk7nm8bBk0mo37ngV PIE99qwXEJSzjWXlQfhPiE5FCIUNA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefjedguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkjghfggfgtgesthhqredttddtudenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpeehhefffffguefhveetueehveeggedtgeegieeuveefhfduiedt uefhjedthedtheenucffohhmrghinhepughivgdrnhgvthdpfhhrvggvsghsugdrohhrgh enucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 May 2021 02:14:03 -0400 (EDT) From: Thomas Monjalon To: "Min Hu (Connor)" , Morten =?ISO-8859-1?Q?Br=F8rup?= Cc: dev@dpdk.org, ferruh.yigit@intel.com, skori@marvell.com, jerinj@marvell.com Date: Wed, 05 May 2021 08:14:01 +0200 Message-ID: <8952614.77jy4Yh1ug@thomas> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35C61746@smartserver.smartshare.dk> References: <1619597563-56716-1-git-send-email-humin29@huawei.com> <3448381.piLNI76ssM@thomas> <98CBD80474FA8B44BF855DF32C47DC35C61746@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Subject: Re: [dpdk-dev] [PATCH v2] eal: fix use wrong time API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" 04/05/2021 21:12, Morten Br=F8rup: > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > > Sent: Tuesday, May 4, 2021 6:50 PM > >=20 > > 29/04/2021 04:10, Min Hu (Connor): > > > Currently, the mp uses gettimeofday() API to get the time, and used > > as > > > timeout parameter. > > > > > > But the time which gets from gettimeofday() API isn't monotonically > > > increasing. The process may fail if the system time is changed. > > > > > > This fixes it by using clock_gettime() API with monotonic > > attribution. > > > > > > Fixes: 783b6e54971d ("eal: add synchronous multi-process > > communication") > > > Fixes: f05e26051c15 ("eal: add IPC asynchronous request") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Chengwen Feng > > > Signed-off-by: Min Hu (Connor) > > > --- > > [...] > > > --- a/lib/eal/common/eal_common_proc.c > > > +++ b/lib/eal/common/eal_common_proc.c > > > - if (gettimeofday(&now, NULL) < 0) { > > > - RTE_LOG(ERR, EAL, "Cannot get current time\n"); > > > - goto no_trigger; > > > - } > > > - ts_now.tv_nsec =3D now.tv_usec * 1000; > > > - ts_now.tv_sec =3D now.tv_sec; > > > + clock_gettime(CLOCK_MONOTONIC, &ts_now); > >=20 > > Why not testing the return value? >=20 > Because it is guaranteed not to fail. Ref: > https://linux.die.net/man/3/clock_gettime > https://www.freebsd.org/cgi/man.cgi?query=3Dclock_gettime I see "return 0 for success, or -1 for failure". Where is it said it cannot fail? > > I think this change would not be appropriate after -rc1. > > If you agree, I will postpone to DPDK 21.08. >=20 > It does fix a serious bug, where IPC timeouts can incorrectly happen. And= this is not a theoretical bug; I have seen errors happen due to using the = wrong clock source in other projects. >=20 > However, I have no clue if these IPC library functions are important or n= ot. So I have no qualified opinion about postponing the change. I think nobody hit such bug with DPDK IPC.