2021-09-21 01:51:18

by Cong Wang

[permalink] [raw]
Subject: Re: [PATCH] tcp: tcp_drop adds `SNMP` and `reason` parameter for tracing

On Tue, Sep 14, 2021 at 7:38 AM Zhongya Yan <[email protected]> wrote:
>
> When we wanted to trace the use of the `tcp_drop(struct sock *sk, struct sk_buff *skb)` function, we didn't know why `tcp` was deleting `skb'. To solve this problem, I updated the function `tcp_drop(struct sock *sk, struct sk_buff *skb, int field, const char *reason)`.
> This way you can understand the reason for the deletion based on the prompt message.
> `field`: represents the SNMP-related value
> `reason`: represents the reason why `tcp` deleted the current `skb`, and contains some hints.
> Of course, if you want to know more about the reason for updating the current function, you can check: https://www.brendangregg.com/blog/2018-05-31/linux-tcpdrop.html

I think you fail to explain why only TCP needs it? This should
be useful for all kinds of drops, not just TCP, therefore you should
consider extending net/core/drop_monitor.c instead of just tcp_drop().

Also, kernel does not have to explain it in strings, those SNMP
counters are already available for user-space, so kernel could
just use SNMP enums and let user-space interpret them. In many
cases, you are just adding strings for those SNMP enums.

Thanks.


2021-09-21 01:52:07

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] tcp: tcp_drop adds `SNMP` and `reason` parameter for tracing

On Mon, 20 Sep 2021 09:54:02 -0700
Cong Wang <[email protected]> wrote:

> Also, kernel does not have to explain it in strings, those SNMP
> counters are already available for user-space, so kernel could
> just use SNMP enums and let user-space interpret them. In many
> cases, you are just adding strings for those SNMP enums.

The strings were requested by the networking maintainers.

https://lore.kernel.org/all/CANn89iJO8jzjFWvJ610TPmKDE8WKi8ojTr_HWXLz5g=4pdQHEA@mail.gmail.com/

-- Steve

2021-09-21 02:56:29

by Cong Wang

[permalink] [raw]
Subject: Re: [PATCH] tcp: tcp_drop adds `SNMP` and `reason` parameter for tracing

On Mon, Sep 20, 2021 at 10:15 AM Steven Rostedt <[email protected]> wrote:
>
> On Mon, 20 Sep 2021 09:54:02 -0700
> Cong Wang <[email protected]> wrote:
>
> > Also, kernel does not have to explain it in strings, those SNMP
> > counters are already available for user-space, so kernel could
> > just use SNMP enums and let user-space interpret them. In many
> > cases, you are just adding strings for those SNMP enums.
>
> The strings were requested by the networking maintainers.
>
> https://lore.kernel.org/all/CANn89iJO8jzjFWvJ610TPmKDE8WKi8ojTr_HWXLz5g=4pdQHEA@mail.gmail.com/

I think you misunderstand my point. Eric's point is hex address
vs. string, which I never disagree. With SNMP enum, user-space
can easily interpret it to string too, so at the end you still get strings
but not from kernel. This would at least save a handful of strings
from vmlinux, especially if we expand it beyond TCP.

Thanks.