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 F33A94247D; Wed, 25 Jan 2023 03:47:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93E4140223; Wed, 25 Jan 2023 03:47:35 +0100 (CET) Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by mails.dpdk.org (Postfix) with ESMTP id 587FB40150 for ; Wed, 25 Jan 2023 03:47:34 +0100 (CET) Received: by mail-pg1-f175.google.com with SMTP id b6so12542095pgi.7 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=RF2wvyrv3fabgWXLIPEAEG0xn6ASUbvkyK5zAX8Mq7mQFim5QE0LJ+sth8JTW1ESnK skVF6TqN5ogUE7/OElQO7aP+W1yMEajhrUC6JXU7y2C/PteMzym0p2Vptqju6H6YCAYu hVL6mD/mVmynib2/NDBTYJJQjLuP++KdWSFBHrx6HfgZjUFc9BefD8mdQIiUYdI0dkpC LvZ/GVF8AYxQswo4+gnMgeRfNsXqKB1DOYGd9m/C7bCoeKrOvkocEDAC8n8yKa2wlqq6 U/I91cK2RfzyBss2BqVaBDHTn6qw5t7ecnuQ7ZoYT5DoP+gTIE6GcDOPgc8ulTk0nd+U sPyQ== X-Gm-Message-State: AFqh2krXHq+Bgtajp69n+hw3F3h8H36uFIMScfcsiUwnop23VulGgpl7 5aMnJouYVx+T6GWtzPU3K75H6w== 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: 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 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.