2020-04-22 11:25:36

by Ravich, Leonid

[permalink] [raw]
Subject: [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler

From: Leonid Ravich <[email protected]>

completion timeout might trigger unnesesery DMA engine hw reboot
in case of missed issue_pending() .

Signed-off-by: Leonid Ravich <[email protected]>
---
drivers/dma/ioat/dma.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 55a8cf1..2ab07a3 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -955,6 +955,13 @@ void ioat_timer_event(struct timer_list *t)
goto unlock_out;
}

+ /* handle missed issue pending case */
+ if (ioat_ring_pending(ioat_chan)) {
+ spin_lock_bh(&ioat_chan->prep_lock);
+ __ioat_issue_pending(ioat_chan);
+ spin_unlock_bh(&ioat_chan->prep_lock);
+ }
+
set_bit(IOAT_COMPLETION_ACK, &ioat_chan->state);
mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT);
unlock_out:
--
1.9.3


2020-04-22 14:23:46

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler



On 4/22/2020 4:22 AM, [email protected] wrote:
> From: Leonid Ravich <[email protected]>
>
> completion timeout might trigger unnesesery DMA engine hw reboot
> in case of missed issue_pending() .

Just curious, are you hitting a use case where this is happening? And
what's causing the completion timeout?

>
> Signed-off-by: Leonid Ravich <[email protected]>
> ---
> drivers/dma/ioat/dma.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
> index 55a8cf1..2ab07a3 100644
> --- a/drivers/dma/ioat/dma.c
> +++ b/drivers/dma/ioat/dma.c
> @@ -955,6 +955,13 @@ void ioat_timer_event(struct timer_list *t)
> goto unlock_out;
> }
>
> + /* handle missed issue pending case */
> + if (ioat_ring_pending(ioat_chan)) {
> + spin_lock_bh(&ioat_chan->prep_lock);
> + __ioat_issue_pending(ioat_chan);
> + spin_unlock_bh(&ioat_chan->prep_lock);
> + }
> +
> set_bit(IOAT_COMPLETION_ACK, &ioat_chan->state);
> mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT);
> unlock_out:
>

2020-04-22 16:49:51

by Ravich, Leonid

[permalink] [raw]
Subject: RE: [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler

> From: Dave Jiang <[email protected]>
>
> On 4/22/2020 4:22 AM, [email protected] wrote:
> > From: Leonid Ravich <[email protected]>
> >
> > completion timeout might trigger unnesesery DMA engine hw reboot in
> > case of missed issue_pending() .
>
> Just curious, are you hitting a use case where this is happening? And what's
> causing the completion timeout?

Unfortunately I did ,
in my case I missed calling dma_async_issue_pending() after few dmaengine_prep_dma_memcpy() due to some error handling bug , timeout timer were still armed due to previous requests (probably) and when finally the timer fired the engine were active (ioat_ring_active()) so it went to reset .

At least this is the theory :).
>
> >
> > Signed-off-by: Leonid Ravich <[email protected]>
> > ---
> > drivers/dma/ioat/dma.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index
> > 55a8cf1..2ab07a3 100644
> > --- a/drivers/dma/ioat/dma.c
> > +++ b/drivers/dma/ioat/dma.c
> > @@ -955,6 +955,13 @@ void ioat_timer_event(struct timer_list *t)
> > goto unlock_out;
> > }
> >
> > + /* handle missed issue pending case */
> > + if (ioat_ring_pending(ioat_chan)) {
> > + spin_lock_bh(&ioat_chan->prep_lock);
> > + __ioat_issue_pending(ioat_chan);
> > + spin_unlock_bh(&ioat_chan->prep_lock);
> > + }
> > +
> > set_bit(IOAT_COMPLETION_ACK, &ioat_chan->state);
> > mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT);
> > unlock_out:
> >