All of lore.kernel.org
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: Timer on i.MX28 moving backwards
Date: Fri, 7 Sep 2018 10:38:04 +0200	[thread overview]
Message-ID: <20180907083804.yo65kinfwvm4esdz@pengutronix.de> (raw)
In-Reply-To: <20180907072105.m47r3rjf2dd3jlv6@pengutronix.de>

On Fri, Sep 07, 2018 at 09:21:05AM +0200, Uwe Kleine-K?nig wrote:
> On Thu, Sep 06, 2018 at 10:39:25PM +0100, Russell King - ARM Linux wrote:
> > On Thu, Sep 06, 2018 at 10:02:02PM +0200, Uwe Kleine-K?nig wrote:
> > > +cycle_t mxs_clocksource_mmio_readl_down(struct clocksource *c)
> > > +{
> > > +	cycle_t ret = ~(cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
> > > +	trace_printk("time = %llx\n", ret);
> > 
> > I think it may be worth re-running your test with:
> > 
> > 	u32 one, two;
> > 
> > 	one = readl_relaxed(to_mmio_clksrc(c)->reg);
> > 	two = readl_relaxed(to_mmio_clksrc(c)->reg);
> > 	trace_printk("time=0x%08x:0x%08x\n", one, two);
> > 
> > 	return ~(cycle_t)two & c->mask;
> > 
> > and compare the values not only between each call but also between
> > each read of the register.  It could be a synchronisation issue when
> > reading the timer register, in which case you may find just one read
> > is incorrect.
> 
> Good idea, this is a part of a trace I captured with this implemented:
> 
>        mrp62439d-224   [000] d..h2..   790.936689: mxs_clocksource_mmio_readl_down: time = 0x948e3d1a:0x948e3d14
>        mrp62439d-224   [000] .......   790.936689: mxs_clocksource_mmio_readl_down: time = 0x948e4d26:0x948e4d20
>        mrp62439d-224   [000] .......   790.936904: mxs_clocksource_mmio_readl_down: time = 0x948e3690:0x948e368a
> 
> hmm, I'm unsure what to think now.

To clearify my (obviously too short) mail:

Judging form a trace over 43s the two consecutive reads always correctly
yield a decrementing counter as expected. But there is not always the
expected monotonicity between consecutive calls to
clocksource_mmio_readl_down.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2018-09-07  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 20:02 Timer on i.MX28 moving backwards Uwe Kleine-König
2018-09-06 21:39 ` Russell King - ARM Linux
2018-09-07  7:21   ` Uwe Kleine-König
2018-09-07  8:38     ` Uwe Kleine-König [this message]
2018-09-07  9:08       ` Russell King - ARM Linux
2018-09-07 10:00         ` Uwe Kleine-König

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=20180907083804.yo65kinfwvm4esdz@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=linux-arm-kernel@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 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.