public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wang Liang <wangliang74@huawei.com>
To: Eric Dumazet <edumazet@google.com>,
	Florian Westphal <fw@strlen.de>, Simon Horman <horms@kernel.org>
Cc: <nhorman@tuxdriver.com>, <davem@davemloft.net>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <yuehaibing@huawei.com>,
	<zhangchangzhong@huawei.com>
Subject: Re: [PATCH RFC net-next] net: drop_monitor: Add debugfs support
Date: Thu, 16 Oct 2025 14:26:33 +0800	[thread overview]
Message-ID: <bcb84f88-4bdd-4095-b5ea-e806e7733a54@huawei.com> (raw)
In-Reply-To: <CANn89iLZBMWpU7kMjd8akT+L8FbsnO+wqgjCaXF2KOCFz9Hiag@mail.gmail.com>


在 2025/10/15 18:40, Eric Dumazet 写道:
> On Wed, Oct 15, 2025 at 2:51 AM Wang Liang <wangliang74@huawei.com> wrote:
>> This patch add debugfs interfaces for drop monitor. Similar to kmemleak, we
>> can use the monitor by below commands:
>>
>>    echo clear > /sys/kernel/debug/drop_monitor/trace
>>    echo start > /sys/kernel/debug/drop_monitor/trace
>>    echo stop  > /sys/kernel/debug/drop_monitor/trace
>>    cat /sys/kernel/debug/drop_monitor/trace
>>
>> The trace skb number limit can be set dynamically:
>>
>>    cat /sys/kernel/debug/drop_monitor/trace_limit
>>    echo 200 > /sys/kernel/debug/drop_monitor/trace_limit
>>
>> Compare to original netlink method, the callstack dump is supported. There
>> is a example for received udp packet with error checksum:
>>
>>    reason   : UDP_CSUM (11)
>>    pc       : udp_queue_rcv_one_skb+0x14b/0x350
>>    len      : 12
>>    protocol : 0x0800
>>    stack    :
>>      sk_skb_reason_drop+0x8f/0x120
>>      udp_queue_rcv_one_skb+0x14b/0x350
>>      udp_unicast_rcv_skb+0x71/0x90
>>      ip_protocol_deliver_rcu+0xa6/0x160
>>      ip_local_deliver_finish+0x90/0x100
>>      ip_sublist_rcv_finish+0x65/0x80
>>      ip_sublist_rcv+0x130/0x1c0
>>      ip_list_rcv+0xf7/0x130
>>      __netif_receive_skb_list_core+0x21d/0x240
>>      netif_receive_skb_list_internal+0x186/0x2b0
>>      napi_complete_done+0x78/0x190
>>      e1000_clean+0x27f/0x860
>>      __napi_poll+0x25/0x1e0
>>      net_rx_action+0x2ca/0x330
>>      handle_softirqs+0xbc/0x290
>>      irq_exit_rcu+0x90/0xb0
>>
>> It's more friendly to use and not need user application to cooperate.
>> Furthermore, it is easier to add new feature. We can add reason/ip/port
>> filter by debugfs parameters, like ftrace, rather than netlink msg.
> I do not understand the fascination with net/core/drop_monitor.c,
> which looks very old school to me,
> and misses all the features,  flexibility, scalability  that 'perf',
> eBPF tracing, bpftrace, .... have today.
>
> Adding  /sys/kernel/debug/drop_monitor/* is even more old school.
>
> Not mentioning the maintenance burden.
>
> For me the choice is easy :
>
> # CONFIG_NET_DROP_MONITOR is not set
>
> perf record -ag -e skb:kfree_skb sleep 1
>
> perf script # or perf report


Thank you for taking time to review this patch!

My initially thought was that the drop_monitor may cover more drop
positions (not just kfree_skb), show more skb info, filter skb by ip/port
debugfs parameter (not support now), and not need userspace tools.

Currently perf is indeed a better choice, adding debugfs is not necessary.

Thanks!


      parent reply	other threads:[~2025-10-16  6:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 10:14 [PATCH RFC net-next] net: drop_monitor: Add debugfs support Wang Liang
2025-10-15 10:40 ` Eric Dumazet
2025-10-15 11:14   ` Florian Westphal
2025-10-15 16:49     ` Simon Horman
2025-10-16  6:26   ` Wang Liang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bcb84f88-4bdd-4095-b5ea-e806e7733a54@huawei.com \
    --to=wangliang74@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=pabeni@redhat.com \
    --cc=yuehaibing@huawei.com \
    --cc=zhangchangzhong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox