[PATCH 1/2] octeontx2-af: siplify rvu_debugfs

Yury Norov posted 2 patches 1 month ago
There is a newer version of this series
[PATCH 1/2] octeontx2-af: siplify rvu_debugfs
Posted by Yury Norov 1 month ago
The driver uses bitmap_print_to_pagebuf() to store human-readable
bitmaps representations in a temporary buffers; and then feed
seq_printf() with it.

Switch to using seq_printf("%*pb") directly and drop intermediate
buffer.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 .../marvell/octeontx2/af/rvu_debugfs.c        | 28 ++++---------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
index 15d3cb0b9da6..159b910eef84 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
@@ -960,30 +960,21 @@ static bool rvu_dbg_is_valid_lf(struct rvu *rvu, int blkaddr, int lf,
 
 static void print_npa_qsize(struct seq_file *m, struct rvu_pfvf *pfvf)
 {
-	char *buf;
-
-	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
-	if (!buf)
-		return;
-
 	if (!pfvf->aura_ctx) {
 		seq_puts(m, "Aura context is not initialized\n");
 	} else {
-		bitmap_print_to_pagebuf(false, buf, pfvf->aura_bmap,
-					pfvf->aura_ctx->qsize);
 		seq_printf(m, "Aura count : %d\n", pfvf->aura_ctx->qsize);
-		seq_printf(m, "Aura context ena/dis bitmap : %s\n", buf);
+		seq_printf(m, "Aura context ena/dis bitmap : %*pb\n",
+			   pfvf->aura_ctx->qsize, pfvf->aura_bmap);
 	}
 
 	if (!pfvf->pool_ctx) {
 		seq_puts(m, "Pool context is not initialized\n");
 	} else {
-		bitmap_print_to_pagebuf(false, buf, pfvf->pool_bmap,
-					pfvf->pool_ctx->qsize);
 		seq_printf(m, "Pool count : %d\n", pfvf->pool_ctx->qsize);
-		seq_printf(m, "Pool context ena/dis bitmap : %s\n", buf);
+		seq_printf(m, "Pool context ena/dis bitmap : %*pb\n",
+			   pfvf->aura_ctx->qsize, pfvf->aura_bmap);
 	}
-	kfree(buf);
 }
 
 /* The 'qsize' entry dumps current Aura/Pool context Qsize
@@ -2545,17 +2536,8 @@ RVU_DEBUG_SEQ_FOPS(nix_cq_ctx, nix_cq_ctx_display, nix_cq_ctx_write);
 static void print_nix_qctx_qsize(struct seq_file *filp, int qsize,
 				 unsigned long *bmap, char *qtype)
 {
-	char *buf;
-
-	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
-	if (!buf)
-		return;
-
-	bitmap_print_to_pagebuf(false, buf, bmap, qsize);
 	seq_printf(filp, "%s context count : %d\n", qtype, qsize);
-	seq_printf(filp, "%s context ena/dis bitmap : %s\n",
-		   qtype, buf);
-	kfree(buf);
+	seq_printf(filp, "%s context ena/dis bitmap : %*pb\n", qtype, qsize, bmap);
 }
 
 static void print_nix_qsize(struct seq_file *filp, struct rvu_pfvf *pfvf)
-- 
2.43.0
Re: [PATCH 1/2] octeontx2-af: siplify rvu_debugfs
Posted by Jakub Kicinski 1 month ago
On Tue,  3 Mar 2026 13:55:05 -0500 Yury Norov wrote:
> Subject: [PATCH 1/2] octeontx2-af: siplify rvu_debugfs

when you respin - please also fix the typo in the subject
Re: [1/2] octeontx2-af: siplify rvu_debugfs
Posted by Simon Horman 1 month ago
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
octeontx2-af: siplify rvu_debugfs

The driver uses bitmap_print_to_pagebuf() to store human-readable
bitmaps representations in a temporary buffers; and then feed
seq_printf() with it. Switch to using seq_printf("%*pb") directly
and drop intermediate buffer.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> index 413f9fa40b33..cae61c4de47f 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> @@ -962,30 +962,21 @@ static bool rvu_dbg_is_valid_lf(struct rvu *rvu, int blkaddr, int lf,
>
>  static void print_npa_qsize(struct seq_file *m, struct rvu_pfvf *pfvf)
>  {
> -	char *buf;
> -
> -	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
> -	if (!buf)
> -		return;
> -
>  	if (!pfvf->aura_ctx) {
>  		seq_puts(m, "Aura context is not initialized\n");
>  	} else {
> -		bitmap_print_to_pagebuf(false, buf, pfvf->aura_bmap,
> -					pfvf->aura_ctx->qsize);
>  		seq_printf(m, "Aura count : %d\n", pfvf->aura_ctx->qsize);
> -		seq_printf(m, "Aura context ena/dis bitmap : %s\n", buf);
> +		seq_printf(m, "Aura context ena/dis bitmap : %*pb\n",
> +			   pfvf->aura_ctx->qsize, pfvf->aura_bmap);
>  	}
>
>  	if (!pfvf->pool_ctx) {
>  		seq_puts(m, "Pool context is not initialized\n");
>  	} else {
> -		bitmap_print_to_pagebuf(false, buf, pfvf->pool_bmap,
> -					pfvf->pool_ctx->qsize);
>  		seq_printf(m, "Pool count : %d\n", pfvf->pool_ctx->qsize);
> -		seq_printf(m, "Pool context ena/dis bitmap : %s\n", buf);
> +		seq_printf(m, "Pool context ena/dis bitmap : %*pb\n",
> +			   pfvf->aura_ctx->qsize, pfvf->aura_bmap);
                   ^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^

Does this code have a copy-paste error? The pool context output is
displaying the aura bitmap instead of the pool bitmap.

The old code correctly used pfvf->pool_bmap and pfvf->pool_ctx->qsize:

    bitmap_print_to_pagebuf(false, buf, pfvf->pool_bmap,
                            pfvf->pool_ctx->qsize);

But the new code uses pfvf->aura_bmap and pfvf->aura_ctx->qsize for
both the aura and pool context displays. This makes the pool context
debugfs output show incorrect information.

>  	}
> -	kfree(buf);
>  }

[ ... ]