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 EA62C4247A; Wed, 25 Jan 2023 06:07:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8FEA740223; Wed, 25 Jan 2023 06:07:44 +0100 (CET) Received: from mail-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174]) by mails.dpdk.org (Postfix) with ESMTP id DF54E40150; Wed, 25 Jan 2023 06:07:42 +0100 (CET) Received: by mail-vk1-f174.google.com with SMTP id z190so8684997vka.4; Tue, 24 Jan 2023 21:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=iASKCc0AkN2uIE8p8OLdwYA6WzINw4vbh5x5BGOYG9Y=; b=ij4riV/lhLGdTKrhFG9ZeQjBqBJ9RoDr6IWRcKEstkFPRBwnrhchfpjdIdKbhXbbpd winksfs/CTsz26sMs1gzYiO3I4sEYhN0+jdbyADN4Z94oCtDw+AHoQkRwPgDqreWe2W0 VuafjIqCxQ0hNEo8b2xQ+9Tjn436mibkO6UOnX4W8ID8xvDK2T7Kw7RrMRMOAGc2mqdZ UQWi31T7ZJ9omX4Rgg5M0vIj5aORH41eLcaPoqfI3VP5zIAa/Ggxu1TUz4m4SKL7+mb3 FntdBhEIt7bYueCQt/8ktiPKgD0pYZqEHT8tduVMCycSiana0qTJw46dBS1fAWzH6ymp j4WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iASKCc0AkN2uIE8p8OLdwYA6WzINw4vbh5x5BGOYG9Y=; b=eimrQPMcg6j4m1L8Xkpiw9eT4V1YR5p1fbxiop/zGvCYyI+OHH7LKLOz29unXPbyO1 ydmieLOA7KFxMuc9dgrxv5dFx+EKA185Dul/UZEBII1qHiW9rjsWhitPwbmQcgf4KlKd EZVTzPBSA1hVw25IzOTvcozbblXiwgHAhrk0rQpDauqvbS/KAeo1CwymNvrSkr0OrBmc 8s/XiUktw7aZ3lv63Dool9vRF6dzYIz09andncaDqSwdOyMW9UIejVIaYtSTsfmEq9Ns VokxNLTCPindeta6znNxXwEUzKzl9uFu4R6slqWG3NGFN9hjO4LiKLUbwR0vumY2UzPw o52A== X-Gm-Message-State: AFqh2kpC0XVr9/zx6Pza1DjCpEK2FJpBTXYMBi6enPOVkVtlCOBmaN27 +B1QrRDFcf/6EI5JnIarKGgYAJyQVhDvdpcJb/E= X-Google-Smtp-Source: AMrXdXvEAT4DQBrIgUeauQ0miZTh+rwFntu/o5nApbmANH78mGpYE2JVMAbnQVv5w3yysABE2tTRxDQTdECb9crSFZ4= X-Received: by 2002:a1f:9e0d:0:b0:3e1:9d4e:e7d7 with SMTP id h13-20020a1f9e0d000000b003e19d4ee7d7mr3676810vke.20.1674623262234; Tue, 24 Jan 2023 21:07:42 -0800 (PST) MIME-Version: 1.0 References: <20230124160945.3003303-1-erik.g.carrillo@intel.com> <20230124184731.29b7de96@hermes.local> In-Reply-To: <20230124184731.29b7de96@hermes.local> From: Jerin Jacob Date: Wed, 25 Jan 2023 10:37:16 +0530 Message-ID: Subject: Re: [PATCH] eventdev/timer: fix overflow issue To: Stephen Hemminger Cc: Erik Gabriel Carrillo , jerinj@marvell.com, dev@dpdk.org, stable@dpdk.org Content-Type: text/plain; charset="UTF-8" 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 On Wed, Jan 25, 2023 at 8:17 AM Stephen Hemminger wrote: > > On Tue, 24 Jan 2023 10:09:45 -0600 > Erik Gabriel Carrillo wrote: > > > The software timer adapter converts event timer timeout ticks to a > > number of CPU cycles at which an rte_timer should expire. The > > computation uses integer operations that can result in overflow. > > > > Use floating point operations instead to perform the computation, and > > convert the final result back to an integer type when returning. Also > > move the logic that checks the timeout range into the function that > > performs the above computation. > > > > Fixes: 6750b21bd6af ("eventdev: add default software timer adapter") > > Cc: stable@dpdk.org > > Don't like this solution. > Floating point is slow and inaccurate. > You can do it with fixed point math if you are careful. Looks like Stephan replied to v1 hence comment is not showing up here https://patches.dpdk.org/project/dpdk/patch/20230124204555.3022361-1-erik.g.carrillo@intel.com/ @Erik Gabriel Carrillo Can be following moved to slow path ? + cycles_per_nsec = (double)rte_get_timer_hz() / NSECPERSEC;