Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751097AbdL3Wdl (ORCPT ); Sat, 30 Dec 2017 17:33:41 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:43328 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750970AbdL3Wdj (ORCPT ); Sat, 30 Dec 2017 17:33:39 -0500 X-Google-Smtp-Source: ACJfBosXL+2OMB3Szqk4KJDjxzEo0UE31EZLqkKS+7UZ7tHv6gIFTVZ3xYDZcp5Fg2dBVjAD+jnoFJZSAC3wQBPLL9s= MIME-Version: 1.0 In-Reply-To: <1513739574-3345-3-git-send-email-laoar.shao@gmail.com> References: <1513739574-3345-1-git-send-email-laoar.shao@gmail.com> <1513739574-3345-3-git-send-email-laoar.shao@gmail.com> From: Brendan Gregg Date: Sat, 30 Dec 2017 14:33:07 -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: Yafang Shao Cc: songliubraving@fb.com, "David S. Miller" , marcelo.leitner@gmail.com, 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 Content-Length: 1247 Lines: 30 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? Brendan > We dont need to create a file named trace/events/inet_sock.h for this one single > tracepoint. > > Two helpers are introduced to trace sk_state transition > - void inet_sk_state_store(struct sock *sk, int newstate); > - void inet_sk_set_state(struct sock *sk, int state); > As trace header should not be included in other header files, > so they are defined in sock.c. > > The protocol such as SCTP maybe compiled as a ko, hence export > inet_sk_set_state(). >[...]