lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1433924227-28499-1-git-send-email-k.kozlowski@samsung.com>
Date:	Wed, 10 Jun 2015 17:17:07 +0900
From:	Krzysztof Kozlowski <k.kozlowski@...sung.com>
To:	Vinod Koul <vinod.koul@...el.com>,
	Dan Williams <dan.j.williams@...el.com>,
	dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	gabriel@...een.is, Marek Szyprowski <m.szyprowski@...sung.com>,
	Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
	Maxime Ripard <maxime.ripard@...e-electrons.com>,
	Krzysztof Kozlowski <k.kozlowski@...sung.com>,
	stable@...r.kernel.org
Subject: [RFT PATCH] dmaengine: Fix choppy sound because of unimplemented resume

Some drivers implement only pause operation (no resuming). Example is
pl330 where pause is needed for getting residuum. pl330 does not support
resume operation, transfer must be stopped after pause.

However for slaves this is exposed always as "pause and resume" which
introduces subtle errors on Odroid U3 board (Exynos4412 with pl330).
After adding pause function to pl330 driver the audio playback
(utilizing DMA) gets choppy after some time (approximately 24 hours).

Fix this by exposing "cmd_pause" if and only if pause and resume are
implemented.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@...sung.com>
Reported-by: gabriel@...een.is
Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
Cc: <stable@...r.kernel.org>
Fixes: 88987d2c7534 ("dmaengine: pl330: add DMA_PAUSE feature")

---

Thanks for Marek Szyprowski for nailing the issue.

Few drivers implement only pause (pl330, nbpfaxi, ipu_idmac). The fix
was not extensively tested.

I tested this only on pl330 with dmatest which actually does not pause
the transfer.  I am kindly asking for testing for other use cases,
especially UART transfer and sound playback. Testing on these two other
devices (nbpfaxi and ipu_idmac) could be useful as well.
---
 drivers/dma/dmaengine.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 855dd6ccf09d..8208abe4e1d3 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -494,7 +494,11 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
 	caps->directions = device->directions;
 	caps->residue_granularity = device->residue_granularity;
 
-	caps->cmd_pause = !!device->device_pause;
+	/*
+	 * Some devices implement only pause (e.g. to get residuum) but no
+	 * resume. However cmd_pause is advertised as pause AND resume.
+	 */
+	caps->cmd_pause = !!(device->device_pause && device->device_resume);
 	caps->cmd_terminate = !!device->device_terminate_all;
 
 	return 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ