Thread (1 message) 1 message, 1 author, 2020-12-23

Re: [PATCH v3 09/24] wfx: add hwio.c/hwio.h

From: Kalle Valo <hidden>
Date: 2020-12-23 05:30:07
Also in: linux-devicetree, linux-mmc, lkml, netdev

Possibly related (same subject, not in this thread)

Jérôme Pouiller [off-list ref] writes:
On Tuesday 22 December 2020 16:27:01 CET Greg Kroah-Hartman wrote:
quoted
On Tue, Dec 22, 2020 at 05:10:11PM +0200, Kalle Valo wrote:
quoted
Jerome Pouiller [off-list ref] writes:
quoted
+/*
+ * Internal helpers.
+ *
+ * About CONFIG_VMAP_STACK:
+ * When CONFIG_VMAP_STACK is enabled, it is not possible to run DMA on stack
+ * allocated data. Functions below that work with registers (aka functions
+ * ending with "32") automatically reallocate buffers with kmalloc. However,
+ * functions that work with arbitrary length buffers let's caller to handle
+ * memory location. In doubt, enable CONFIG_DEBUG_SG to detect badly located
+ * buffer.
+ */
This sounds very hacky to me, I have understood that you should never
use stack with DMA.
You should never do that because some platforms do not support it, so no
driver should ever try to do that as they do not know what platform they
are running on.
Yes, I have learned this rule the hard way.

There is no better way than a comment to warn the user that the argument
will be used with a DMA? A Sparse annotation, for example?
I have not seen anything, but something like sparse annotation would be
useful. Please let me know if you find anything like that.

But I think that CONFIG_VMAP_STACK is irrelevant and the comment should
be clarified that using stack memory must NOT be used for DMA operations
in any circumstances.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help