Add a debugfs file exposing per-node DMA pool usage for doorbell allocations. # cat /sys/kernel/debug/mlx5/<dev>/db_dma_pools node block_size used_blocks allocated_blocks 0 64 0 0 1 64 0 0
Unified · Split
| @@ -437,11 +437,34 @@ void mlx5_frag_buf_free(struct mlx5_core_dev *dev, struct mlx5_frag_buf *buf) · 436 unmodified lines | ||
| 437 | 437 | } |
| 438 | 438 | EXPORT_SYMBOL_GPL(mlx5_frag_buf_free); |
| 439 | 439 | |
| 440 | +static int mlx5_db_dma_pools_debugfs_show(struct seq_file *file, void *priv) | |
| 441 | +{ | |
| 442 | + struct mlx5_core_dev *dev = file->private; | |
| 443 | + int node; | |
| 444 | + | |
| 445 | + mlx5_dma_pools_debugfs_print_header(file); | |
| 446 | + | |
| 447 | + for_each_node_state(node, N_POSSIBLE) { | |
| 448 | + struct mlx5_dma_pool *pool = dev->priv.db_node_pools[node]; | |
| 449 | + | |
| 450 | + if (!pool) | |
| 451 | + continue; | |
| 452 | + | |
| 453 | + mlx5_dma_pool_debugfs_stats_print(file, pool); | |
| 454 | + } | |
| 455 | + | |
| 456 | + return 0; | |
| 457 | +} | |
| 458 | +DEFINE_SHOW_ATTRIBUTE(mlx5_db_dma_pools_debugfs); | |
| 459 | + | |
| 440 | 460 | void mlx5_db_pools_cleanup(struct mlx5_core_dev *dev) |
| 441 | 461 | { |
| 442 | 462 | struct mlx5_priv *priv = &dev->priv; |
| 443 | 463 | int node; |
| 444 | 464 | |
| 465 | + debugfs_remove(priv->dbg.db_dma_pools_debugfs); | |
| 466 | + priv->dbg.db_dma_pools_debugfs = NULL; | |
| 467 | + | |
| 445 | 468 | for_each_node_state(node, N_POSSIBLE) |
| 446 | 469 | if (priv->db_node_pools[node]) |
| 447 | 470 | mlx5_dma_pool_destroy(priv->db_node_pools[node]); |
| @@ -471,6 +494,10 @@ int mlx5_db_pools_init(struct mlx5_core_dev *dev) · 23 unmodified lines | ||
| 471 | 494 | priv->db_node_pools[node] = pool; |
| 472 | 495 | } |
| 473 | 496 | |
| 497 | + priv->dbg.db_dma_pools_debugfs = | |
| 498 | + debugfs_create_file("db_dma_pools", 0444, priv->dbg.dbg_root, | |
| 499 | + dev, &mlx5_db_dma_pools_debugfs_fops); | |
| 500 | + | |
| 474 | 501 | return 0; |
| 475 | 502 | } |
| 476 | 503 | |
| @@ -548,6 +548,7 @@ struct mlx5_debugfs_entries { · 547 unmodified lines | ||
| 548 | 548 | struct dentry *cq_debugfs; |
| 549 | 549 | struct dentry *cmdif_debugfs; |
| 550 | 550 | struct dentry *frag_buf_dma_pools_debugfs; |
| 551 | + struct dentry *db_dma_pools_debugfs; | |
| 551 | 552 | struct dentry *pages_debugfs; |
| 552 | 553 | struct dentry *lag_debugfs; |
| 553 | 554 | }; |