From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Burakov, Anatoly" Subject: Re: [PATCH] eal: add asynchronous request API to DPDK IPC Date: Sat, 3 Mar 2018 12:29:47 +0000 Message-ID: <6239f74a-ef7e-961b-f518-a3167d68708e@intel.com> References: <92186ea34a31743ed76dbd9267f0586da22575f3.1519742486.git.anatoly.burakov@intel.com> <20180302104825.1e419ce7@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, jianfeng.tan@intel.com, konstantin.ananyev@intel.com To: Stephen Hemminger Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1F8F82BC7 for ; Sat, 3 Mar 2018 13:29:50 +0100 (CET) In-Reply-To: <20180302104825.1e419ce7@xeon-e3> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 02-Mar-18 6:48 PM, Stephen Hemminger wrote: > On Tue, 27 Feb 2018 14:59:29 +0000 > Anatoly Burakov wrote: > >> +rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts) >> { >> + struct sync_request *dummy; >> + struct async_request_shared_param *param = NULL; >> + struct rte_mp_reply *reply = NULL; >> + int dir_fd, ret = 0; >> + DIR *mp_dir; >> + struct dirent *ent; >> + struct timeval now; >> + struct timespec *end = NULL; >> + >> + RTE_LOG(DEBUG, EAL, "request: %s\n", req->name); >> + >> + if (check_input(req) == false) >> + return -1; >> + if (gettimeofday(&now, NULL) < 0) { >> + RTE_LOG(ERR, EAL, "Faile to get current time\n"); >> + rte_errno = errno; >> + return -1; >> + } > > gettimeofday is not a good API to use in DPDK. > It gets changed by NTP; if you have to use system time you want monotonic clock > We need current time because pthread_cond_timedwait() accepts current time. So it's either that, or reimplementing pthread_cond_timedwait() in DPDK using monotonic clock :) Unless, of course, there already are alternatives that use monotonic clock and that don't need other DPDK machinery (e.g. rte_malloc) to work (like rte_alarm callbacks). -- Thanks, Anatoly