Re: [PATCH net-next] net: dev: introduce netdev_drop_inc()

From: Jakub Kicinski
Date: Tue Feb 08 2022 - 23:07:47 EST


On Wed, 09 Feb 2022 02:20:07 +0000 yajun.deng@xxxxxxxxx wrote:
> February 9, 2022 8:27 AM, "Jakub Kicinski" <kuba@xxxxxxxxxx> wrote:
>
> > On Tue, 8 Feb 2022 14:43:18 +0800 Yajun Deng wrote:
> >
> >> We will use 'sudo perf record -g -a -e skb:kfree_skb' command to trace
> >> the dropped packets when dropped increase in the output of ifconfig.
> >> But there are two cases, one is only called kfree_skb(), another is
> >> increasing the dropped and called kfree_skb(). The latter is what
> >> we need. So we need to separate these two cases.
> >>
> >> From the other side, the dropped packet came from the core network and
> >> the driver, we also need to separate these two cases.
> >>
> >> Add netdev_drop_inc() and add a tracepoint for the core network dropped
> >> packets. use 'sudo perf record -g -a -e net:netdev_drop' and 'sudo perf
> >> script' will recored the dropped packets by the core network.
> >>
> >> Signed-off-by: Yajun Deng <yajun.deng@xxxxxxxxx>
> >
> > Have you seen the work that's being done around kfree_skb_reason()?
>
> Yes, I saw it. The focus of kfree_skb_reason() is trace kfree_skb() and the reason,
> but the focus of this patch only traces this case of the dropped packet.
>
> I don't want to trace all kfree_skb(), but I just want to trace the dropped packet.
>
> This command 'sudo perf record -g -a -e skb:kfree_skb' would trace all kfree_skb(),
> kfree_skb() would drowned out the case of dropped packets when the samples were too large.

IIRC perf support filters, I think with -f? We can't add a tracepoint
for every combination of attributes.