From: Jason Cooper <jason@lakedaemon.net>
To: Nicolas Schichan <nschichan@freebox.fr>
Cc: LKML <linux-kernel@vger.kernel.org>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Leigh Brown <leigh@solinno.co.uk>,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <florian@openwrt.org>
Subject: Re: Spurious timeouts in mvmdio
Date: Tue, 3 Dec 2013 07:23:46 -0500 [thread overview]
Message-ID: <20131203122346.GD29282@titan.lakedaemon.net> (raw)
In-Reply-To: <529CA42A.3040504@freebox.fr>
Nicolas,
Sorry for the delay, we spoke about this yesterday on irc, and
apparently we all thought the other person was going to respond. oops
:(
On Mon, Dec 02, 2013 at 04:15:54PM +0100, Nicolas Schichan wrote:
> During 3.13-rc1 testing, I have found out that the mvmdio driver
> would report timeouts on the kernel console:
>
> [ 11.011334] orion-mdio orion-mdio: Timeout: SMI busy for too long
>
> The hardware is a MV88F6281 Kirkwood CPU. The mvmdio driver is using
> the irq line 46 (ge00_err).
>
> I am inclined to believe that it is due to the fact that
> wait_event_timeout() is called with a timeout parameter of 1 jiffy
> in orion_mdio_wait_ready(). If the timer interrupt ticks right after
> calling wait_event_timeout(), we may end up spending much less time
> than MVMDIO_SMI_TIMEOUT (1 msec) in wait_event_timeout(), and as a
> result report a timeout as the MDIO access did not complete in such
> a short time.
>
> As to how to fix this, I see two options (I don't know which one
> would be prefered):
>
> - Option 1: always pass a timeout of at least 2 jiffy to wait_event_timeout().
> - Option 2: switch to wait_event_hrtimeout().
>
> I can provide patches for both options.
Based on yesterday's irc chat, option 1 sounds good. Here's the dump
from yesterday where Sebastian provided a thorough explanation:
11:29 < shesselba> increasing max timeout to 2 ticks at least sounds reasonable
11:29 < shesselba> 10ms should be enough for every CONFIG_HZ there is
11:30 < kos_tom> why make the timeout tied to the ticks? there are functions/macros to convert real time numbers into ticks.
11:30 < kos_tom> msecs_to_jiffies() or something
11:31 < shesselba> kos_tom: it is already using usecs_to_jiffies()
11:31 < shesselba> the thing is: 1ms is less than a jiffy
11:33 < kos_tom> so it will wait one jiffy or a little bit more, no?
11:38 < shesselba> no, the spurious timeouts he is seeing come from (1) mvmdio gets jiffies close before the next tick, (2) wait_event_timeout is called with jiffies + timeout
11:39 < shesselba> with timeout << 1 jiffy
11:39 < shesselba> then (3) the next timer tick occurs
11:39 < shesselba> it will end up waiting less then a jiffy
11:40 < shesselba> IOW, increase timeout to be at least two jiffies (or 20ms for CONFIG_HZ=100)
11:41 < shesselba> originally, it was 100ms anyway
Looking forward to the patch!
thx,
Jason.
next prev parent reply other threads:[~2013-12-03 12:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-02 15:15 Nicolas Schichan
2013-12-03 12:23 ` Jason Cooper [this message]
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
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=20131203122346.GD29282@titan.lakedaemon.net \
--to=jason@lakedaemon.net \
--cc=davem@davemloft.net \
--cc=florian@openwrt.org \
--cc=leigh@solinno.co.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nschichan@freebox.fr \
--cc=sebastian.hesselbarth@gmail.com \
/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
all inboxes | Powered by JetHome®