* [PATCH 1/3] dmaengine: ioat: removing duplicate code from timeout handler
@ 2020-04-22 11:22 leonid.ravich
2020-04-22 11:22 ` [PATCH 2/3] dmaengine: ioat: remove unnesesery double complition timer modification leonid.ravich
2020-04-22 11:22 ` [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler leonid.ravich
0 siblings, 2 replies; 5+ messages in thread
From: leonid.ravich @ 2020-04-22 11:22 UTC (permalink / raw)
To: dmaengine
Cc: lravich, Leonid Ravich, Vinod Koul, Dan Williams, Dave Jiang,
Greg Kroah-Hartman, Alexios Zavras, Thomas Gleixner,
Alexander.Barabash, linux-kernel
From: Leonid Ravich <Leonid.Ravich@emc.com>
moving duplicate code from timeout error handling to common
function.
Signed-off-by: Leonid Ravich <Leonid.Ravich@emc.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] dmaengine: ioat: remove unnesesery double complition timer modification.
2020-04-22 11:22 [PATCH 1/3] dmaengine: ioat: removing duplicate code from timeout handler leonid.ravich
@ 2020-04-22 11:22 ` leonid.ravich
2020-04-22 11:22 ` [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler leonid.ravich
1 sibling, 0 replies; 5+ messages in thread
From: leonid.ravich @ 2020-04-22 11:22 UTC (permalink / raw)
To: dmaengine
Cc: lravich, Leonid Ravich, Vinod Koul, Dan Williams, Dave Jiang,
Thomas Gleixner, Allison Randal, Alexander.Barabash,
linux-kernel
From: Leonid Ravich <Leonid.Ravich@emc.com>
removing unnecessary mod_timer from timeout handler
incase of ioat_cleanup_preamble() is true for cleaner code
Signed-off-by: Leonid Ravich <Leonid.Ravich@emc.com>
---
drivers/dma/ioat/dma.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index da59b28..55a8cf1 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -922,17 +922,23 @@ void ioat_timer_event(struct timer_list *t)
spin_lock_bh(&ioat_chan->prep_lock);
check_active(ioat_chan);
spin_unlock_bh(&ioat_chan->prep_lock);
- spin_unlock_bh(&ioat_chan->cleanup_lock);
- return;
+ goto unlock_out;
+ }
+
+ /* handle the missed cleanup case */
+ if (ioat_cleanup_preamble(ioat_chan, &phys_complete)) {
+ /* timer restarted in ioat_cleanup_preamble
+ * and IOAT_COMPLETION_ACK cleared
+ */
+ __cleanup(ioat_chan, phys_complete);
+ goto unlock_out;
}
/* if we haven't made progress and we have already
* acknowledged a pending completion once, then be more
* forceful with a restart
*/
- if (ioat_cleanup_preamble(ioat_chan, &phys_complete))
- __cleanup(ioat_chan, phys_complete);
- else if (test_bit(IOAT_COMPLETION_ACK, &ioat_chan->state)) {
+ if (test_bit(IOAT_COMPLETION_ACK, &ioat_chan->state)) {
u32 chanerr;
chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
@@ -945,12 +951,13 @@ void ioat_timer_event(struct timer_list *t)
ioat_ring_active(ioat_chan));
ioat_reboot_chan(ioat_chan);
- spin_unlock_bh(&ioat_chan->cleanup_lock);
- return;
- } else
- set_bit(IOAT_COMPLETION_ACK, &ioat_chan->state);
+ goto unlock_out;
+ }
+
+ set_bit(IOAT_COMPLETION_ACK, &ioat_chan->state);
mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT);
+unlock_out:
spin_unlock_bh(&ioat_chan->cleanup_lock);
}
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler
2020-04-22 11:22 [PATCH 1/3] dmaengine: ioat: removing duplicate code from timeout handler leonid.ravich
2020-04-22 11:22 ` [PATCH 2/3] dmaengine: ioat: remove unnesesery double complition timer modification leonid.ravich
@ 2020-04-22 11:22 ` leonid.ravich
2020-04-22 14:21 ` Dave Jiang
1 sibling, 1 reply; 5+ messages in thread
From: leonid.ravich @ 2020-04-22 11:22 UTC (permalink / raw)
To: dmaengine
Cc: lravich, Leonid Ravich, Dan Williams, Vinod Koul, Dave Jiang,
Allison Randal, Alexios Zavras, Thomas Gleixner,
Alexander.Barabash, linux-kernel
From: Leonid Ravich <Leonid.Ravich@emc.com>
completion timeout might trigger unnesesery DMA engine hw reboot
in case of missed issue_pending() .
Signed-off-by: Leonid Ravich <Leonid.Ravich@emc.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler
2020-04-22 11:22 ` [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler leonid.ravich
@ 2020-04-22 14:21 ` Dave Jiang
2020-04-22 16:45 ` Ravich, Leonid
0 siblings, 1 reply; 5+ messages in thread
From: Dave Jiang @ 2020-04-22 14:21 UTC (permalink / raw)
To: leonid.ravich, dmaengine
Cc: lravich, Dan Williams, Vinod Koul, Allison Randal,
Alexios Zavras, Thomas Gleixner, Alexander.Barabash,
linux-kernel
On 4/22/2020 4:22 AM, leonid.ravich@dell.com wrote:
> From: Leonid Ravich <Leonid.Ravich@emc.com>
>
> 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 <Leonid.Ravich@emc.com>
> ---
> 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:
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler
2020-04-22 14:21 ` Dave Jiang
@ 2020-04-22 16:45 ` Ravich, Leonid
0 siblings, 0 replies; 5+ messages in thread
From: Ravich, Leonid @ 2020-04-22 16:45 UTC (permalink / raw)
To: Dave Jiang, dmaengine
Cc: lravich, Dan Williams, Vinod Koul, Allison Randal,
Alexios Zavras, Thomas Gleixner, Barabash, Alexander,
linux-kernel
> From: Dave Jiang <dave.jiang@intel.com>
>
> On 4/22/2020 4:22 AM, leonid.ravich@dell.com wrote:
> > From: Leonid Ravich <Leonid.Ravich@emc.com>
> >
> > 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 <Leonid.Ravich@emc.com>
> > ---
> > 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:
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-22 16:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 11:22 [PATCH 1/3] dmaengine: ioat: removing duplicate code from timeout handler leonid.ravich
2020-04-22 11:22 ` [PATCH 2/3] dmaengine: ioat: remove unnesesery double complition timer modification leonid.ravich
2020-04-22 11:22 ` [PATCH 3/3] dmaengine: ioat: adding missed issue_pending to timeout handler leonid.ravich
2020-04-22 14:21 ` Dave Jiang
2020-04-22 16:45 ` Ravich, Leonid
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).