Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751313AbeACBti (ORCPT + 1 other); Tue, 2 Jan 2018 20:49:38 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:33386 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751034AbeACBtg (ORCPT ); Tue, 2 Jan 2018 20:49:36 -0500 X-Google-Smtp-Source: ACJfBov87RV6hwr8wgWBrdgXWdqEqwV5kjjB0AM13v7rViXnVdEgiEZuZwP592yokEHYKXD0PvjXtCEN/FYD9PrAhCE= MIME-Version: 1.0 In-Reply-To: References: <1513739574-3345-1-git-send-email-laoar.shao@gmail.com> <1513739574-3345-3-git-send-email-laoar.shao@gmail.com> From: Yafang Shao Date: Wed, 3 Jan 2018 09:48:55 +0800 Message-ID: Subject: Re: [PATCH v3 net-next 2/5] net: tracepoint: replace tcp_set_state tracepoint with inet_sock_set_state tracepoint To: Brendan Gregg Cc: Song Liu , "David S. Miller" , Marcelo Ricardo Leitner , Steven Rostedt , Brendan Gregg , netdev@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 3, 2018 at 3:46 AM, Brendan Gregg wrote: > On Sat, Dec 30, 2017 at 7:06 PM, Yafang Shao wrote: >> On Sun, Dec 31, 2017 at 6:33 AM, Brendan Gregg >> wrote: >>> On Tue, Dec 19, 2017 at 7:12 PM, Yafang Shao wrote: >>>> As sk_state is a common field for struct sock, so the state >>>> transition tracepoint should not be a TCP specific feature. >>>> Currently it traces all AF_INET state transition, so I rename this >>>> tracepoint to inet_sock_set_state tracepoint with some minor changes and move it >>>> into trace/events/sock.h. >>> >>> The tcp:tcp_set_state probe is tcp_set_state(), so it's only going to >>> fire for TCP sessions. It's not broken, and we could add a >>> sctp:sctp_set_state as well. Replacing tcp:tcp_set_state with >>> inet_sk_set_state is feeling like we might be baking too much >>> implementation detail into the tracepoint API. >>> >>> If we must have inet_sk_set_state, then must we also delete tcp:tcp_set_state? >>> >> >> Hi Brendan, >> >> The reason we have to make this change could be got from this mail >> thread, https://patchwork.kernel.org/patch/10099243/ . >> >> The original tcp:tcp_set_state probe doesn't traced all TCP state transitions. >> There're some state transitions in inet_connection_sock.c and >> inet_hashtables.c are missed. >> So we have to place this probe into these two files to fix the issue. >> But as inet_connection_sock.c and inet_hashtables.c are common files >> for all IPv4 protocols, not only for TCP, so it is not proper to place >> a tcp_ function in these two files. >> That's why we decide to rename tcp:tcp_set_state probe to >> sock:inet_sock_set_state. > > It kinda feels like we are fixing one exposing-implementation problem > (the missing state changes, which I'm happy to see fixed), by exposing > another (there's no tcp:tcp_set_state because we don't want to put tcp > functions in inet*.c files). Anyway... > > If I'm to use sock:inet_sock_set_state for TCP tracing, I'd like > sk->sk_protocol exposed as a tracepoint argument so I can match on > IPPROTO_TCP. Otherwise I'll have to keep digging it out of (void > *)skaddr. (And if we're adding arguments, maybe consider sk_family as > well, to make it easier to see which address arguments to use). > I will improve it as your suggestion. Thanks Yafang