From: Jonathan Cameron <jic23@kernel.org>
To: Ge Gao <GGao@invensense.com>, Lars-Peter Clausen <lars@metafoo.de>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: unreliable time function inside IRQ?
Date: Sat, 29 Mar 2014 11:05:55 +0000 [thread overview]
Message-ID: <5336A913.1040908@kernel.org> (raw)
In-Reply-To: <E7747D604FBC9F43A71AA431AFF447622577643E@IUSEXCH01.invcorp.invensense.com>
On 25/03/14 21:56, Ge Gao wrote:
> Dear all, Had to bring this question again to see whether anyone see
> the same problem. IIO fetches the timestamp inside IRQ using
> iio_get_time_ns(), which in turn call ktime_get_real_ts(&ts).
> However, I notice that the clock taken during interrupt is not always
> reliable. Sometimes the clock does not update. It is updated after
> one or more interrupts. It is very easy to reproduce. First find a
> hardware generating fixed interval of interrupts and using IIO driver
> to run it. Print out the timestamp. You could find that the timestamp
> distance is not always correct. For example, if you run a 5 Hz
> interrupt, most of time you will interrupt timestamp interval is
> around 200ms. However, sometimes, you could see interval sequence
> like ...200, 192, 208, 200, 200, 182, 218, 200....... I searched
> online and only found one result, which is exactly the same as I
> observed. Below is the link:
> http://stackoverflow.com/questions/17080516/unable-unreliable-to-use-clock-gettime-in-hard-irq-context
>
>
But no one answer the question.
> Is there anyone see the same problem? Thanks.
Hi Ge,
I'm afraid I don't know the cause of this.
It's also entirely possible that other interrupts are occurring that
are delaying the processing of some of your interrupts.
The slightly interesting bit is that you seem to be getting interrupts
apparently early sometimes. I would have expected a longer delay then
a shorter one if it was something else interfering.
It might be related to the implementation of the high resolution
timers on your platform. Perhaps they are being updated by a high
precision, low frequency source. Mind you, in that case I think
you'd expect to see only one value being out rather than the single
early value you appear to be seeing here. For some reason it seems
that occasionally you are handling interrupts earlier than the
majority of the time... Odd!
What is the platform you are seeing this on?
Jonathan
>
> Best Regards,
>
> Ge GAO
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-03-29 11:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 21:56 unreliable time function inside IRQ? Ge Gao
2014-03-29 11:05 ` Jonathan Cameron [this message]
2014-03-31 17:44 ` Ge Gao
2014-03-31 19:07 ` Lars-Peter Clausen
2014-03-31 21:25 ` Ge Gao
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=5336A913.1040908@kernel.org \
--to=jic23@kernel.org \
--cc=GGao@invensense.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.