mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dongli Zhang <dongli.zhang@oracle.com>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Menglong Dong <imagedong@tencent.com>,
	Joao Martins <joao.m.martins@oracle.com>,
	joe.jin@oracle.com
Subject: Re: [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
Date: Thu, 3 Feb 2022 09:14:50 -0800	[thread overview]
Message-ID: <3234b5dc-9a96-1786-96eb-a319d2359358@oracle.com> (raw)
In-Reply-To: <CANn89iLB-zmM1YTn4mjikMLhZwQ6fQUAHeCBznLuvE=gB2R-sg@mail.gmail.com>

Hi Eric,

On 2/3/22 7:59 AM, Eric Dumazet wrote:
> On Thu, Feb 3, 2022 at 7:38 AM Dongli Zhang <dongli.zhang@oracle.com> wrote:
>>
>> Sometimes the kernel may not directly call kfree_skb() to drop the sk_buff.
>> Instead, it "goto drop" and call kfree_skb() at 'drop'. This make it
>> difficult to track the reason that the sk_buff is dropped.
>>
>> The commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") has
>> introduced the kfree_skb_reason() to help track the reason. However, we may
>> need to define many reasons for each driver/subsystem.
>>
>> To avoid introducing so many new reasons, this is to use line number
>> ("__LINE__") to trace where the sk_buff is dropped. As a result, the reason
>> will be generated automatically.
>>
>> Cc: Joao Martins <joao.m.martins@oracle.com>
>> Cc: Joe Jin <joe.jin@oracle.com>
>> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
>> ---
>>  include/linux/skbuff.h     | 21 ++++-----------------
>>  include/trace/events/skb.h | 35 ++++++-----------------------------
>>  net/core/dev.c             |  2 +-
>>  net/core/skbuff.c          |  9 ++++-----
>>  net/ipv4/tcp_ipv4.c        | 14 +++++++-------
>>  net/ipv4/udp.c             | 14 +++++++-------
>>  6 files changed, 29 insertions(+), 66 deletions(-)
>>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 8a636e678902..471268a4a497 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -307,21 +307,8 @@ struct sk_buff_head {
>>
>>  struct sk_buff;
>>
>> -/* The reason of skb drop, which is used in kfree_skb_reason().
>> - * en...maybe they should be splited by group?
>> - *
>> - * Each item here should also be in 'TRACE_SKB_DROP_REASON', which is
>> - * used to translate the reason to string.
>> - */
>> -enum skb_drop_reason {
>> -       SKB_DROP_REASON_NOT_SPECIFIED,
>> -       SKB_DROP_REASON_NO_SOCKET,
>> -       SKB_DROP_REASON_PKT_TOO_SMALL,
>> -       SKB_DROP_REASON_TCP_CSUM,
>> -       SKB_DROP_REASON_SOCKET_FILTER,
>> -       SKB_DROP_REASON_UDP_CSUM,
>> -       SKB_DROP_REASON_MAX,
>> -};
> 
> 
> Seriously, we have to stop messing with things like that.
> 
> Your patch comes too late, another approach has been taken.
> 
> Please continue this effort by providing patches that improve things,
> instead of throwing away effort already done.

Thank you very much for the suggestion!

I will introduce new reasons to TUN and TAP drivers, in order to track the
dropped sk_buff.

Dongli Zhang

> 
> I say no to this patch.
> 

  reply	other threads:[~2022-02-03 17:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 15:37 [PATCH RFC 0/4] net: skb: to use (function, line) pair as reason for kfree_skb_reason() Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
2022-02-03 15:48   ` David Ahern
2022-02-03 17:13     ` Dongli Zhang
2022-02-03 15:59   ` Eric Dumazet
2022-02-03 17:14     ` Dongli Zhang [this message]
2022-02-03 15:37 ` [PATCH RFC 2/4] net: skb: add function name as part of reason Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 3/4] net: tun: track dropped skb via kfree_skb_reason() Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 4/4] net: tap: " Dongli Zhang

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=3234b5dc-9a96-1786-96eb-a319d2359358@oracle.com \
    --to=dongli.zhang@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=imagedong@tencent.com \
    --cc=joao.m.martins@oracle.com \
    --cc=joe.jin@oracle.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=yoshfuji@linux-ipv6.org \
    /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

all inboxes | Powered by JetHome®