[Bug 264867] kevent EVFILT_TIMER, timer expiration with twice the period

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 24 Jun 2022 09:38:28 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264867

            Bug ID: 264867
           Summary: kevent EVFILT_TIMER, timer expiration with twice the
                    period
           Product: Base System
           Version: 13.1-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: felice.tufo@gmail.com
 Attachment #234909 text/plain
         mime type:

Created attachment 234909
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=234909&action=edit
example reproducing the problem

I'm trying to use kevent to implement a periodic (50ms) event generator, the
application can tolerate a 10% error on the programmed period. I know that
FreeBSD is not a hard realtime OS, so just trying to evaluate how good it is
for my specific needs.

The problem is that every now and then (after some hours running) the timer
expires well after the programmed period and what makes me think I'm running
into an issue is that it happens *very* often with twice the programmed period
(100ms for a 50 ms programmed period... 40ms for a 20ms programmed period...
etc.).

Bug 264131 seems to be something similar, but that was deterministic behaviour.
Moreover I see the same problem on FreeBSD 12.2.

I attach the example I use to reproduce the problem (using multithreading to
make the issue happen faster).
The example is compiled with clang on an updated FreeBSD 13.1 machine, on a
skylake platform with 8-cores and 32Gb RAM, no other applications running (not
even sendmail).

Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.