[PATCH] eventdev/timer: fix overflow issue

Jerin Jacob jerinjacobk at gmail.com
Wed Jan 25 06:07:16 CET 2023


On Wed, Jan 25, 2023 at 8:17 AM Stephen Hemminger
<stephen at networkplumber.org> wrote:
>
> 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.

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;


More information about the dev mailing list