Skip to contentSkip to conversation

ttm/pool: allow debugfs dumps for numa pools.

PATCH In review Dave Airlie 3 participants 5 messages Jun 2, 2025 – Jun 3, 2025

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 ttm/pool: allow debugfs dumps for numa pools.

From: Dave Airlie <[email protected]>

Currently you can't see per-device numa aware pools properly.

Cc Christian König <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_pool.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +7 -2
index ccc3b9a13e9e..43b69d061dff 100644
@@ -1253,7 +1253,7 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 {
 	unsigned int i;
 
-	if (!pool->use_dma_alloc) {
+	if (!pool->use_dma_alloc && pool->nid == NUMA_NO_NODE) {
 		seq_puts(m, "unused\n");
 		return 0;
 	}
@@ -1262,7 +1262,12 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 
 	spin_lock(&shrinker_lock);
 	for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) {
-		seq_puts(m, "DMA ");
+		if (!ttm_pool_select_type(pool, i, 0))
+			continue;
+		if (pool->use_dma_alloc)
+			seq_puts(m, "DMA ");
+		else
+			seq_printf(m, "N%d ", pool->nid);
 		switch (i) {
 		case ttm_cached:
 			seq_puts(m, "\t:");
Signature · 1 line
2.43.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Currently you can't see per-device numa aware pools properly.

Cc Christian König <[email protected]>

Any follow up patch to wire this up in amdgpu?

Regards,
Christian.

Quoted 31 lines
---
 drivers/gpu/drm/ttm/ttm_pool.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +7 -2
index ccc3b9a13e9e..43b69d061dff 100644
@@ -1253,7 +1253,7 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 {
 	unsigned int i;
 
-	if (!pool->use_dma_alloc) {
+	if (!pool->use_dma_alloc && pool->nid == NUMA_NO_NODE) {
 		seq_puts(m, "unused\n");
 		return 0;
 	}
@@ -1262,7 +1262,12 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 
 	spin_lock(&shrinker_lock);
 	for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) {
-		seq_puts(m, "DMA ");
+		if (!ttm_pool_select_type(pool, i, 0))
+			continue;
+		if (pool->use_dma_alloc)
+			seq_puts(m, "DMA ");
+		else
+			seq_printf(m, "N%d ", pool->nid);
 		switch (i) {
 		case ttm_cached:
 			seq_puts(m, "\t:");
#2 lore raw
Quoted 4 lines · Christian König
Quoted 2 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Quoted 8 lines
Quoted 4 lines

Currently you can't see per-device numa aware pools properly.

Cc Christian König <[email protected]>

Any follow up patch to wire this up in amdgpu?

Just seems to work, at least I tested it on a 4 node MI300A system this morning and

/sys/kernel/debug/dri/*/ttm_page_pool seems to reflect the correct pools.

Dave.

Quoted 36 lines

Regards,
Christian.

Quoted 31 lines
---
 drivers/gpu/drm/ttm/ttm_pool.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +7 -2
index ccc3b9a13e9e..43b69d061dff 100644
@@ -1253,7 +1253,7 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 {
      unsigned int i;
 
-     if (!pool->use_dma_alloc) {
+     if (!pool->use_dma_alloc && pool->nid == NUMA_NO_NODE) {
              seq_puts(m, "unused\n");
              return 0;
      }
@@ -1262,7 +1262,12 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 
      spin_lock(&shrinker_lock);
      for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) {
-             seq_puts(m, "DMA ");
+             if (!ttm_pool_select_type(pool, i, 0))
+                     continue;
+             if (pool->use_dma_alloc)
+                     seq_puts(m, "DMA ");
+             else
+                     seq_printf(m, "N%d ", pool->nid);
              switch (i) {
              case ttm_cached:
                      seq_puts(m, "\t:");
#3 lore raw
Quoted 10 lines · David Airlie
Quoted 9 lines · Christian König
Quoted 6 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Currently you can't see per-device numa aware pools properly.

Cc Christian König <[email protected]>
Quoted 8 lines
Quoted 3 lines

Any follow up patch to wire this up in amdgpu?

Just seems to work, at least I tested it on a 4 node MI300A system this morning and

/sys/kernel/debug/dri/*/ttm_page_pool seems to reflect the correct pools.

Yeah that should work, but there is also the mode where we allocated the pool in the driver because the MI300 has connections to multiple NUMA nodes.

See amdgpu_ttm_tt_populate().

I will take care of this after that patch here lands.

Regards,
Christian.

Quoted 40 lines

Dave.

Quoted 36 lines

Regards,
Christian.

Quoted 31 lines
---
 drivers/gpu/drm/ttm/ttm_pool.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +7 -2
index ccc3b9a13e9e..43b69d061dff 100644
@@ -1253,7 +1253,7 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 {
      unsigned int i;
 
-     if (!pool->use_dma_alloc) {
+     if (!pool->use_dma_alloc && pool->nid == NUMA_NO_NODE) {
              seq_puts(m, "unused\n");
              return 0;
      }
@@ -1262,7 +1262,12 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m)
 
      spin_lock(&shrinker_lock);
      for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) {
-             seq_puts(m, "DMA ");
+             if (!ttm_pool_select_type(pool, i, 0))
+                     continue;
+             if (pool->use_dma_alloc)
+                     seq_puts(m, "DMA ");
+             else
+                     seq_printf(m, "N%d ", pool->nid);
              switch (i) {
              case ttm_cached:
                      seq_puts(m, "\t:");
author maintainer
#4 lore raw
Quoted 19 lines · Christian König
Quoted 17 lines · David Airlie
Quoted 4 lines · Christian König
Quoted 2 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Quoted 8 lines
Quoted 4 lines

Currently you can't see per-device numa aware pools properly.

Cc Christian König <[email protected]>

Any follow up patch to wire this up in amdgpu?

Just seems to work, at least I tested it on a 4 node MI300A system this morning and

Quoted 8 lines
Quoted 1 line

/sys/kernel/debug/dri/*/ttm_page_pool seems to reflect the correct pools.

Yeah that should work, but there is also the mode where we allocated the pool in the driver because the MI300 has connections to multiple NUMA nodes.

See amdgpu_ttm_tt_populate().

I will take care of this after that patch here lands.

I've landed this in drm-misc-next.

Thanks,
Dave.