netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Leigh Brown <leigh@solinno.co.uk>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Nicolas Schichan <nschichan@freebox.fr>,
	Jason Cooper <jason@lakedaemon.net>,
	netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Florian Fainelli <florian@openwrt.org>,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: Spurious timeouts in mvmdio
Date: Wed, 04 Dec 2013 00:17:56 +0100	[thread overview]
Message-ID: <529E66A4.4050000@gmail.com> (raw)
In-Reply-To: <8d65780eb7bfe49bb0734a09f05f70a6@doppler.thel33t.co.uk>

On 12/04/2013 12:20 AM, Leigh Brown wrote:
> On 2013-12-03 22:45, Sebastian Hesselbarth wrote:
>> On 12/03/2013 09:57 PM, Leigh Brown wrote:
> [...]
>>> Nicolas' patch should fix the issue, but I prefer the following as it is
>>> more
>>> correct, as it only adjusts the timeout when calling
>>> wait_event_timeout().  As
>>> I said above,I believe the polling code is correct.
>>>
>>> diff --git a/drivers/net/ethernet/marvell/mvmdio.c
>>> b/drivers/net/ethernet/marvell/mvmdio.c
>>> index 7354960..b187c08 100644
>>> --- a/drivers/net/ethernet/marvell/mvmdio.c
>>> +++ b/drivers/net/ethernet/marvell/mvmdio.c
>>> @@ -92,6 +92,14 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)
>>>               if (time_is_before_jiffies(end))
>>>                   ++timedout;
>>>               } else {
>>> +            /*
>>> +             * wait_event_timeout does not guarantee a delay of at
>>> +             * least one whole jiffie, so timeout must be no less
>>> +             * than two.
>>> +             */
>>> +            if (timeout < 2)
>>> +                timeout = 2;
>>
>> If you always want to wait at least two jiffies, why not just increase
>> TIMEOUT makro to 20ms instead of messing here with it again?
>> As said on IRC log above, originally timeout was 100ms.
>
> You could do that, but would you not feel bad leaving a latent bug in
> the code?
> I know it's unlikely that someone would set HZ to 50, but if they did,
> the same
> bug would appear again.

If you want to ensure timeout > 2, why not then just use:

- 	unsigned long timeout = usecs_to_jiffies(MVMDIO_SMI_TIMEOUT);
+ 	unsigned long timeout = 1 + usecs_to_jiffies(MVMDIO_SMI_TIMEOUT);

  reply	other threads:[~2013-12-03 23:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 15:15 Spurious timeouts in mvmdio Nicolas Schichan
2013-12-03 12:23 ` Jason Cooper
2013-12-03 12:40   ` Russell King - ARM Linux
2013-12-03 13:43     ` Jason Cooper
2013-12-03 18:48       ` Nicolas Schichan
2013-12-03 20:57     ` Leigh Brown
2013-12-03 22:45       ` Sebastian Hesselbarth
2013-12-03 23:20         ` Leigh Brown
2013-12-03 23:17           ` Sebastian Hesselbarth [this message]
2013-12-03 23:38             ` Leigh Brown
2013-12-03 23:42               ` Russell King - ARM Linux
2013-12-04 11:40                 ` Nicolas Schichan
2013-12-16 18:07                 ` Nicolas Schichan
2013-12-16 18:28                   ` Leigh Brown
2013-12-17 13:49                     ` Nicolas Schichan
2013-12-16 18:48                   ` Russell King - ARM Linux
2013-12-03 23:45               ` Sebastian Hesselbarth
2013-12-03 13:16   ` [PATCH] net: mvmdio: fix wait_event_timeout() being called with a 1 jiffy timeout Nicolas Schichan
2013-12-03 13:34     ` Russell King - ARM Linux

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=529E66A4.4050000@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=florian@openwrt.org \
    --cc=jason@lakedaemon.net \
    --cc=leigh@solinno.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nschichan@freebox.fr \
    /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).