linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arul Jeniston <arul.jeniston@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, arul_mc@dell.com
Subject: Re: [PATCH] FS: timerfd: Fix unexpected return value of timerfd_read function.
Date: Thu, 5 Sep 2019 14:18:17 +0530	[thread overview]
Message-ID: <CACAVd4gRoQih6f_K7kMzr=AwA_DvP0OksxBKj1bGPsP2F_9sFg@mail.gmail.com> (raw)
In-Reply-To: <CACAVd4jT4Ke7giPmKSzt+Wo3Ro-g9zWDRz_GHaRcs0Nb3_rkBw@mail.gmail.com>

hi Tglx,

When we adjust the date setting using date command we observed
'timerfd_read()' on CLOCK_REALTIME (TFD_TIMER_ABSTIME flag is set)
returns 0.
we don't see any hardware influence here and we are able to recreate
it consistently. Is it expected? if yes, isn't it something to be
documented in timerfd read() man page?

Steps followed to make timerfd read to return 0.

1. run the following script in background to move the date front and back

root@sonic:~/test/exp2# cat ./clock_change_test.sh
while [ 1 ]
do
date --set="04 sep 2019 09:50:21" > /dev/null
date --set="04 sep 2019 09:58:21" > /dev/null
done

root@sonic:~/test/exp2# ./clock_change_test.sh

2. Execute the following program to do read on CLOCK_REALTIME timer.

root@sonic:~/test/exp2# cat timerfdtest.c
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/epoll.h>
#include <sys/timerfd.h>

int main()
{
        int tfd;
        struct itimerspec ts;
        tfd = timerfd_create(CLOCK_REALTIME, 0);
        ts.it_interval.tv_sec = 0;
        ts.it_interval.tv_nsec = 10;
        ts.it_value.tv_sec = 10;
        ts.it_value.tv_nsec = 1000;
        if (timerfd_settime(tfd, TFD_TIMER_ABSTIME, &ts, NULL) < 0) {
          return EXIT_FAILURE;
        }

        while(1) {
                uint64_t noftimeo;
                if (read(tfd, &noftimeo, sizeof(noftimeo)) == 0) {
                   printf("read returned 0 nooftimeo:%d\n", noftimeo);
                }
        }
        /* not reached */
        return EXIT_SUCCESS;
}

3. Observed the following read failure logs within few minutes.
root@sonic:~/test/exp2# ./timerfdtest
read returned 0 nooftimeo:1392


Regards,
Arul


On Tue, Aug 20, 2019 at 3:12 PM Arul Jeniston <arul.jeniston@gmail.com> wrote:
>
> Hi Tglx,
>
> > Can you please boot something more recent - at least 4.19 LTS - on that
> > machine and let it run for a couple of days to check whether there are 'TSC
> > ADJUST' related entries in dmesg?
>
> Sure. Would check and update.
>
> Regards,
> Arul

  reply	other threads:[~2019-09-05  8:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16  8:32 [PATCH] FS: timerfd: Fix unexpected return value of timerfd_read function. 'hrtimer_forward_now()' returns zero due to bigger backward time drift. This causes timerfd_read to return 0. As per man page, read on timerfd is not expected to return 0. This patch fixes this problem. Signed-off-by: Arul Jeniston <arul.jeniston@gmail.com> arul.jeniston
2019-08-16  9:05 ` [PATCH] FS: timerfd: [Trimmed unreadable long subject line ] Thomas Gleixner
2019-08-16 10:22 ` [PATCH] FS: timerfd: Fix unexpected return value of timerfd_read function Arul Jeniston
2019-08-16 10:45   ` Thomas Gleixner
2019-08-16 16:55     ` Arul Jeniston
2019-08-16 17:00       ` Arul Jeniston
2019-08-16 21:17         ` Thomas Gleixner
     [not found]           ` <CACAVd4hT6QYtgtDsBcgy7c_s9WVBAH+1m0r5geBe7BUWJWYhbA@mail.gmail.com>
2019-08-17 19:23             ` Thomas Gleixner
2019-08-19  6:07               ` Arul Jeniston
2019-08-19  8:04                 ` Thomas Gleixner
2019-08-19 14:25                   ` Arul Jeniston
2019-08-19 14:52                     ` Thomas Gleixner
2019-08-19 15:26                       ` Arul Jeniston
2019-08-19 15:59                         ` Thomas Gleixner
     [not found]                           ` <CACAVd4iRN7=eq_B1+Yb-xcspU-Sg1dmMo_=VtLXXVPkjN1hY5Q@mail.gmail.com>
2019-08-19 18:29                             ` Thomas Gleixner
2019-08-20  6:11                               ` Arul Jeniston
2019-08-20  8:49                                 ` Thomas Gleixner
2019-08-20  9:42                                   ` Arul Jeniston
2019-09-05  8:48                                     ` Arul Jeniston [this message]
2019-09-05 15:34                                       ` Thomas Gleixner
2019-09-06 16:36                                         ` Arul Jeniston
2019-09-07 14:38                                           ` Thomas Gleixner
2019-11-05  5:01                                             ` Arul Jeniston
2019-11-05 10:01                                               ` Thomas Gleixner
2019-11-06  3:38                                                 ` Arul Jeniston
2020-02-12 18:14                                                   ` Arul Jeniston
2020-02-13 12:11                                                     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACAVd4gRoQih6f_K7kMzr=AwA_DvP0OksxBKj1bGPsP2F_9sFg@mail.gmail.com' \
    --to=arul.jeniston@gmail.com \
    --cc=arul_mc@dell.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).