linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-debug: hns_enet_drv could use more DMA entries
@ 2018-11-30  3:54 Qian Cai
  2018-11-30  8:42 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Qian Cai @ 2018-11-30  3:54 UTC (permalink / raw)
  To: hch, m.szyprowski, robin.murphy
  Cc: yisen.zhuang, salil.mehta, iommu, netdev, linux-kernel, Qian Cai

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

Signed-off-by: Qian Cai <cai@gmx.us>
---
 kernel/dma/debug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 231ca4628062..ae91689cc9ad 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -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,
-- 
2.17.2 (Apple Git-113)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-debug: hns_enet_drv could use more DMA entries
  2018-11-30  3:54 [PATCH] dma-debug: hns_enet_drv could use more DMA entries Qian Cai
@ 2018-11-30  8:42 ` Christoph Hellwig
  2018-11-30  9:16   ` John Garry
  2018-11-30 12:04   ` Robin Murphy
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2018-11-30  8:42 UTC (permalink / raw)
  To: Qian Cai
  Cc: hch, m.szyprowski, robin.murphy, yisen.zhuang, salil.mehta,
	iommu, netdev, linux-kernel

On Thu, Nov 29, 2018 at 10:54:56PM -0500, Qian Cai wrote:
>  /* 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

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-debug: hns_enet_drv could use more DMA entries
  2018-11-30  8:42 ` Christoph Hellwig
@ 2018-11-30  9:16   ` John Garry
  2018-11-30 12:04   ` Robin Murphy
  1 sibling, 0 replies; 4+ messages in thread
From: John Garry @ 2018-11-30  9:16 UTC (permalink / raw)
  To: Christoph Hellwig, Qian Cai
  Cc: robin.murphy, linux-kernel, iommu, netdev, yisen.zhuang, Linuxarm

+

Pasting original message at bottom.


On 30/11/2018 08:42, Christoph Hellwig wrote:
> On Thu, Nov 29, 2018 at 10:54:56PM -0500, Qian Cai wrote:
>>  /* 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
>
> 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.
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.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

Signed-off-by: Qian Cai <cai@gmx.us>
---
  kernel/dma/debug.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 231ca4628062..ae91689cc9ad 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -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,



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-debug: hns_enet_drv could use more DMA entries
  2018-11-30  8:42 ` Christoph Hellwig
  2018-11-30  9:16   ` John Garry
@ 2018-11-30 12:04   ` Robin Murphy
  1 sibling, 0 replies; 4+ messages in thread
From: Robin Murphy @ 2018-11-30 12:04 UTC (permalink / raw)
  To: Christoph Hellwig, Qian Cai
  Cc: m.szyprowski, yisen.zhuang, salil.mehta, iommu, netdev, linux-kernel

On 30/11/2018 08:42, Christoph Hellwig wrote:
> On Thu, Nov 29, 2018 at 10:54:56PM -0500, Qian Cai wrote:
>>   /* 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
> 
> 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.

> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-30 12:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-30  3:54 [PATCH] dma-debug: hns_enet_drv could use more DMA entries Qian Cai
2018-11-30  8:42 ` Christoph Hellwig
2018-11-30  9:16   ` John Garry
2018-11-30 12:04   ` Robin Murphy

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).