U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/1] NET: Improve TFTP booting performance when CONFIG_USB_KEYBOARD
Date: Wed, 03 Jul 2013 11:28:45 -0600	[thread overview]
Message-ID: <51D45F4D.2010908@wwwdotorg.org> (raw)
In-Reply-To: <20130703112023.6172D380A2C@gemini.denx.de>

On 07/03/2013 05:20 AM, Wolfgang Denk wrote:
> Dear Jim Lin,
> 
> In message <1372847667-31928-1-git-send-email-jilin@nvidia.com> you wrote:
>> TFTP booting is slow when a USB keyboard is installed and
>> CONFIG_USB_KEYBOARD is defined.
>> The fix is to change Ctrl-C polling to every second when NET transfer
>> is running.
> 
> I'm not sure if we can accept this implementation.
> 
>> +#ifdef CONFIG_USB_KEYBOARD
>> +		/*
>> +		 * Reduce ctrl-c checking to 1 second once
>> +		 * to improve TFTP boot performance.
>> +		 */
>> +		ctrlc_t = get_timer(kbd_ctrlc_tms);
>> +		if (ctrlc_t > CONFIG_SYS_HZ) {
>> +			ctrlc_result = ctrlc();
>> +			kbd_ctrlc_tms = get_timer(0);
>> +		} else {
>> +			ctrlc_result = 0;
>> +		}
>> +		if (ctrlc_result) {
>> +#else
> 
> 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.

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.

  reply	other threads:[~2013-07-03 17:28 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 [this message]
2013-07-03 22:48     ` Wolfgang Denk

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=51D45F4D.2010908@wwwdotorg.org \
    --to=swarren@wwwdotorg.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