From: Scott Wood <oss@buserror.net>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
stuart.yoder@nxp.com, linux-arm-kernel@lists.infradead.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585
Date: Fri, 01 Jul 2016 01:51:45 -0500 [thread overview]
Message-ID: <1467355905.32358.31.camel@buserror.net> (raw)
In-Reply-To: <5771267D.7030102@arm.com>
On Mon, 2016-06-27 at 14:13 +0100, Marc Zyngier wrote:
> On 22/06/16 02:45, Scott Wood wrote:
> >
> > On Fri, 2016-05-13 at 11:24 +0100, Marc Zyngier wrote:
> > >
> > > On Thu, 12 May 2016 23:37:39 -0500
> > > Scott Wood <oss@buserror.net> wrote:
> > >
> > > > +#ifdef CONFIG_ARM64
> > > > +static __always_inline void rewrite_tval(const int access,
> > > > + unsigned long evt, struct clock_event_device *clk)
> > > > +{
> > > > + u64 cval_old, cval_new;
> > > > + int timeout = 200;
> > > > +
> > > > + do {
> > > > + cval_old = __arch_counter_get_cntvct();
> > > > + arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL,
> > > > evt,
> > > > clk);
> > > > + cval_new = __arch_counter_get_cntvct();
> > > Don't you need to guarantee the order of accesses here?
> > I'm not 100% sure. The erratum workaround sample code doesn't show any
> > barriers, and adding more barriers could make it harder for the loop to
> > successfully complete. There's already a barrier after the write, so the
> > only
> > concern should be whether the timer read could be reordered after the
> > timer
> > write, which could cause the loop to exit even if the write was bad. Do
> > you
> > know if A53 or A57 will reorder a counter read relative to a tval write?
> I can't see any absolute guarantee that they wouldn't be reordered (but
> I have no insight on the micro-architecture either). I'd rather err on
> the side of caution here.
Adding another isb() before arch_timer_reg_write() causes the loop to not
complete with any reasonable timeout. A testing loop (that repeatedly writes
to TVAL (using the workaround code), reads it back, and checks that the value
read back is not greater than the value that was written) shows that the
workaround without the extra isb() is effective -- lots of assertions without
the workaround, and none with it -- but I'll go with the cval workaround
instead.
-Scott
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2016-07-01 6:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 4:37 [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585 Scott Wood
[not found] ` <1463114260-8724-1-git-send-email-oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-05-13 4:37 ` [PATCH v2 2/2] arm64: dts: Add timer erratum property for LS2080A and LS1043A Scott Wood
2016-05-13 10:24 ` [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585 Marc Zyngier
[not found] ` <20160513112441.200f4349-5wv7dgnIgG8@public.gmane.org>
2016-06-22 1:45 ` Scott Wood
[not found] ` <1466559926.22191.203.camel-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-06-25 7:16 ` Ding Tianhong
2016-06-27 13:13 ` Marc Zyngier
[not found] ` <5771267D.7030102-5wv7dgnIgG8@public.gmane.org>
2016-06-29 2:05 ` Scott Wood
2016-07-01 6:51 ` Scott Wood [this message]
2016-06-29 8:11 ` Hanjun Guo
[not found] ` <577382A3.7080509-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-06-29 8:24 ` Marc Zyngier
[not found] ` <577385C1.4030400-5wv7dgnIgG8@public.gmane.org>
2016-06-29 9:19 ` Hanjun Guo
2016-05-16 16:14 ` Rob Herring
2016-06-29 7:56 ` Hanjun Guo
[not found] ` <57737F24.5050906-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-06-29 8:19 ` Marc Zyngier
[not found] ` <57738485.4010602-5wv7dgnIgG8@public.gmane.org>
2016-06-29 8:31 ` Ding Tianhong
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=1467355905.32358.31.camel@buserror.net \
--to=oss@buserror.net \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=stuart.yoder@nxp.com \
--cc=will.deacon@arm.com \
/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).