[PATCH] eventdev/timer: fix overflow issue

Stephen Hemminger stephen at networkplumber.org
Wed Jan 25 03:47:31 CET 2023


On Tue, 24 Jan 2023 10:09:45 -0600
Erik Gabriel Carrillo <erik.g.carrillo at intel.com> 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 at 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.


More information about the stable mailing list