[lkml]   [2019]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectquery on linux kernel timer implementation
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
( 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.


 \ /
  Last update: 2019-07-31 13:43    [W:0.023 / U:1.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site