netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: laoar.shao@gmail.com
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/tcp: track all ipv4/tcp state transition in tcp_set_state
Date: Wed, 08 Nov 2017 15:51:12 +0900 (KST)	[thread overview]
Message-ID: <20171108.155112.1483404763325763621.davem@davemloft.net> (raw)
In-Reply-To: <1510050988-17688-1-git-send-email-laoar.shao@gmail.com>

From: Yafang Shao <laoar.shao@gmail.com>
Date: Tue,  7 Nov 2017 18:36:28 +0800

> When I hooked the function tcp_set_state with kprobe to track the ipv4/tcp
> state transistion, I found state transition from TCP_LISTEN to TCP_SYN_RECV
> is missed.
> 
> I think it is better to use the helper to do state transition instead of
> assigning the state to sk_state directly.
> Then we can monitor the whole tcp lifespans with kprobe or ftrace easily.
> 
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>

This is really heavy handed and excessive for these cases.

They don't have to handle any of the issues dealt with in
tcp_set_state().

I would prefer if you made a special helper to net/tcp.h which did:

static inline void __tcp_set_state(struct sock *sk, int state)
{
	trace_tcp_set_state(sk, sk->sk_state, state);
	sk->sk_state = state;
}

  reply	other threads:[~2017-11-08  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 10:36 [PATCH] net/tcp: track all ipv4/tcp state transition in tcp_set_state Yafang Shao
2017-11-08  6:51 ` David Miller [this message]
2017-11-08 10:48   ` Yafang Shao

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=20171108.155112.1483404763325763621.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).