From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/1] NET: Improve TFTP booting performance when CONFIG_USB_KEYBOARD
Date: Thu, 04 Jul 2013 00:48:44 +0200 [thread overview]
Message-ID: <20130703224844.AACB2380E6A@gemini.denx.de> (raw)
In-Reply-To: <51D45F4D.2010908@wwwdotorg.org>
Dear Stephen,
In message <51D45F4D.2010908@wwwdotorg.org> you wrote:
>
> > get_timer() is used by a number of network related services. For
> > information, just grep for it in the net/ and drivers/net/
> > directories. The "get_timer(0)" used in your code resets a global
> > resource, and has thus the potential of messing up a number of
> > timeouts running elsewhere in the network code. I wonder to which
> > extend this has actually been considered (and tested) ?
>
> I recall you mentioning this before, but can you expand on this a bit
> please?
>
> For the two platforms I'm familiar with (Tegra and BCM2835), the
> implementation of get_timer() is simply:
>
> unlong get_timer(ulong base)
> {
> ulong time = read_hw_register()
> time -= base;
> return time;
> }
>
> There's no global state involved. Is this implementation of get_timer()
> wrong somehow? I'm having a hard time envisaging what kind of global
> state it's supposed to maintain.
It appears you are (basically) right. Eventually I remember an old
implementation that has been fixed since.
I checked all implementations I could find (all 102 of them) and they
all behave as you showed in your example, i. e. harmless.
An exception is "arch/arm/cpu/sa1100/timer.c" which does not respect
the "base" argument at all, i. e. which is broken.
> I always thought that every user of get_timer() was supposed to do
> something like:
>
> ulong base = get_timer(0);
> ... work to be timed
> ulong time_diff = get_timer(base);
>
> in other words, every user maintains their own base variable, and hence
> get_timer(0) doesn't affect any other users.
Yes, you are right. Sorry for causing confusion here.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Accident: A condition in which presence of mind is good, but absence
of body is better.
prev parent reply other threads:[~2013-07-03 22:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 10:34 [U-Boot] [PATCH v4 1/1] NET: Improve TFTP booting performance when CONFIG_USB_KEYBOARD Jim Lin
2013-07-03 11:20 ` Wolfgang Denk
2013-07-03 17:28 ` Stephen Warren
2013-07-03 22:48 ` Wolfgang Denk [this message]
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=20130703224844.AACB2380E6A@gemini.denx.de \
--to=wd@denx.de \
--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;
as well as URLs for NNTP newsgroup(s).