linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout
@ 2018-10-30  9:31 Kurt Kanzenbach
  2018-10-30  9:31 ` [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait() Kurt Kanzenbach
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2018-10-30  9:31 UTC (permalink / raw)
  To: Anirudha Sarangi, John Linn, David S. Miller
  Cc: Michal Simek, Radhey Shyam Pandey, Andrew Lunn, YueHaibing,
	netdev, linux-arm-kernel, linux-kernel, Kurt Kanzenbach

Hi,

the Xilinx mdio wait functions may return false positives under certain
circumstances: If the functions get preempted between reading the corresponding
mdio register and checking for the timeout, they could falsely indicate a
timeout.

In order to avoid the issue, the condition should be rechecked in the timeout
case.

Kurt Kanzenbach (2):
  net: axienet: recheck condition after timeout in mdio_wait()
  net: xilinx_emaclite: recheck condition after timeout in mdio_wait()

 drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 21 ++++++++++++++++-----
 drivers/net/ethernet/xilinx/xilinx_emaclite.c     | 20 +++++++++++++++-----
 2 files changed, 31 insertions(+), 10 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait()
  2018-10-30  9:31 [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Kurt Kanzenbach
@ 2018-10-30  9:31 ` Kurt Kanzenbach
  2018-10-30 18:25   ` David Miller
  2018-10-30  9:31 ` [PATCH 2/2] net: xilinx_emaclite: " Kurt Kanzenbach
  2018-10-30 12:08 ` [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Andrew Lunn
  2 siblings, 1 reply; 11+ messages in thread
From: Kurt Kanzenbach @ 2018-10-30  9:31 UTC (permalink / raw)
  To: Anirudha Sarangi, John Linn, David S. Miller
  Cc: Michal Simek, Radhey Shyam Pandey, Andrew Lunn, YueHaibing,
	netdev, linux-arm-kernel, linux-kernel, Kurt Kanzenbach

The function could report a false positive if it gets preempted between reading
the XAE_MDIO_MCR_OFFSET register and checking for the timeout.  In such a case,
the condition has to be rechecked to avoid false positives.

Therefore, check for expected condition even after the timeout occurred.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
index 757a3b37ae8a..4f13125e4942 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
@@ -21,15 +21,26 @@
 int axienet_mdio_wait_until_ready(struct axienet_local *lp)
 {
 	unsigned long end = jiffies + 2;
-	while (!(axienet_ior(lp, XAE_MDIO_MCR_OFFSET) &
-		 XAE_MDIO_MCR_READY_MASK)) {
+	u32 val;
+
+	while (1) {
+		val = axienet_ior(lp, XAE_MDIO_MCR_OFFSET);
+
+		if (val & XAE_MDIO_MCR_READY_MASK)
+			return 0;
+
 		if (time_before_eq(end, jiffies)) {
-			WARN_ON(1);
-			return -ETIMEDOUT;
+			val = axienet_ior(lp, XAE_MDIO_MCR_OFFSET);
+			break;
 		}
+
 		udelay(1);
 	}
-	return 0;
+	if (val & XAE_MDIO_MCR_READY_MASK)
+		return 0;
+
+	WARN_ON(1);
+	return -ETIMEDOUT;
 }
 
 /**
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] net: xilinx_emaclite: recheck condition after timeout in mdio_wait()
  2018-10-30  9:31 [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Kurt Kanzenbach
  2018-10-30  9:31 ` [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait() Kurt Kanzenbach
@ 2018-10-30  9:31 ` Kurt Kanzenbach
  2018-10-30 12:10   ` Andrew Lunn
  2018-10-30 18:25   ` David Miller
  2018-10-30 12:08 ` [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Andrew Lunn
  2 siblings, 2 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2018-10-30  9:31 UTC (permalink / raw)
  To: Anirudha Sarangi, John Linn, David S. Miller
  Cc: Michal Simek, Radhey Shyam Pandey, Andrew Lunn, YueHaibing,
	netdev, linux-arm-kernel, linux-kernel, Kurt Kanzenbach

The function could report a false positive if it gets preempted between reading
the XEL_MDIOCTRL_OFFSET register and checking for the timeout.  In such a case,
the condition has to be rechecked to avoid false positives.

Therefore, check for expected condition even after the timeout occurred.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 639e3e99af46..957d03085bd0 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -714,19 +714,29 @@ static irqreturn_t xemaclite_interrupt(int irq, void *dev_id)
 static int xemaclite_mdio_wait(struct net_local *lp)
 {
 	unsigned long end = jiffies + 2;
+	u32 val;
 
 	/* wait for the MDIO interface to not be busy or timeout
 	 * after some time.
 	 */
-	while (xemaclite_readl(lp->base_addr + XEL_MDIOCTRL_OFFSET) &
-			XEL_MDIOCTRL_MDIOSTS_MASK) {
+	while (1) {
+		val = xemaclite_readl(lp->base_addr + XEL_MDIOCTRL_OFFSET);
+
+		if (!(val & XEL_MDIOCTRL_MDIOSTS_MASK))
+			return 0;
+
 		if (time_before_eq(end, jiffies)) {
-			WARN_ON(1);
-			return -ETIMEDOUT;
+			val = xemaclite_readl(lp->base_addr + XEL_MDIOCTRL_OFFSET);
+			break;
 		}
+
 		msleep(1);
 	}
-	return 0;
+	if (!(val & XEL_MDIOCTRL_MDIOSTS_MASK))
+		return 0;
+
+	WARN_ON(1);
+	return -ETIMEDOUT;
 }
 
 /**
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout
  2018-10-30  9:31 [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Kurt Kanzenbach
  2018-10-30  9:31 ` [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait() Kurt Kanzenbach
  2018-10-30  9:31 ` [PATCH 2/2] net: xilinx_emaclite: " Kurt Kanzenbach
@ 2018-10-30 12:08 ` Andrew Lunn
  2018-10-30 13:47   ` Kurt Kanzenbach
  2 siblings, 1 reply; 11+ messages in thread
From: Andrew Lunn @ 2018-10-30 12:08 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Anirudha Sarangi, John Linn, David S. Miller, Michal Simek,
	Radhey Shyam Pandey, YueHaibing, netdev, linux-arm-kernel,
	linux-kernel

On Tue, Oct 30, 2018 at 10:31:37AM +0100, Kurt Kanzenbach wrote:
> Hi,
> 
> the Xilinx mdio wait functions may return false positives under certain
> circumstances: If the functions get preempted between reading the corresponding
> mdio register and checking for the timeout, they could falsely indicate a
> timeout.

Hi Kurt

I wonder if it would be possible to add a readx_poll_timeout() which
passes two parameters to op()?

I keep seeing this basic problem in various drivers, and try to point
people towards readx_poll_timeout(), but it is not the best of fit.

Otherwise, could you add a axienet_ior_read_mcr(lp), and use
readx_poll_timeout() as is?

       Andrew

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] net: xilinx_emaclite: recheck condition after timeout in mdio_wait()
  2018-10-30  9:31 ` [PATCH 2/2] net: xilinx_emaclite: " Kurt Kanzenbach
@ 2018-10-30 12:10   ` Andrew Lunn
  2018-10-30 12:58     ` Radhey Shyam Pandey
  2018-10-30 18:25   ` David Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Andrew Lunn @ 2018-10-30 12:10 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Anirudha Sarangi, John Linn, David S. Miller, Michal Simek,
	Radhey Shyam Pandey, YueHaibing, netdev, linux-arm-kernel,
	linux-kernel

On Tue, Oct 30, 2018 at 10:31:39AM +0100, Kurt Kanzenbach wrote:
> The function could report a false positive if it gets preempted between reading
> the XEL_MDIOCTRL_OFFSET register and checking for the timeout.  In such a case,
> the condition has to be rechecked to avoid false positives.
> 
> Therefore, check for expected condition even after the timeout occurred.
> 
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index 639e3e99af46..957d03085bd0 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -714,19 +714,29 @@ static irqreturn_t xemaclite_interrupt(int irq, void *dev_id)
>  static int xemaclite_mdio_wait(struct net_local *lp)
>  {
>  	unsigned long end = jiffies + 2;
> +	u32 val;
>  
>  	/* wait for the MDIO interface to not be busy or timeout
>  	 * after some time.
>  	 */
> -	while (xemaclite_readl(lp->base_addr + XEL_MDIOCTRL_OFFSET) &
> -			XEL_MDIOCTRL_MDIOSTS_MASK) {
> +	while (1) {
> +		val = xemaclite_readl(lp->base_addr + XEL_MDIOCTRL_OFFSET);

Hi Kurt

It looks like readx_poll_timeout() should work here.

   Andrew

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 2/2] net: xilinx_emaclite: recheck condition after timeout in mdio_wait()
  2018-10-30 12:10   ` Andrew Lunn
@ 2018-10-30 12:58     ` Radhey Shyam Pandey
  0 siblings, 0 replies; 11+ messages in thread
From: Radhey Shyam Pandey @ 2018-10-30 12:58 UTC (permalink / raw)
  To: Andrew Lunn, Kurt Kanzenbach
  Cc: Anirudha Sarangi, John Linn, David S. Miller, Michal Simek,
	YueHaibing, netdev, linux-arm-kernel, linux-kernel

<snip>
> 
> On Tue, Oct 30, 2018 at 10:31:39AM +0100, Kurt Kanzenbach wrote:
> > The function could report a false positive if it gets preempted between
> reading
> > the XEL_MDIOCTRL_OFFSET register and checking for the timeout.  In such a
> case,
> > the condition has to be rechecked to avoid false positives.
> >
> > Therefore, check for expected condition even after the timeout occurred.
> >
> > Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> > ---
> >  drivers/net/ethernet/xilinx/xilinx_emaclite.c | 20 +++++++++++++++-----
> >  1 file changed, 15 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > index 639e3e99af46..957d03085bd0 100644
> > --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > @@ -714,19 +714,29 @@ static irqreturn_t xemaclite_interrupt(int irq, void
> *dev_id)
> >  static int xemaclite_mdio_wait(struct net_local *lp)
> >  {
> >  	unsigned long end = jiffies + 2;
> > +	u32 val;
> >
> >  	/* wait for the MDIO interface to not be busy or timeout
> >  	 * after some time.
> >  	 */
> > -	while (xemaclite_readl(lp->base_addr + XEL_MDIOCTRL_OFFSET) &
> > -			XEL_MDIOCTRL_MDIOSTS_MASK) {
> > +	while (1) {
> > +		val = xemaclite_readl(lp->base_addr +
> XEL_MDIOCTRL_OFFSET);
> 
> Hi Kurt
> 
> It looks like readx_poll_timeout() should work here.

Yes, valid point. readx_poll_timeout API repoll addr after timeout.
Reusing it would simplify the flow.

> 
>    Andrew

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout
  2018-10-30 12:08 ` [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Andrew Lunn
@ 2018-10-30 13:47   ` Kurt Kanzenbach
  0 siblings, 0 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2018-10-30 13:47 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Anirudha Sarangi, John Linn, David S. Miller, Michal Simek,
	Radhey Shyam Pandey, YueHaibing, netdev, linux-arm-kernel,
	linux-kernel

Hi Andrew,

On Tue, Oct 30, 2018 at 01:08:31PM +0100, Andrew Lunn wrote:
> On Tue, Oct 30, 2018 at 10:31:37AM +0100, Kurt Kanzenbach wrote:
> > Hi,
> >
> > the Xilinx mdio wait functions may return false positives under certain
> > circumstances: If the functions get preempted between reading the corresponding
> > mdio register and checking for the timeout, they could falsely indicate a
> > timeout.
>
> Hi Kurt
>
> I wonder if it would be possible to add a readx_poll_timeout() which
> passes two parameters to op()?

actually I was thinking about using readx_poll_timeout(). But as you
already pointed out, it expects only one parameter for op(). I'm not
sure about adding a new readx_poll_timeout() macro.

>
> I keep seeing this basic problem in various drivers, and try to point
> people towards readx_poll_timeout(), but it is not the best of fit.
>
> Otherwise, could you add a axienet_ior_read_mcr(lp), and use
> readx_poll_timeout() as is?

I guess that would work.

I'll use readx_poll_timeout() for both wait functions and send a v2.

Thanks,
Kurt

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait()
  2018-10-30  9:31 ` [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait() Kurt Kanzenbach
@ 2018-10-30 18:25   ` David Miller
  2018-10-31 13:06     ` Kurt Kanzenbach
  2018-11-05  9:16     ` Sebastian Andrzej Siewior
  0 siblings, 2 replies; 11+ messages in thread
From: David Miller @ 2018-10-30 18:25 UTC (permalink / raw)
  To: kurt
  Cc: anirudh, John.Linn, michal.simek, radhey.shyam.pandey, andrew,
	yuehaibing, netdev, linux-arm-kernel, linux-kernel

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: Tue, 30 Oct 2018 10:31:38 +0100

> The function could report a false positive if it gets preempted between reading
> the XAE_MDIO_MCR_OFFSET register and checking for the timeout.  In such a case,
> the condition has to be rechecked to avoid false positives.
> 
> Therefore, check for expected condition even after the timeout occurred.
> 
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
 ...
>  		if (time_before_eq(end, jiffies)) {
> -			WARN_ON(1);
> -			return -ETIMEDOUT;
> +			val = axienet_ior(lp, XAE_MDIO_MCR_OFFSET);
> +			break;
>  		}
> +
>  		udelay(1);
>  	}
> -	return 0;
> +	if (val & XAE_MDIO_MCR_READY_MASK)
> +		return 0;
> +
> +	WARN_ON(1);
> +	return -ETIMEDOUT;

You are not fundamentally changing the situation at all.

The condtion could change right after your last read of
XAR_MDIO_MCR_OFFSET, which is the same thing that happens before your
modifications to this code.

It sounds more like the timeout is slightly too short, and that's the
real problem that causes whatever behavior you think you are fixing
here.

I'm not applying this.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] net: xilinx_emaclite: recheck condition after timeout in mdio_wait()
  2018-10-30  9:31 ` [PATCH 2/2] net: xilinx_emaclite: " Kurt Kanzenbach
  2018-10-30 12:10   ` Andrew Lunn
@ 2018-10-30 18:25   ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: David Miller @ 2018-10-30 18:25 UTC (permalink / raw)
  To: kurt
  Cc: anirudh, John.Linn, michal.simek, radhey.shyam.pandey, andrew,
	yuehaibing, netdev, linux-arm-kernel, linux-kernel

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: Tue, 30 Oct 2018 10:31:39 +0100

> The function could report a false positive if it gets preempted between reading
> the XEL_MDIOCTRL_OFFSET register and checking for the timeout.  In such a case,
> the condition has to be rechecked to avoid false positives.
> 
> Therefore, check for expected condition even after the timeout occurred.
> 
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>

Same objections as your previous patch.

This isn't fixing anything.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait()
  2018-10-30 18:25   ` David Miller
@ 2018-10-31 13:06     ` Kurt Kanzenbach
  2018-11-05  9:16     ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2018-10-31 13:06 UTC (permalink / raw)
  To: David Miller
  Cc: anirudh, John.Linn, michal.simek, radhey.shyam.pandey, andrew,
	yuehaibing, netdev, linux-arm-kernel, linux-kernel

On Tue, Oct 30, 2018 at 11:25:11AM -0700, David Miller wrote:
> From: Kurt Kanzenbach <kurt@linutronix.de>
> Date: Tue, 30 Oct 2018 10:31:38 +0100
>
> > The function could report a false positive if it gets preempted between reading
> > the XAE_MDIO_MCR_OFFSET register and checking for the timeout.  In such a case,
> > the condition has to be rechecked to avoid false positives.
> >
> > Therefore, check for expected condition even after the timeout occurred.
> >
> > Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>  ...
> >  		if (time_before_eq(end, jiffies)) {
> > -			WARN_ON(1);
> > -			return -ETIMEDOUT;
> > +			val = axienet_ior(lp, XAE_MDIO_MCR_OFFSET);
> > +			break;
> >  		}
> > +
> >  		udelay(1);
> >  	}
> > -	return 0;
> > +	if (val & XAE_MDIO_MCR_READY_MASK)
> > +		return 0;
> > +
> > +	WARN_ON(1);
> > +	return -ETIMEDOUT;
>
> You are not fundamentally changing the situation at all.
>
> The condtion could change right after your last read of
> XAR_MDIO_MCR_OFFSET, which is the same thing that happens before your
> modifications to this code.

That's true. The problem is different: If the current task gets
preempted by a higher priority task between checking the condition and
the timeout code, then a timeout might be falsely detected. Consider the
following events:

loop:
 check mdio condition
 ------------------------
 task with real time priority may run for a long time
 ------------------------
 check for timeout
 wait

That's why I've added the recheck of the condition in the timeout case.

>
> It sounds more like the timeout is slightly too short, and that's the
> real problem that causes whatever behavior you think you are fixing
> here.

The timeout value is not the problem here.

Thanks,
Kurt

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait()
  2018-10-30 18:25   ` David Miller
  2018-10-31 13:06     ` Kurt Kanzenbach
@ 2018-11-05  9:16     ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 11+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-11-05  9:16 UTC (permalink / raw)
  To: David Miller
  Cc: kurt, anirudh, John.Linn, michal.simek, radhey.shyam.pandey,
	andrew, yuehaibing, netdev, linux-arm-kernel, linux-kernel

On 2018-10-30 11:25:11 [-0700], David Miller wrote:
> From: Kurt Kanzenbach <kurt@linutronix.de>
> Date: Tue, 30 Oct 2018 10:31:38 +0100
> 
> > The function could report a false positive if it gets preempted between reading
> > the XAE_MDIO_MCR_OFFSET register and checking for the timeout.  In such a case,
> > the condition has to be rechecked to avoid false positives.
> > 
> > Therefore, check for expected condition even after the timeout occurred.
> > 
> > Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>  ...
> >  		if (time_before_eq(end, jiffies)) {
> > -			WARN_ON(1);
> > -			return -ETIMEDOUT;
> > +			val = axienet_ior(lp, XAE_MDIO_MCR_OFFSET);
> > +			break;
> >  		}
> > +
> >  		udelay(1);
> >  	}
> > -	return 0;
> > +	if (val & XAE_MDIO_MCR_READY_MASK)
> > +		return 0;
> > +
> > +	WARN_ON(1);
> > +	return -ETIMEDOUT;
> 
> You are not fundamentally changing the situation at all.

> The condtion could change right after your last read of
> XAR_MDIO_MCR_OFFSET, which is the same thing that happens before your
> modifications to this code.
> 
> It sounds more like the timeout is slightly too short, and that's the
> real problem that causes whatever behavior you think you are fixing
> here.

There is a timeout of two jiffies. If the condition is not true within
those two jiffies it will attempt to check condition one last time after
the timeout occured.
If the task got preempted after the reading from the register but before
the timeout it is possible that the task gets back on the CPU after the
timeout occured. And since the timeout occured it won't check if the
condition changed:
Time
 0   +---+
     | c | Check for condition (false)
     | c |
     | c |
     | c |
     | c |
     | P | Task gets preempted
     |   |
     | O | Condition is true, task still preempted, no check
     |   |
 2   | T | The timeout is true
     |   |
     |   |
     |   |
     | p | Task gets back on the CPU, no re-check of condition

In the last step, there is no checking of the condition after the
timeout occured and it wrongly assumes that the condition is not true.
Increasing the timeout would help as long as the task gets not preempted
past the new timeout.
The same pattern (check condition after timeout) is also used in
wait_event_timeout() or readx_poll_timeout().  Would you prefer to
refactor this with readx_poll_timeout() instead?

> I'm not applying this.
Please reconsider.

Sebastian

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-11-05  9:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30  9:31 [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Kurt Kanzenbach
2018-10-30  9:31 ` [PATCH 1/2] net: axienet: recheck condition after timeout in mdio_wait() Kurt Kanzenbach
2018-10-30 18:25   ` David Miller
2018-10-31 13:06     ` Kurt Kanzenbach
2018-11-05  9:16     ` Sebastian Andrzej Siewior
2018-10-30  9:31 ` [PATCH 2/2] net: xilinx_emaclite: " Kurt Kanzenbach
2018-10-30 12:10   ` Andrew Lunn
2018-10-30 12:58     ` Radhey Shyam Pandey
2018-10-30 18:25   ` David Miller
2018-10-30 12:08 ` [PATCH 0/2] net: xlinx: mdio: recheck condition after timeout Andrew Lunn
2018-10-30 13:47   ` Kurt Kanzenbach

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).