From: Artem Bityutskiy <dedekind1@gmail.com>
To: Johan Gunnarsson <johan.gunnarsson@axis.com>
Cc: linux-mtd@lists.infradead.org, jespern@axis.com
Subject: Re: [PATCH 0/2] use hrtimer in nand_wait
Date: Tue, 22 May 2012 10:23:29 +0300 [thread overview]
Message-ID: <1337671409.2483.98.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <1337589758-8775-1-git-send-email-johan.gunnarsson@axis.com>
[-- Attachment #1: Type: text/plain, Size: 1502 bytes --]
On Mon, 2012-05-21 at 10:42 +0200, Johan Gunnarsson wrote:
> I've narrowed it down to the nand_wait routine and its dependency on a
> reliable jiffies counter. Sadly, jiffies is not reliable when handling
> of timer interrupts are delayed or even completely discarded. If
> interrupts are disabled for, say, 3 timer periods, jiffies will stop
> counting during this time and have a very fast increment by 3 when
> interrupts are later enabled.
I can follow up to this point.
> This combined with unfortunate timing can cause the timeout loop
> think a 20ms timeout is happening when just <0.1ms has passed in wall
> clock time.
What is you HZ? Let's say it is 100, then jiffie increments every 10ms,
right? How can it increment by 2 after 0.1 ms?
>
> To illustrate the jiffies/interrupt-relationship:
>
> Interrupts: | | | | | | |
> Jiffies: | | | ||| | | |
>
> This obviously only happen on multi-core CPUs, where the write and
> interrupts are executed by different cores simultaneously. Switching
> to hrtimer-based timeout solves this problem for me. I found a second
> (less serious) issue which included in the first patch.
Sorry, I do not understand why this happens only on SMP. Could you
please explain some more?
I do not disagree that we should stop using jiffies, if we can, I just
want to understand what is happening.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-05-22 7:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 8:42 [PATCH 0/2] use hrtimer in nand_wait Johan Gunnarsson
2012-05-21 8:42 ` [PATCH 1/2] mtd: nand: panic_nand_wait expects timeout in ms Johan Gunnarsson
2012-05-21 8:42 ` [PATCH 2/2] mtd: nand: use hrtimer to measure timeout in nand_wait{_ready, } Johan Gunnarsson
2012-05-22 7:53 ` Artem Bityutskiy
2012-05-22 8:52 ` Johan Gunnarsson
2012-05-22 10:25 ` Artem Bityutskiy
2012-05-22 14:24 ` Johan Gunnarsson
2012-05-22 17:10 ` Ivan Djelic
2012-05-22 18:21 ` Artem Bityutskiy
2012-05-23 6:39 ` Brian Norris
2012-05-23 8:36 ` Ivan Djelic
2012-05-23 8:14 ` Johan Gunnarsson
2012-05-22 7:23 ` Artem Bityutskiy [this message]
2012-05-22 8:37 ` [PATCH 0/2] use hrtimer in nand_wait Johan Gunnarsson
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=1337671409.2483.98.camel@sauron.fi.intel.com \
--to=dedekind1@gmail.com \
--cc=jespern@axis.com \
--cc=johan.gunnarsson@axis.com \
--cc=linux-mtd@lists.infradead.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 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).