netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] mv643xx_eth: fix SMI bus access timeouts
Date: Mon, 03 Nov 2008 15:25:52 -0500	[thread overview]
Message-ID: <490F5E50.1000904@garzik.org> (raw)
In-Reply-To: <20081101053220.GA13348@xi.wantstofly.org>

Lennert Buytenhek wrote:
> The mv643xx_eth mii bus implementation uses wait_event_timeout() to
> wait for SMI completion interrupts.
> 
> If wait_event_timeout() would return zero, mv643xx_eth would conclude
> that the SMI access timed out, but this is not necessarily true --
> wait_event_timeout() can also return zero in the case where the SMI
> completion interrupt did happen in time but where it took longer than
> the requested timeout for the process performing the SMI access to be
> scheduled again.  This would lead to occasional SMI access timeouts
> when the system would be under heavy load.
> 
> The fix is to ignore the return value of wait_event_timeout(), and
> to re-check the SMI done bit after wait_event_timeout() returns to
> determine whether or not the SMI access timed out.
> 
> Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
> ---
> The commit that introduced this was added in the .28 dev cycle, so
> this fix is for .28 only.  Thanks!
> 
> diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
> index d25a302..0e94ed3 100644
> --- a/drivers/net/mv643xx_eth.c
> +++ b/drivers/net/mv643xx_eth.c
> @@ -1065,9 +1065,12 @@ static int smi_wait_ready(struct mv643xx_eth_shared_private *msp)
>  		return 0;
>  	}
>  
> -	if (!wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp),
> -				msecs_to_jiffies(100)))
> -		return -ETIMEDOUT;
> +	if (!smi_is_done(msp)) {
> +		wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp),
> +				   msecs_to_jiffies(100));
> +		if (!smi_is_done(msp))
> +			return -ETIMEDOUT;
> +	}

applied



      parent reply	other threads:[~2008-11-03 20:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-01  5:32 [PATCH] mv643xx_eth: fix SMI bus access timeouts Lennert Buytenhek
2008-11-01  5:47 ` Roland Dreier
2008-11-01  5:53   ` Lennert Buytenhek
2008-11-01  5:48 ` Lennert Buytenhek
2008-11-03 20:25 ` Jeff Garzik [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=490F5E50.1000904@garzik.org \
    --to=jeff@garzik.org \
    --cc=buytenh@wantstofly.org \
    --cc=netdev@vger.kernel.org \
    /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).