All of lore.kernel.org
 help / color / mirror / Atom feed
From: sebastian.hesselbarth@gmail.com (Sebastian Hesselbarth)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] net: mvmdio: fix interrupt timeout handling
Date: Thu, 19 Dec 2013 12:33:19 +0100	[thread overview]
Message-ID: <52B2D97F.4070200@gmail.com> (raw)
In-Reply-To: <1387451589-15491-1-git-send-email-leigh@solinno.co.uk>

On 12/19/13 12:13, Leigh Brown wrote:
> orion_mdio_wait_ready uses wait_event_timeout to wait for the
> SMI interrupt to fire.  wait_event_timeout waits for between
> "timeout - 1" and "timeout" jiffies.  In this case a 1ms timeout
> when HZ is 1000 results in a wait of 0 to 1 jiffies, causing
> premature timeouts.
>
> This fix ensures a minimum timeout of 2 jiffies, ensuring
> wait_event_timeout will always wait at least 1 jiffie.
>
> Issue reported by Nicolas Schichan.
>
> Tested-by: Nicolas Schichan <nschichan@freebox.fr>
> Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
> ---
>   drivers/net/ethernet/marvell/mvmdio.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
> index 7354960..a42a750 100644
> --- a/drivers/net/ethernet/marvell/mvmdio.c
> +++ b/drivers/net/ethernet/marvell/mvmdio.c
> @@ -92,6 +92,12 @@ 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;

Hi Leigh,

above two lines have a whitespace issue.

Sebastian

>   			wait_event_timeout(dev->smi_busy_wait,
>   				           orion_mdio_smi_is_done(dev),
>   				           timeout);
>

WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Leigh Brown <leigh@solinno.co.uk>,
	"David S. Miller" <davem@davemloft.net>
Cc: Nicolas Schichan <nschichan@freebox.fr>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Jason Cooper <jason@lakedaemon.net>,
	netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Florian Fainelli <florian@openwrt.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] net: mvmdio: fix interrupt timeout handling
Date: Thu, 19 Dec 2013 12:33:19 +0100	[thread overview]
Message-ID: <52B2D97F.4070200@gmail.com> (raw)
In-Reply-To: <1387451589-15491-1-git-send-email-leigh@solinno.co.uk>

On 12/19/13 12:13, Leigh Brown wrote:
> orion_mdio_wait_ready uses wait_event_timeout to wait for the
> SMI interrupt to fire.  wait_event_timeout waits for between
> "timeout - 1" and "timeout" jiffies.  In this case a 1ms timeout
> when HZ is 1000 results in a wait of 0 to 1 jiffies, causing
> premature timeouts.
>
> This fix ensures a minimum timeout of 2 jiffies, ensuring
> wait_event_timeout will always wait at least 1 jiffie.
>
> Issue reported by Nicolas Schichan.
>
> Tested-by: Nicolas Schichan <nschichan@freebox.fr>
> Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
> ---
>   drivers/net/ethernet/marvell/mvmdio.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
> index 7354960..a42a750 100644
> --- a/drivers/net/ethernet/marvell/mvmdio.c
> +++ b/drivers/net/ethernet/marvell/mvmdio.c
> @@ -92,6 +92,12 @@ 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;

Hi Leigh,

above two lines have a whitespace issue.

Sebastian

>   			wait_event_timeout(dev->smi_busy_wait,
>   				           orion_mdio_smi_is_done(dev),
>   				           timeout);
>


  reply	other threads:[~2013-12-19 11:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 11:13 [PATCH] net: mvmdio: fix interrupt timeout handling Leigh Brown
2013-12-19 11:13 ` Leigh Brown
2013-12-19 11:33 ` Sebastian Hesselbarth [this message]
2013-12-19 11:33   ` Sebastian Hesselbarth
2013-12-19 12:39   ` Leigh Brown
2013-12-19 12:39     ` Leigh Brown
2013-12-19 13:09   ` [PATCH v2] " Leigh Brown
2013-12-19 13:09     ` Leigh Brown
2013-12-19 17:43     ` Jason Gunthorpe
2013-12-19 17:43       ` Jason Gunthorpe
2013-12-19 19:35       ` Leigh Brown
2013-12-19 19:35         ` Leigh Brown
2013-12-20  0:21     ` David Miller
2013-12-20  0:21       ` David Miller

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=52B2D97F.4070200@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.