Skip to contentSkip to conversation

dma-debug: hns_enet_drv could use more DMA entries

PATCH In review Qian Cai 4 participants 4 messages Nov 30, 2018

Subsystems (3)
lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH 1/1 dma-debug: hns_enet_drv could use more DMA entries

The amount of DMA mappings from Hisilicon HNS ethernet devices is huge, so it could trigger "DMA-API: debugging out of memory - disabling".

hnae_get_handle [1]
hnae_init_queue
hnae_init_ring
hnae_alloc_buffers [2]
debug_dma_map_page
dma_entry_alloc

[1] for (i = 0; i < handle->q_num; i++)
[2] for (i = 0; i < ring->desc_num; i++)

On this Huawei TaiShan 2280 aarch64 server, it has reached the limit already,

4 (ports) x 16 (handles) x 1024 (rings) = 65536

---
 kernel/dma/debug.c | 5 +++++
 1 file changed, 5 insertions(+)
kernel/dma/debug.c +5 -0
index 231ca4628062..ae91689cc9ad 100644
@@ -43,8 +43,13 @@
 
 /* allow architectures to override this if absolutely required */
 #ifndef PREALLOC_DMA_DEBUG_ENTRIES
+/* amount of DMA mappings on this driver is huge. */
+#ifdef	HNS_ENET
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 17)
+#else
 #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
 #endif
+#endif
 
 enum {
 	dma_debug_single,
Signature · 1 line
2.17.2 (Apple Git-113)
#1 lore raw

kernel/dma/debug.c line 52

Quoted 9 lines · Qian Cai

/* allow architectures to override this if absolutely required */ #ifndef PREALLOC_DMA_DEBUG_ENTRIES

kernel/dma/debug.c +5 -0
+/* amount of DMA mappings on this driver is huge. */
+#ifdef	HNS_ENET
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 17)
+#else
 #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
 #endif
+#endif

How would this be defined in a header that leaks into this file?

I think we need to turn PREALLOC_DMA_DEBUG_ENTRIES into a user selectable config options, as I really don't want to collect hacks like this.

#2 lore raw

+

Pasting original message at bottom.

Quoted 13 lines · Christoph Hellwig

Review

Quoted 9 lines · Qian Cai

/* allow architectures to override this if absolutely required */ #ifndef PREALLOC_DMA_DEBUG_ENTRIES

(quoted diff) +5 -0
+/* amount of DMA mappings on this driver is huge. */
+#ifdef	HNS_ENET
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 17)
+#else
 #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
 #endif
+#endif

How would this be defined in a header that leaks into this file?

Quoted 9 lines

I think we need to turn PREALLOC_DMA_DEBUG_ENTRIES into a user selectable config options, as I really don't want to collect hacks like this.
_______________________________________________
iommu mailing list iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

The amount of DMA mappings from Hisilicon HNS ethernet devices is huge, so it could trigger "DMA-API: debugging out of memory - disabling".

hnae_get_handle [1]
hnae_init_queue
hnae_init_ring
hnae_alloc_buffers [2]
debug_dma_map_page
dma_entry_alloc

[1] for (i = 0; i < handle->q_num; i++)
[2] for (i = 0; i < ring->desc_num; i++)

On this Huawei TaiShan 2280 aarch64 server, it has reached the limit already,

4 (ports) x 16 (handles) x 1024 (rings) = 65536

---
 kernel/dma/debug.c | 5 +++++
 1 file changed, 5 insertions(+)
kernel/dma/debug.c +5 -0
index 231ca4628062..ae91689cc9ad 100644
@@ -43,8 +43,13 @@
 
 /* allow architectures to override this if absolutely required */
 #ifndef PREALLOC_DMA_DEBUG_ENTRIES
+/* amount of DMA mappings on this driver is huge. */
+#ifdef	HNS_ENET
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 17)
+#else
 #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
 #endif
+#endif
 
 enum {
 	dma_debug_single,
reviewer
#3 lore raw
In reply to Christoph Hellwig
Quoted 12 lines · Christoph Hellwig

kernel/dma/debug.c line 52

Quoted 9 lines · Qian Cai

/* allow architectures to override this if absolutely required */ #ifndef PREALLOC_DMA_DEBUG_ENTRIES

kernel/dma/debug.c +5 -0
+/* amount of DMA mappings on this driver is huge. */
+#ifdef	HNS_ENET
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 17)
+#else
  #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
  #endif
+#endif

How would this be defined in a header that leaks into this file?

Apparently it wouldn't, because nothing defines that macro anywhere anyway. CONFIG_HNS_ENET, on the other hand, would be available by virtue of autoconf.h which is just about everywhere.

Quoted 3 lines

I think we need to turn PREALLOC_DMA_DEBUG_ENTRIES into a user selectable config options, as I really don't want to collect hacks like this.

Agreed - we already have per-arch overrides scattered about, so growing special cases in yet another place just makes even more of a mess. Rounding all of it up into Kconfig would definitely make sense.

Robin.