bnxt_en: use dev_consume_skb_any() in bnxt_tx_int
PATCH v2 1/1 bnxt_en: use dev_consume_skb_any() in bnxt_tx_int
From: Menglong Dong <[email protected]>
In bnxt_tx_int(), the skb in the tx ring buffer will be freed after the transmission completes with dev_kfree_skb_any(), which will produce the noise on the tracepoint "skb:kfree_skb":
$ perf script record -e skb:kfree_skb -a $ perf script swapper 0 [014] 12814.337522: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [003] 12814.338318: skb:kfree_skb: skbaddr=0xffff888108380600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.375258: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.451960: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [008] 12814.562166: skb:kfree_skb: skbaddr=0xffff888112664600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.732517: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.800608: skb:kfree_skb: skbaddr=0xffff88810025d100 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.861501: skb:kfree_skb: skbaddr=0xffff888108295a00 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.377038: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.395530: skb:kfree_skb: skbaddr=0xffff88818f145ee0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED
And the call stack is like this:
$ perf script record -e skb:kfree_skb -a --call-graph fp
$ perf script
swapper 0 [015] 12915.386236: skb:kfree_skb: skbaddr=0xffff88b0473cd000 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED
ffffffff81e5b0a7 kfree_skb_reason+0x117 (vmlinux)
ffffffff81e5b0a7 kfree_skb_reason+0x117 (vmlinux)
ffffffff81e6dd1e dev_kfree_skb_any_reason+0x2e (vmlinux)
ffffffffa04510d5 bnxt_tx_int+0x95 ([bnxt_en])
ffffffffa0454ee5 __bnxt_poll_work_done+0x25 ([bnxt_en])
ffffffffa045b9d2 bnxt_poll+0x72 ([bnxt_en])
ffffffff81e7b47e __napi_poll+0x2e (vmlinux)
ffffffff81e7bb34 net_rx_action+0x294 (vmlinux)
ffffffff8218ff5e __do_softirq+0xfe (vmlinux)
ffffffff810ad51e irq_exit_rcu+0x7e (vmlinux)
ffffffff82175bb5 common_interrupt+0xc5 (vmlinux)
ffffffff82200d27 asm_common_interrupt+0x27 (vmlinux)
ffffffff8217ae54 intel_idle_irq+0x64 (vmlinux)
ffffffff81dea7ae cpuidle_enter+0x2e (vmlinux)
ffffffff811057e3 call_cpuidle+0x23 (vmlinux)
ffffffff8110b16a do_idle+0x1ea (vmlinux)
ffffffff8110b3cd cpu_startup_entry+0x1d (vmlinux)
ffffffff8106dc08 start_secondary+0x118 (vmlinux)
ffffffff81000263 secondary_startup_64_no_verify+0x17e (vmlinux)Replace dev_kfree_skb_any() with dev_consume_skb_any() in bnxt_tx_int() to reduce the noise.
---
v2:
- be more specific in the commit message
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -685,7 +685,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts) next_tx_int: cons =NEXT_TX (cons); -dev_kfree_skb_any (skb); +dev_consume_skb_any (skb); }WRITE_ONCE (txr->tx_cons, cons);
Signature · 1 line
2.40.1
Jakub Kicinski
maintainerQuoted 4 lines · On Tue, 11 Jul 2023 19:07:43 +0800 [email protected] wrote:
In
bnxt_tx_int(), the skb in the tx ring buffer will be freed after the transmission completes withdev_kfree_skb_any(), which will produce the noise on the tracepoint "skb:kfree_skb":
Quoted 12 lines
$ perf script record -e skb:kfree_skb -a $ perf script swapper 0 [014] 12814.337522: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [003] 12814.338318: skb:kfree_skb: skbaddr=0xffff888108380600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.375258: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.451960: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [008] 12814.562166: skb:kfree_skb: skbaddr=0xffff888112664600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.732517: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.800608: skb:kfree_skb: skbaddr=0xffff88810025d100 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.861501: skb:kfree_skb: skbaddr=0xffff888108295a00 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.377038: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.395530: skb:kfree_skb: skbaddr=0xffff88818f145ee0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED
I think this is way too verbose, people looking at networking code are expected to understand kfree_skb vs consume_skb. Your v1 was fine, I'm going to apply it.
Signature · 1 line
pw-bot: na
Quoted 18 lines · Jakub Kicinski
Quoted 4 lines · On Tue, 11 Jul 2023 19:07:43 +0800 [email protected] wrote:
In
bnxt_tx_int(), the skb in the tx ring buffer will be freed after the transmission completes withdev_kfree_skb_any(), which will produce the noise on the tracepoint "skb:kfree_skb":Quoted 12 lines
$ perf script record -e skb:kfree_skb -a $ perf script swapper 0 [014] 12814.337522: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [003] 12814.338318: skb:kfree_skb: skbaddr=0xffff888108380600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.375258: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.451960: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [008] 12814.562166: skb:kfree_skb: skbaddr=0xffff888112664600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.732517: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.800608: skb:kfree_skb: skbaddr=0xffff88810025d100 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.861501: skb:kfree_skb: skbaddr=0xffff888108295a00 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.377038: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.395530: skb:kfree_skb: skbaddr=0xffff88818f145ee0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED
Quoted 2 lines
I think this is way too verbose, people looking at networking code are expected to understand
kfree_skbvsconsume_skb.
There are many people who look in git log and don't understand networking code at all. Verbose commit messages are intended for them.
Thanks
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 19 lines · On Tue, 11 Jul 2023 19:07:43 +0800 you wrote:
From: Menglong Dong <[email protected]>
In
bnxt_tx_int(), the skb in the tx ring buffer will be freed after the transmission completes withdev_kfree_skb_any(), which will produce the noise on the tracepoint "skb:kfree_skb":$ perf script record -e skb:kfree_skb -a $ perf script swapper 0 [014] 12814.337522: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [003] 12814.338318: skb:kfree_skb: skbaddr=0xffff888108380600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.375258: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.451960: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [008] 12814.562166: skb:kfree_skb: skbaddr=0xffff888112664600 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.732517: skb:kfree_skb: skbaddr=0xffff88818f145ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.800608: skb:kfree_skb: skbaddr=0xffff88810025d100 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12814.861501: skb:kfree_skb: skbaddr=0xffff888108295a00 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.377038: skb:kfree_skb: skbaddr=0xffff88818f147ce0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED swapper 0 [014] 12815.395530: skb:kfree_skb: skbaddr=0xffff88818f145ee0 protocol=2048 location=dev_kfree_skb_any_reason+0x2e reason: NOT_SPECIFIED
Quoted 1 line
[...]
Here is the summary with links:
- [net-next,v2] bnxt_en: use dev_consume_skb_any() in bnxt_tx_int
https://git.kernel.org/netdev/net-next/c/47b7acfb016b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html