public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb•de>
To: linuxppc-dev@ozlabs•org
Cc: Segher Boessenkool <segher@kernel•crashing.org>,
	benh@kernel•crashing.org, Nathan Lynch <ntl@pobox•com>,
	mcarlson@broadcom•com, Michael Chan <mchan@broadcom•com>,
	netdev <netdev@vger•kernel.org>
Subject: Re: Strange tg3 regression with UMP fw. link reporting
Date: Fri, 8 Aug 2008 11:21:30 +0200	[thread overview]
Message-ID: <200808081121.30795.arnd@arndb.de> (raw)
In-Reply-To: <31233EB5-037E-4615-95C9-7C816E510752@kernel.crashing.org>

On Friday 08 August 2008, Segher Boessenkool wrote:
> > I don't know yet for sure what happens, but a quick look at the commit
> > seems to show that the driver synchronously spin-waits for up to 2.5ms
> 
> That's what the comment says, but the code says 2.5 _seconds_:
> 
> +       /* Wait for up to 2.5 milliseconds */
> +       for (i = 0; i < 250000; i++) {
> +               if (!(tr32(GRC_RX_CPU_EVENT) & GRC_RX_CPU_DRIVER_EVENT))
> +                       break;
> +               udelay(10);
> +       }
> 
> (not that milliseconds wouldn't be bad already...)

It can potentially be even much longer, because each udelay will wait
for *more* than 10 microseconds, and tr32() is an mmio read that takes
additional time, possibly in the order of microseconds as well.

The correct way to implement a timeout like this would be to use
time_before() in the condition, aside from better not doing a busy-loop
in the first place.

	Arnd <><

      parent reply	other threads:[~2008-08-08  9:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08  7:35 Strange tg3 regression with UMP fw. link reporting Benjamin Herrenschmidt
2008-08-08  8:58 ` Segher Boessenkool
2008-08-08  9:18   ` Benjamin Herrenschmidt
2008-08-08 18:43     ` Matt Carlson
2008-08-08 15:20       ` Michael Chan
2008-08-08 22:05       ` Benjamin Herrenschmidt
2008-08-08 20:20         ` Michael Chan
2008-08-08 21:25     ` Nathan Lynch
2008-08-08  9:21   ` Arnd Bergmann [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=200808081121.30795.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=mcarlson@broadcom$(echo .)com \
    --cc=mchan@broadcom$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=ntl@pobox$(echo .)com \
    --cc=segher@kernel$(echo .)crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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