public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] U-Boot Timer Qualification
Date: Thu, 23 Apr 2009 10:01:14 +0200	[thread overview]
Message-ID: <20090423080114.GA2072@localhost.localdomain> (raw)
In-Reply-To: <20090422221800.D3EF883420E8@gemini.denx.de>

On Thu, Apr 23, 2009 at 12:18:00AM +0200, Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <20090422212816.GA18705@game.jcrosoft.org> you wrote:
> >
> > > Who needs this, and why and when, and why didn't we need it the past?
> > a lot of actual timer are not correct and we have problem on network timeout
> > as example.
> 
> Hm... how muich of precision do we actuually need?

Well, I already complained about all such a testing on the IRC yesterday,
so I'm not going to repeat...

And if I got Jean-Christophe correctly he cares about "real world"
verification that timer code is written the right way.

> > So we need to known the precision of the timer to known the impact on all
> > timer depends part of u-boot as timeout or bitbanging stack
> > 
> > so when you have to respect some delay to init some chip or other you will to
> > known the delay you will have in reality. This will avoid you a lots of pain
> > during the dev
> 
> In my experience, no parts of the code actually care about precision
> of the timers, especially not when implementing delay loops or
> timeouts using udelay() which always includes static overhead. For
> example, the following two snippets of code are only in theory
> equivalent:
> 
> 	for (i=0; i < 100; ++i)
> 		udelay (10000);
> 
> versus
> 
> 	for (i=0; i < 1000; ++i) {
> 		for (j=0; j < 1000; ++j)
> 			udelay (1);
> 	}
> 
> But - is this really a problem? I am not aware of any place in the
> code where a tolerance of +/- 10% or maybe even more would matter.

Well, more interesting case to test is:

	reset_timer();
	while (get_timer() < 100000)
		udelay(10000);

to prove get_timer has no bad interference with udelay. Proposed method also
doesn't verify another corner case - timer {under,over}flow.

> Note: when you are implementing a bit-banging protcol that requires
> precise timings and run into problems, then this is not a problem with
> U-Boot timer accuracy, but with incorrect system design on your
> system.

Seconded, same point made on IRC.

Best regards,
	ladis

  reply	other threads:[~2009-04-23  8:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-22 20:49 [U-Boot] U-Boot Timer Qualification Jean-Christophe PLAGNIOL-VILLARD
2009-04-22 21:08 ` Wolfgang Denk
2009-04-22 21:28   ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-22 22:18     ` Wolfgang Denk
2009-04-23  8:01       ` Ladislav Michl [this message]
2009-04-23 14:52         ` [U-Boot] IRC log?, was: " Dirk Behme
2009-04-27 19:28         ` [U-Boot] " Mike Frysinger
2009-04-28 10:08           ` Ladislav Michl
2009-04-28 12:48             ` Mike Frysinger
2009-04-28 13:41               ` Wolfgang Denk
2009-04-28 15:53                 ` Mike Frysinger
2009-04-28 15:11               ` Ladislav Michl
2009-04-28 17:47                 ` Wolfgang Denk
2009-04-29 16:48                   ` Dirk Behme
2009-04-29 18:00                     ` Wolfgang Denk
2009-04-29 19:26                   ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-29 22:21                     ` Wolfgang Denk
2009-04-27 19:42 ` Mike Frysinger

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=20090423080114.GA2072@localhost.localdomain \
    --to=ladis@linux-mips.org \
    --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