Subject: Re: Phylib polling when doing mdio_read will cause system response and transfer speed drop

From: Wolfram Sang <[email-masked]>
Date: Mon, 19 Apr 2010 09:21:21 +0200

On Tue, Apr 13, 2010 at 05:27:33PM -0700, Bryan Wu wrote:

> I found the root cause is the polling operation in the mdio_read 
> function. When we transfer large files, we experienced many times of 
> timeout issue. So I got several question here:

Same here, I saw the 'MDIO Timeout' Message occasionally.

> 1. Need I return -ETIMEDOUT when polling timeout. If I don't return 
> -ETIMEOUT, the performance improved a lot. And after check other drivers, 
> some don't return anything, some return 0, some return negative value. 
> What's the rule for this mdio_read polling timeout case.
>
> 2. How to do polling busy waiting? Normally, we won't buys wait very long 
> in polling. But hardware is not perfect every time. Running cpu_relax() 
> 10000 times in polling will cause our system response very bad when 
> hardware don't set the flag as we expected. Maybe udelay(25) 10 times or 
> msleep(1) 10 times is better than that.
>
> I got a patch to recover this issue,  
> http://kernel.ubuntu.com/git?p=roc/ubuntu-lucid.git;a=commitdiff;h=5d77e3409b319ca84183bf1d2fd158a9c864e03f.

Can't help with the details, but the patch seems to help here, too
(and not only because of the removed printk ;)).

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |