<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/dma, branch linux-4.1.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>dmaengine: at_xdmac: fix rare residue corruption</title>
<updated>2018-05-23T01:36:33+00:00</updated>
<author>
<name>Maxime Jayat</name>
<email>maxime.jayat@mobile-devices.fr</email>
</author>
<published>2018-02-22T11:39:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ea4ec900ea4aecaae31aea6afdcb5732879761fb'/>
<id>ea4ec900ea4aecaae31aea6afdcb5732879761fb</id>
<content type='text'>
[ Upstream commit c5637476bbf9bb86c7f0413b8f4822a73d8d2d07 ]

Despite the efforts made to correctly read the NDA and CUBC registers,
the order in which the registers are read could sometimes lead to an
inconsistent state.

Re-using the timeline from the comments, this following timing of
registers reads could lead to reading NDA with value "@desc2" and
CUBC with value "MAX desc1":

 INITD --------                    ------------
              |____________________|
       _______________________  _______________
 NDA       @desc2             \/   @desc3
       _______________________/\_______________
       __________  ___________  _______________
 CUBC       0    \/ MAX desc1 \/  MAX desc2
       __________/\___________/\_______________
        |  |          |  |
Events:(1)(2)        (3)(4)

(1) check_nda = @desc2
(2) initd = 1
(3) cur_ubc = MAX desc1
(4) cur_nda = @desc2

This is allowed by the condition ((check_nda == cur_nda) &amp;&amp; initd),
despite cur_ubc and cur_nda being in the precise state we don't want.

This error leads to incorrect residue computation.

Fix it by inversing the order in which CUBC and INITD are read. This
makes sure that NDA and CUBC are always read together either _before_
INITD goes to 0 or _after_ it is back at 1.
The case where NDA is read before INITD is at 0 and CUBC is read after
INITD is back at 1 will be rejected by check_nda and cur_nda being
different.

Fixes: 53398f488821 ("dmaengine: at_xdmac: fix residue corruption")
Cc: stable@vger.kernel.org
Signed-off-by: Maxime Jayat &lt;maxime.jayat@mobile-devices.fr&gt;
Acked-by: Ludovic Desroches &lt;ludovic.desroches@microchip.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit c5637476bbf9bb86c7f0413b8f4822a73d8d2d07 ]

Despite the efforts made to correctly read the NDA and CUBC registers,
the order in which the registers are read could sometimes lead to an
inconsistent state.

Re-using the timeline from the comments, this following timing of
registers reads could lead to reading NDA with value "@desc2" and
CUBC with value "MAX desc1":

 INITD --------                    ------------
              |____________________|
       _______________________  _______________
 NDA       @desc2             \/   @desc3
       _______________________/\_______________
       __________  ___________  _______________
 CUBC       0    \/ MAX desc1 \/  MAX desc2
       __________/\___________/\_______________
        |  |          |  |
Events:(1)(2)        (3)(4)

(1) check_nda = @desc2
(2) initd = 1
(3) cur_ubc = MAX desc1
(4) cur_nda = @desc2

This is allowed by the condition ((check_nda == cur_nda) &amp;&amp; initd),
despite cur_ubc and cur_nda being in the precise state we don't want.

This error leads to incorrect residue computation.

Fix it by inversing the order in which CUBC and INITD are read. This
makes sure that NDA and CUBC are always read together either _before_
INITD goes to 0 or _after_ it is back at 1.
The case where NDA is read before INITD is at 0 and CUBC is read after
INITD is back at 1 will be rejected by check_nda and cur_nda being
different.

Fixes: 53398f488821 ("dmaengine: at_xdmac: fix residue corruption")
Cc: stable@vger.kernel.org
Signed-off-by: Maxime Jayat &lt;maxime.jayat@mobile-devices.fr&gt;
Acked-by: Ludovic Desroches &lt;ludovic.desroches@microchip.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: imx-sdma: Handle return value of clk_prepare_enable</title>
<updated>2018-05-23T01:36:27+00:00</updated>
<author>
<name>Arvind Yadav</name>
<email>arvind.yadav.cs@gmail.com</email>
</author>
<published>2017-05-24T06:39:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=76fed2030592832c201e0737e2b88d8b83c6d0f8'/>
<id>76fed2030592832c201e0737e2b88d8b83c6d0f8</id>
<content type='text'>
[ Upstream commit fb9caf370f4d0457789d13a1a1b110a8db846e5e ]

clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav &lt;arvind.yadav.cs@gmail.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit fb9caf370f4d0457789d13a1a1b110a8db846e5e ]

clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav &lt;arvind.yadav.cs@gmail.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: jz4740: disable/unprepare clk if probe fails</title>
<updated>2018-03-04T15:28:27+00:00</updated>
<author>
<name>Tobias Jordan</name>
<email>Tobias.Jordan@elektrobit.com</email>
</author>
<published>2017-12-06T13:28:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=01bd5ae7750e81f8ffcce39c1ef56cf00ab5d831'/>
<id>01bd5ae7750e81f8ffcce39c1ef56cf00ab5d831</id>
<content type='text'>
[ Upstream commit eb9436966fdc84cebdf222952a99898ab46d9bb0 ]

in error path of jz4740_dma_probe(), call clk_disable_unprepare() to clean
up.

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 25ce6c35fea0 MIPS: jz4740: Remove custom DMA API
Signed-off-by: Tobias Jordan &lt;Tobias.Jordan@elektrobit.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit eb9436966fdc84cebdf222952a99898ab46d9bb0 ]

in error path of jz4740_dma_probe(), call clk_disable_unprepare() to clean
up.

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 25ce6c35fea0 MIPS: jz4740: Remove custom DMA API
Signed-off-by: Tobias Jordan &lt;Tobias.Jordan@elektrobit.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: dmatest: fix container_of member in dmatest_callback</title>
<updated>2018-03-01T03:09:50+00:00</updated>
<author>
<name>Yang Shunyong</name>
<email>shunyong.yang@hxt-semitech.com</email>
</author>
<published>2018-01-29T06:40:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=57fc0c3f15860e73dadb93748a5bc809415af0bc'/>
<id>57fc0c3f15860e73dadb93748a5bc809415af0bc</id>
<content type='text'>
[ Upstream commit 66b3bd2356e0a1531c71a3dcf96944621e25c17c ]

The type of arg passed to dmatest_callback is struct dmatest_done.
It refers to test_done in struct dmatest_thread, not done_wait.

Fixes: 6f6a23a213be ("dmaengine: dmatest: move callback wait ...")
Signed-off-by: Yang Shunyong &lt;shunyong.yang@hxt-semitech.com&gt;
Acked-by: Adam Wallis &lt;awallis@codeaurora.org&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 66b3bd2356e0a1531c71a3dcf96944621e25c17c ]

The type of arg passed to dmatest_callback is struct dmatest_done.
It refers to test_done in struct dmatest_thread, not done_wait.

Fixes: 6f6a23a213be ("dmaengine: dmatest: move callback wait ...")
Signed-off-by: Yang Shunyong &lt;shunyong.yang@hxt-semitech.com&gt;
Acked-by: Adam Wallis &lt;awallis@codeaurora.org&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: Fix array index out of bounds warning in __get_unmap_pool()</title>
<updated>2018-01-17T17:55:34+00:00</updated>
<author>
<name>Matthias Kaehlcke</name>
<email>mka@chromium.org</email>
</author>
<published>2017-03-13T21:30:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a7eaeaf53fdd70df40d295e752166faf702d80f4'/>
<id>a7eaeaf53fdd70df40d295e752166faf702d80f4</id>
<content type='text'>
[ Upstream commit 23f963e91fd81f44f6b316b1c24db563354c6be8 ]

This fixes the following warning when building with clang and
CONFIG_DMA_ENGINE_RAID=n :

drivers/dma/dmaengine.c:1102:11: error: array index 2 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]
                return &amp;unmap_pool[2];
                        ^          ~
drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here
static struct dmaengine_unmap_pool unmap_pool[] = {
^
drivers/dma/dmaengine.c:1104:11: error: array index 3 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]
                return &amp;unmap_pool[3];
                        ^          ~
drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here
static struct dmaengine_unmap_pool unmap_pool[] = {

Signed-off-by: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Reviewed-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 23f963e91fd81f44f6b316b1c24db563354c6be8 ]

This fixes the following warning when building with clang and
CONFIG_DMA_ENGINE_RAID=n :

drivers/dma/dmaengine.c:1102:11: error: array index 2 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]
                return &amp;unmap_pool[2];
                        ^          ~
drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here
static struct dmaengine_unmap_pool unmap_pool[] = {
^
drivers/dma/dmaengine.c:1104:11: error: array index 3 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]
                return &amp;unmap_pool[3];
                        ^          ~
drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here
static struct dmaengine_unmap_pool unmap_pool[] = {

Signed-off-by: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Reviewed-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: dmatest: move callback wait queue to thread context</title>
<updated>2018-01-17T17:55:31+00:00</updated>
<author>
<name>Adam Wallis</name>
<email>awallis@codeaurora.org</email>
</author>
<published>2017-11-27T15:45:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6b92b07e2cb0e90327f03928cadfcbb625d33378'/>
<id>6b92b07e2cb0e90327f03928cadfcbb625d33378</id>
<content type='text'>
[ Upstream commit 6f6a23a213be51728502b88741ba6a10cda2441d ]

Commit adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
introduced a bug (that is in fact documented by the patch commit text)
that leaves behind a dangling pointer. Since the done_wait structure is
allocated on the stack, future invocations to the DMATEST can produce
undesirable results (e.g., corrupted spinlocks).

Commit a9df21e34b42 ("dmaengine: dmatest: warn user when dma test times
out") attempted to WARN the user that the stack was likely corrupted but
did not fix the actual issue.

This patch fixes the issue by pushing the wait queue and callback
structs into the the thread structure. If a failure occurs due to time,
dmaengine_terminate_all will force the callback to safely call
wake_up_all() without possibility of using a freed pointer.

Cc: stable@vger.kernel.org
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=197605
Fixes: adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
Reviewed-by: Sinan Kaya &lt;okaya@codeaurora.org&gt;
Suggested-by: Shunyong Yang &lt;shunyong.yang@hxt-semitech.com&gt;
Signed-off-by: Adam Wallis &lt;awallis@codeaurora.org&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 6f6a23a213be51728502b88741ba6a10cda2441d ]

Commit adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
introduced a bug (that is in fact documented by the patch commit text)
that leaves behind a dangling pointer. Since the done_wait structure is
allocated on the stack, future invocations to the DMATEST can produce
undesirable results (e.g., corrupted spinlocks).

Commit a9df21e34b42 ("dmaengine: dmatest: warn user when dma test times
out") attempted to WARN the user that the stack was likely corrupted but
did not fix the actual issue.

This patch fixes the issue by pushing the wait queue and callback
structs into the the thread structure. If a failure occurs due to time,
dmaengine_terminate_all will force the callback to safely call
wake_up_all() without possibility of using a freed pointer.

Cc: stable@vger.kernel.org
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=197605
Fixes: adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
Reviewed-by: Sinan Kaya &lt;okaya@codeaurora.org&gt;
Suggested-by: Shunyong Yang &lt;shunyong.yang@hxt-semitech.com&gt;
Signed-off-by: Adam Wallis &lt;awallis@codeaurora.org&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: pl330: fix double lock</title>
<updated>2018-01-17T17:55:19+00:00</updated>
<author>
<name>Iago Abal</name>
<email>mail@iagoabal.eu</email>
</author>
<published>2017-01-11T13:00:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=940fc0fc3010ed9aaec006a8c85fce00eb7d7be3'/>
<id>940fc0fc3010ed9aaec006a8c85fce00eb7d7be3</id>
<content type='text'>
[ Upstream commit 91539eb1fda2d530d3b268eef542c5414e54bf1a ]

The static bug finder EBA (http://www.iagoabal.eu/eba/) reported the
following double-lock bug:

    Double lock:
    1. spin_lock_irqsave(pch-&gt;lock, flags) at pl330_free_chan_resources:2236;
    2. call to function `pl330_release_channel' immediately after;
    3. call to function `dma_pl330_rqcb' in line 1753;
    4. spin_lock_irqsave(pch-&gt;lock, flags) at dma_pl330_rqcb:1505.

I have fixed it as suggested by Marek Szyprowski.

First, I have replaced `pch-&gt;lock' with `pl330-&gt;lock' in functions
`pl330_alloc_chan_resources' and `pl330_free_chan_resources'. This avoids
the double-lock by acquiring a different lock than `dma_pl330_rqcb'.

NOTE that, as a result, `pl330_free_chan_resources' executes
`list_splice_tail_init' on `pch-&gt;work_list' under lock `pl330-&gt;lock',
whereas in the rest of the code `pch-&gt;work_list' is protected by
`pch-&gt;lock'. I don't know if this may cause race conditions. Similarly
`pch-&gt;cyclic' is written by `pl330_alloc_chan_resources' under
`pl330-&gt;lock' but read by `pl330_tx_submit' under `pch-&gt;lock'.

Second, I have removed locking from `pl330_request_channel' and
`pl330_release_channel' functions. Function `pl330_request_channel' is
only called from `pl330_alloc_chan_resources', so the lock is already
held. Function `pl330_release_channel' is called from
`pl330_free_chan_resources', which already holds the lock, and from
`pl330_del'. Function `pl330_del' is called in an error path of
`pl330_probe' and at the end of `pl330_remove', but I assume that there
cannot be concurrent accesses to the protected data at those points.

Signed-off-by: Iago Abal &lt;mail@iagoabal.eu&gt;
Reviewed-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 91539eb1fda2d530d3b268eef542c5414e54bf1a ]

The static bug finder EBA (http://www.iagoabal.eu/eba/) reported the
following double-lock bug:

    Double lock:
    1. spin_lock_irqsave(pch-&gt;lock, flags) at pl330_free_chan_resources:2236;
    2. call to function `pl330_release_channel' immediately after;
    3. call to function `dma_pl330_rqcb' in line 1753;
    4. spin_lock_irqsave(pch-&gt;lock, flags) at dma_pl330_rqcb:1505.

I have fixed it as suggested by Marek Szyprowski.

First, I have replaced `pch-&gt;lock' with `pl330-&gt;lock' in functions
`pl330_alloc_chan_resources' and `pl330_free_chan_resources'. This avoids
the double-lock by acquiring a different lock than `dma_pl330_rqcb'.

NOTE that, as a result, `pl330_free_chan_resources' executes
`list_splice_tail_init' on `pch-&gt;work_list' under lock `pl330-&gt;lock',
whereas in the rest of the code `pch-&gt;work_list' is protected by
`pch-&gt;lock'. I don't know if this may cause race conditions. Similarly
`pch-&gt;cyclic' is written by `pl330_alloc_chan_resources' under
`pl330-&gt;lock' but read by `pl330_tx_submit' under `pch-&gt;lock'.

Second, I have removed locking from `pl330_request_channel' and
`pl330_release_channel' functions. Function `pl330_request_channel' is
only called from `pl330_alloc_chan_resources', so the lock is already
held. Function `pl330_release_channel' is called from
`pl330_free_chan_resources', which already holds the lock, and from
`pl330_del'. Function `pl330_del' is called in an error path of
`pl330_probe' and at the end of `pl330_remove', but I assume that there
cannot be concurrent accesses to the protected data at those points.

Signed-off-by: Iago Abal &lt;mail@iagoabal.eu&gt;
Reviewed-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: dmatest: warn user when dma test times out</title>
<updated>2017-12-07T02:20:09+00:00</updated>
<author>
<name>Adam Wallis</name>
<email>awallis@codeaurora.org</email>
</author>
<published>2017-11-02T12:53:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=86b88cbb0727bbb4ddf562ead6bd64aa8fe52819'/>
<id>86b88cbb0727bbb4ddf562ead6bd64aa8fe52819</id>
<content type='text'>
[ Upstream commit a9df21e34b422f79d9a9fa5c3eff8c2a53491be6 ]

Commit adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
introduced a bug (that is in fact documented by the patch commit text)
that leaves behind a dangling pointer. Since the done_wait structure is
allocated on the stack, future invocations to the DMATEST can produce
undesirable results (e.g., corrupted spinlocks). Ideally, this would be
cleaned up in the thread handler, but at the very least, the kernel
is left in a very precarious scenario that can lead to some long debug
sessions when the crash comes later.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197605
Signed-off-by: Adam Wallis &lt;awallis@codeaurora.org&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit a9df21e34b422f79d9a9fa5c3eff8c2a53491be6 ]

Commit adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
introduced a bug (that is in fact documented by the patch commit text)
that leaves behind a dangling pointer. Since the done_wait structure is
allocated on the stack, future invocations to the DMATEST can produce
undesirable results (e.g., corrupted spinlocks). Ideally, this would be
cleaned up in the thread handler, but at the very least, the kernel
is left in a very precarious scenario that can lead to some long debug
sessions when the crash comes later.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197605
Signed-off-by: Adam Wallis &lt;awallis@codeaurora.org&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "dmaengine: ep93xx: Don't drain the transfers in terminate_all()"</title>
<updated>2017-07-31T17:37:56+00:00</updated>
<author>
<name>Sasha Levin</name>
<email>alexander.levin@verizon.com</email>
</author>
<published>2017-07-31T13:20:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4e8a4d30154e99164294addef503cb635704e9fe'/>
<id>4e8a4d30154e99164294addef503cb635704e9fe</id>
<content type='text'>
This reverts commit 81402e4033a7d10c6f841bff364ae0bf0f2fa505.

Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 81402e4033a7d10c6f841bff364ae0bf0f2fa505.

Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: ep93xx: Don't drain the transfers in terminate_all()</title>
<updated>2017-06-08T10:12:47+00:00</updated>
<author>
<name>Alexander Sverdlin</name>
<email>alexander.sverdlin@gmail.com</email>
</author>
<published>2017-05-22T14:05:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=81402e4033a7d10c6f841bff364ae0bf0f2fa505'/>
<id>81402e4033a7d10c6f841bff364ae0bf0f2fa505</id>
<content type='text'>
[ Upstream commit 98f9de366fccee7572c646af226b2d4b4841e3b5 ]

Draining the transfers in terminate_all callback happens with IRQs disabled,
therefore induces huge latency:

 irqsoff latency trace v1.1.5 on 4.11.0
 --------------------------------------------------------------------
 latency: 39770 us, #57/57, CPU#0 | (M:preempt VP:0, KP:0, SP:0 HP:0)
    -----------------
    | task: process-129 (uid:0 nice:0 policy:2 rt_prio:50)
    -----------------
  =&gt; started at: _snd_pcm_stream_lock_irqsave
  =&gt; ended at:   snd_pcm_stream_unlock_irqrestore

                  _------=&gt; CPU#
                 / _-----=&gt; irqs-off
                | / _----=&gt; need-resched
                || / _---=&gt; hardirq/softirq
                ||| / _--=&gt; preempt-depth
                |||| /     delay
  cmd     pid   ||||| time  |   caller
     \   /      |||||  \    |   /
process-129     0d.s.    3us : _snd_pcm_stream_lock_irqsave
process-129     0d.s1    9us : snd_pcm_stream_lock &lt;-_snd_pcm_stream_lock_irqsave
process-129     0d.s1   15us : preempt_count_add &lt;-snd_pcm_stream_lock
process-129     0d.s2   22us : preempt_count_add &lt;-snd_pcm_stream_lock
process-129     0d.s3   32us : snd_pcm_update_hw_ptr0 &lt;-snd_pcm_period_elapsed
process-129     0d.s3   41us : soc_pcm_pointer &lt;-snd_pcm_update_hw_ptr0
process-129     0d.s3   50us : dmaengine_pcm_pointer &lt;-soc_pcm_pointer
process-129     0d.s3   58us+: snd_dmaengine_pcm_pointer_no_residue &lt;-dmaengine_pcm_pointer
process-129     0d.s3   96us : update_audio_tstamp &lt;-snd_pcm_update_hw_ptr0
process-129     0d.s3  103us : snd_pcm_update_state &lt;-snd_pcm_update_hw_ptr0
process-129     0d.s3  112us : xrun &lt;-snd_pcm_update_state
process-129     0d.s3  119us : snd_pcm_stop &lt;-xrun
process-129     0d.s3  126us : snd_pcm_action &lt;-snd_pcm_stop
process-129     0d.s3  134us : snd_pcm_action_single &lt;-snd_pcm_action
process-129     0d.s3  141us : snd_pcm_pre_stop &lt;-snd_pcm_action_single
process-129     0d.s3  150us : snd_pcm_do_stop &lt;-snd_pcm_action_single
process-129     0d.s3  157us : soc_pcm_trigger &lt;-snd_pcm_do_stop
process-129     0d.s3  166us : snd_dmaengine_pcm_trigger &lt;-soc_pcm_trigger
process-129     0d.s3  175us : ep93xx_dma_terminate_all &lt;-snd_dmaengine_pcm_trigger
process-129     0d.s3  182us : preempt_count_add &lt;-ep93xx_dma_terminate_all
process-129     0d.s4  189us*: m2p_hw_shutdown &lt;-ep93xx_dma_terminate_all
process-129     0d.s4 39472us : m2p_hw_setup &lt;-ep93xx_dma_terminate_all

 ... rest skipped...

process-129     0d.s. 40080us : &lt;stack trace&gt;
 =&gt; ep93xx_dma_tasklet
 =&gt; tasklet_action
 =&gt; __do_softirq
 =&gt; irq_exit
 =&gt; __handle_domain_irq
 =&gt; vic_handle_irq
 =&gt; __irq_usr
 =&gt; 0xb66c6668

Just abort the transfers and warn if the HW state is not what we expect.
Move draining into device_synchronize callback.

Signed-off-by: Alexander Sverdlin &lt;alexander.sverdlin@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 98f9de366fccee7572c646af226b2d4b4841e3b5 ]

Draining the transfers in terminate_all callback happens with IRQs disabled,
therefore induces huge latency:

 irqsoff latency trace v1.1.5 on 4.11.0
 --------------------------------------------------------------------
 latency: 39770 us, #57/57, CPU#0 | (M:preempt VP:0, KP:0, SP:0 HP:0)
    -----------------
    | task: process-129 (uid:0 nice:0 policy:2 rt_prio:50)
    -----------------
  =&gt; started at: _snd_pcm_stream_lock_irqsave
  =&gt; ended at:   snd_pcm_stream_unlock_irqrestore

                  _------=&gt; CPU#
                 / _-----=&gt; irqs-off
                | / _----=&gt; need-resched
                || / _---=&gt; hardirq/softirq
                ||| / _--=&gt; preempt-depth
                |||| /     delay
  cmd     pid   ||||| time  |   caller
     \   /      |||||  \    |   /
process-129     0d.s.    3us : _snd_pcm_stream_lock_irqsave
process-129     0d.s1    9us : snd_pcm_stream_lock &lt;-_snd_pcm_stream_lock_irqsave
process-129     0d.s1   15us : preempt_count_add &lt;-snd_pcm_stream_lock
process-129     0d.s2   22us : preempt_count_add &lt;-snd_pcm_stream_lock
process-129     0d.s3   32us : snd_pcm_update_hw_ptr0 &lt;-snd_pcm_period_elapsed
process-129     0d.s3   41us : soc_pcm_pointer &lt;-snd_pcm_update_hw_ptr0
process-129     0d.s3   50us : dmaengine_pcm_pointer &lt;-soc_pcm_pointer
process-129     0d.s3   58us+: snd_dmaengine_pcm_pointer_no_residue &lt;-dmaengine_pcm_pointer
process-129     0d.s3   96us : update_audio_tstamp &lt;-snd_pcm_update_hw_ptr0
process-129     0d.s3  103us : snd_pcm_update_state &lt;-snd_pcm_update_hw_ptr0
process-129     0d.s3  112us : xrun &lt;-snd_pcm_update_state
process-129     0d.s3  119us : snd_pcm_stop &lt;-xrun
process-129     0d.s3  126us : snd_pcm_action &lt;-snd_pcm_stop
process-129     0d.s3  134us : snd_pcm_action_single &lt;-snd_pcm_action
process-129     0d.s3  141us : snd_pcm_pre_stop &lt;-snd_pcm_action_single
process-129     0d.s3  150us : snd_pcm_do_stop &lt;-snd_pcm_action_single
process-129     0d.s3  157us : soc_pcm_trigger &lt;-snd_pcm_do_stop
process-129     0d.s3  166us : snd_dmaengine_pcm_trigger &lt;-soc_pcm_trigger
process-129     0d.s3  175us : ep93xx_dma_terminate_all &lt;-snd_dmaengine_pcm_trigger
process-129     0d.s3  182us : preempt_count_add &lt;-ep93xx_dma_terminate_all
process-129     0d.s4  189us*: m2p_hw_shutdown &lt;-ep93xx_dma_terminate_all
process-129     0d.s4 39472us : m2p_hw_setup &lt;-ep93xx_dma_terminate_all

 ... rest skipped...

process-129     0d.s. 40080us : &lt;stack trace&gt;
 =&gt; ep93xx_dma_tasklet
 =&gt; tasklet_action
 =&gt; __do_softirq
 =&gt; irq_exit
 =&gt; __handle_domain_irq
 =&gt; vic_handle_irq
 =&gt; __irq_usr
 =&gt; 0xb66c6668

Just abort the transfers and warn if the HW state is not what we expect.
Move draining into device_synchronize callback.

Signed-off-by: Alexander Sverdlin &lt;alexander.sverdlin@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
