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 6C1AF4247E for ; Wed, 25 Jan 2023 03:47:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62A5641181; Wed, 25 Jan 2023 03:47:36 +0100 (CET) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by mails.dpdk.org (Postfix) with ESMTP id 598B840223 for ; Wed, 25 Jan 2023 03:47:34 +0100 (CET) Received: by mail-pg1-f179.google.com with SMTP id r18so12528232pgr.12 for ; Tue, 24 Jan 2023 18:47:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=i3ie+3mLEHnlGBfiPfCV3iAG5RUYZuWBxWsAU3bAxPk=; b=AWJtUlreIiHz6bmU3++/mrbO360mVjresiwuHtRdNFOfmAFribp5RTe0yP3ANpmW+r RVQv8VDg8qQFkz83UpNXWuCkSyM+qp1v+bs/IlokY9qfXdN9JbGynkP7BCJEygeiVyha wcVqNmyUVQzmCNQ2FSUFPAMcKR6VjsUId48kxUFvtPSf/nZ2wqqZMSqWSo964YSwRyuu rOQdhe7cpqwfoMG4pMIuKn6BatlQnE3zD7Y7IAxN07F2JHQ0qMXjHrY8c2kqLIliLZaX 32I48bYqMdCAzUSHVatvqxHLcWsKRhm6s1/E9plNyvsCjZaRnZz2IYU/9aQEY7qsoLMJ V7cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i3ie+3mLEHnlGBfiPfCV3iAG5RUYZuWBxWsAU3bAxPk=; b=RTgtfGFFMoAsZjbdXF9poe02OUFL6RnCOQxshyBObt2xC92fFGdpGtHiSBTleQwhoH m0D+ugig1dIJw98NBj8ET0D6TCsLbH6khRMgi7wXKk/mzR05K+5y9zgHXxsGQPUeupPP LKRUMAg6+bKikhod73I/wvLhvq3g2Q+4sJZ7VDnDFQij2zjy4rWxGguTyc2ggEjpGOrw njfmIhCPv+oIV3PG16H4bnRdIgUzLsbPaXo+RZovVDqWewLFSfimN7eu1pIsrL3I2cdo 1viRQFYk5WB0bnWWQ3Z3IWRM3u8IpZRVmnGu7D4zQxJxG4lZmmTes3MGQWxhU/KliDIk ruqg== X-Gm-Message-State: AFqh2ko9lzHlzHBFWj2miwd+SLy4jdPEUpfM4isuigpSWGtp2+PWX1ix Gc1ACbq4Ss9+1/Q2VYZpfLQweA== X-Google-Smtp-Source: AMrXdXtyuQ653F2AuMm/FVqN6axib5qpN/4bSrpXRard4u3CgzviYm/raigMW+CDuKtQUa7cfX8QiA== X-Received: by 2002:a05:6a00:4519:b0:58d:f047:53b7 with SMTP id cw25-20020a056a00451900b0058df04753b7mr24687784pfb.3.1674614853182; Tue, 24 Jan 2023 18:47:33 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id 9-20020a621609000000b0058e24050648sm2416538pfw.12.2023.01.24.18.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 18:47:33 -0800 (PST) Date: Tue, 24 Jan 2023 18:47:31 -0800 From: Stephen Hemminger To: Erik Gabriel Carrillo Cc: jerinj@marvell.com, dev@dpdk.org, stable@dpdk.org Subject: Re: [PATCH] eventdev/timer: fix overflow issue Message-ID: <20230124184731.29b7de96@hermes.local> In-Reply-To: <20230124160945.3003303-1-erik.g.carrillo@intel.com> References: <20230124160945.3003303-1-erik.g.carrillo@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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.