2020-04-22 19:29:39

by Ravich, Leonid

[permalink] [raw]
Subject: [PATCH v2 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() .

Acked-by: Dave Jiang <[email protected]>
Signed-off-by: Leonid Ravich <[email protected]>
---
Changing in v2
- add log in case of such scenario
drivers/dma/ioat/dma.c | 8 ++++++++
1 file changed, 8 insertions(+)

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

+ /* handle missed issue pending case */
+ if (ioat_ring_pending(ioat_chan)) {
+ dev_dbg(to_dev(ioat_chan), "Complition timeout while pending\n")
+ 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 19:59:48

by Dave Jiang

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



On 4/22/2020 12:25 PM, [email protected] wrote:
> From: Leonid Ravich <[email protected]>
>
> completion timeout might trigger unnesesery DMA engine hw reboot
> in case of missed issue_pending() .
>
> Acked-by: Dave Jiang <[email protected]>
> Signed-off-by: Leonid Ravich <[email protected]>
> ---
> Changing in v2
> - add log in case of such scenario
> drivers/dma/ioat/dma.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
> index 55a8cf1..a958aaf 100644
> --- a/drivers/dma/ioat/dma.c
> +++ b/drivers/dma/ioat/dma.c
> @@ -955,6 +955,14 @@ void ioat_timer_event(struct timer_list *t)
> goto unlock_out;
> }
>
> + /* handle missed issue pending case */
> + if (ioat_ring_pending(ioat_chan)) {
> + dev_dbg(to_dev(ioat_chan), "Complition timeout while pending\n")
Completion timeout with pending descriptors.

Also, maybe dev_warn() you think?

> + 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 21:11:22

by Ravich, Leonid

[permalink] [raw]
Subject: [PATCH v3 1/3] dmaengine: ioat: removing duplicate code from timeout handler

From: Leonid Ravich <[email protected]>

moving duplicate code from timeout error handling to common
function.

Acked-by: Dave Jiang <[email protected]>
Signed-off-by: Leonid Ravich <[email protected]>
---
drivers/dma/ioat/dma.c | 45 +++++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 26 deletions(-)

diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 1e0e6c1..da59b28 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -869,6 +869,23 @@ static void check_active(struct ioatdma_chan *ioat_chan)
mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
}

+static void ioat_reboot_chan(struct ioatdma_chan *ioat_chan)
+{
+ spin_lock_bh(&ioat_chan->prep_lock);
+ set_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
+ spin_unlock_bh(&ioat_chan->prep_lock);
+
+ ioat_abort_descs(ioat_chan);
+ dev_warn(to_dev(ioat_chan), "Reset channel...\n");
+ ioat_reset_hw(ioat_chan);
+ dev_warn(to_dev(ioat_chan), "Restart channel...\n");
+ ioat_restart_channel(ioat_chan);
+
+ spin_lock_bh(&ioat_chan->prep_lock);
+ clear_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
+ spin_unlock_bh(&ioat_chan->prep_lock);
+}
+
void ioat_timer_event(struct timer_list *t)
{
struct ioatdma_chan *ioat_chan = from_timer(ioat_chan, t, timer);
@@ -891,19 +908,7 @@ void ioat_timer_event(struct timer_list *t)

if (test_bit(IOAT_RUN, &ioat_chan->state)) {
spin_lock_bh(&ioat_chan->cleanup_lock);
- spin_lock_bh(&ioat_chan->prep_lock);
- set_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
- spin_unlock_bh(&ioat_chan->prep_lock);
-
- ioat_abort_descs(ioat_chan);
- dev_warn(to_dev(ioat_chan), "Reset channel...\n");
- ioat_reset_hw(ioat_chan);
- dev_warn(to_dev(ioat_chan), "Restart channel...\n");
- ioat_restart_channel(ioat_chan);
-
- spin_lock_bh(&ioat_chan->prep_lock);
- clear_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
- spin_unlock_bh(&ioat_chan->prep_lock);
+ ioat_reboot_chan(ioat_chan);
spin_unlock_bh(&ioat_chan->cleanup_lock);
}

@@ -939,19 +944,7 @@ void ioat_timer_event(struct timer_list *t)
dev_dbg(to_dev(ioat_chan), "Active descriptors: %d\n",
ioat_ring_active(ioat_chan));

- spin_lock_bh(&ioat_chan->prep_lock);
- set_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
- spin_unlock_bh(&ioat_chan->prep_lock);
-
- ioat_abort_descs(ioat_chan);
- dev_warn(to_dev(ioat_chan), "Resetting channel...\n");
- ioat_reset_hw(ioat_chan);
- dev_warn(to_dev(ioat_chan), "Restarting channel...\n");
- ioat_restart_channel(ioat_chan);
-
- spin_lock_bh(&ioat_chan->prep_lock);
- clear_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
- spin_unlock_bh(&ioat_chan->prep_lock);
+ ioat_reboot_chan(ioat_chan);
spin_unlock_bh(&ioat_chan->cleanup_lock);
return;
} else
--
1.9.3

2020-04-22 21:11:39

by Ravich, Leonid

[permalink] [raw]
Subject: [PATCH v3 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() .

Acked-by: Dave Jiang <[email protected]>
Signed-off-by: Leonid Ravich <[email protected]>
---
Changing in v2:
- fixing log spelling and level
drivers/dma/ioat/dma.c | 9 +++++++++
1 file changed, 9 insertions(+)

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

+ /* handle missed issue pending case */
+ if (ioat_ring_pending(ioat_chan)) {
+ dev_warn(to_dev(ioat_chan),
+ "Completion timeout with pending descriptors\n");
+ 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-23 07:26:07

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] dmaengine: ioat: removing duplicate code from timeout handler

On 23-04-20, 00:09, [email protected] wrote:
> From: Leonid Ravich <[email protected]>
>
> moving duplicate code from timeout error handling to common
> function.

Applied all, thanks
--
~Vinod