public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2] time: Fix get_ticks being non-monotonic
Date: Wed, 14 Oct 2020 13:42:25 -0400	[thread overview]
Message-ID: <20201014174225.GB14816@bill-the-cat> (raw)
In-Reply-To: <20200909202456.233249-1-seanga2@gmail.com>

On Wed, Sep 09, 2020 at 04:24:56PM -0400, Sean Anderson wrote:

> get_ticks does not always succeed. Sometimes it can be called before the
> timer has been initialized. If it does, it returns a negative errno.
> This causes the timer to appear non-monotonic, because the value will
> become much smaller after the timer is initialized.
> 
> No users of get_ticks which I checked handle errors of this kind. Further,
> functions like tick_to_time mangle the result of get_ticks, making it very
> unlikely that one could check for an error without suggesting a patch such
> as this one.
> 
> This patch panics if we ever get an error. There are two cases in which
> this can occur. The first is if we couldn't find/probe the timer for some
> reason. One reason for this is if the timer is not available so early. This
> likely indicates misconfiguration. Another reason is that the timer has an
> invalid/missing device tree binding. In this case, panicing is also
> correct. The second case covers errors calling get_count. This can only
> occur if the timer is missing a get_count function (or on RISC-V, but that
> should be fixed soon).
> 
> Fixes: c8a7ba9e6a5
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/8c0d9833/attachment.sig>

  parent reply	other threads:[~2020-10-14 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 20:24 [PATCH v2] time: Fix get_ticks being non-monotonic Sean Anderson
2020-09-10 13:38 ` Simon Glass
2020-10-14 17:42 ` Tom Rini [this message]
2020-11-19 10:23   ` Michael Opdenacker
2020-11-21 23:07     ` Simon Glass
2021-03-01 16:40       ` Michael Opdenacker
2021-03-01 23:02         ` Sean Anderson

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=20201014174225.GB14816@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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