linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* query on linux kernel timer implementation
@ 2019-07-31 11:41 Arul Jeniston
  0 siblings, 0 replies; only message in thread
From: Arul Jeniston @ 2019-07-31 11:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: arul_mc

Hi Team,

We have a query on the implementation linux timer implementation.

We have been running our application on linux kernel 4.9.168 (debian -
stretch) version. We use intel Rangeley 4 cpu system which has tsc
timer. Our application is an multi-threaded program which creates a
monotonic timer-fd  object, sets one second expiry time and does read
on the timer object infinitely. Once in a while, we face an anomaly in
the return value of timerfd read call.

As per the man page, read on timer fd
(http://man7.org/linux/man-pages/man2/timerfd_create.2.html) returns 8
or -1 but we observed read returns 0.

While debugging, we found timerfd_read function returns 0 when the
amount of negative tsc clock drift goes above certain boundary
condition. Through instrumentation, we found the following sequence of
code flow gets hit and causes timerfd_read to return 0.

Please find the below sequence of code that leads to this anomaly.

read(timerfd,…) --> timerfd_read() --->  hrtimer_forward_now --->
hrtimer_forward() return 0 if expiry time is greater than current
time. Timer object expire time becomes greater than current time due
to negative tsc clock drift.

We like to know whether returning 0 from timerfd_read is expected?

      - If yes, can we document it in timerfd read man page?

      - If no, can we do the needful to address this problem in Linux?


Please cc me in all the discussions happening on this post.

Regards,
Arul

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-31 11:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 11:41 query on linux kernel timer implementation Arul Jeniston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).