Received: by 10.223.164.202 with SMTP id h10csp1343282wrb; Wed, 8 Nov 2017 02:49:55 -0800 (PST) X-Google-Smtp-Source: ABhQp+Sh/zcfBJTWILwxrqgJ0QW9wcKPzPa8KrxsU/Dl3bqnQImwEoAAO6Ou9o7398RpchQrMtxK X-Received: by 10.84.128.195 with SMTP id a61mr45112pla.283.1510138195476; Wed, 08 Nov 2017 02:49:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510138195; cv=none; d=google.com; s=arc-20160816; b=D9scnNuBGWh11QuGoVWScHhy8zrlwuSS110xxvsKop/oyy0YtyB/pOJW9eWPjARKkL D1cDc6cwq0uFBlnKFLXuNj/NUrGUbHPjS6DtoGwbuDNeHw7tj2fXAn+CLFYCVa3ZC2wn yR69wFZp/2DF16Wq0jypakA7IallhREww7zylteRSLtg7autdVOjcDb8G5gqxWO/BGvR Ut8lCx5wDsj58bAMs+9sCbvzkZHsKtzCUl4YVldNUaZHxZZ3+Io8ACkItmMfbefHkkZc Rr/W8SwyRiF2w1ZrnS+V/dgTRbiWhrTWg9S+x+Ndft3xZCgma9gHhBhlQhDl+LUHJY/H j64Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=jTyThLa2RdTidCaK6ZnvwG2dGK8uxe6mP5yc9aNhWjU=; b=GyNCtLGJPAY3gxB+Er2V/6vyeDBIzLQrZpDrk6/hRIsrKOKJ9uftxLhnjn+Hx7GYEx LSXDoKqCI7UHKm8zNBD2Y0070VtsU0a6QiM/PLdK/B5sLYv3JwJKx/JgUfxWSlE3HHhI kLkgPoetla/35cnEoonqzMAHZ4rVXy1UqIDhnG8nCD+IPEV7ysDgaggsVAbl6Z7xAFg8 LUaaa44xEM3H/9KGGE5meVtPMp2umCxVA18PkclU4M+k4aqVNgeSIvxY7SncvY4xpWOJ /g0MeKd+OhLpJ35wq9tYZGG+YLRB+TqGaYrHvFsXLsfmc7cSx7Ymsb6ZyDSzepn02pD1 oNdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gd7RAI5Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 125si3387023pgj.752.2017.11.08.02.49.42; Wed, 08 Nov 2017 02:49:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gd7RAI5Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752038AbdKHKs4 (ORCPT + 91 others); Wed, 8 Nov 2017 05:48:56 -0500 Received: from mail-it0-f46.google.com ([209.85.214.46]:48381 "EHLO mail-it0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbdKHKsv (ORCPT ); Wed, 8 Nov 2017 05:48:51 -0500 Received: by mail-it0-f46.google.com with SMTP id c3so6275346itc.3; Wed, 08 Nov 2017 02:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jTyThLa2RdTidCaK6ZnvwG2dGK8uxe6mP5yc9aNhWjU=; b=gd7RAI5Y3dsg8f7rUv63/fNgM+rr8xG/HonzCPoyJR/DAp9Nu41vMZPAbxOrEjk7xL jXUsGPFhg8AccGwHYYc03KRsyi9TllTMEsQ/kJp6tRz3nv3/lk5Syow1Vw4tMdadgvND o80rsNIwPcHcoAIKINKQt8CL+2t5bprsrlywjIdHhQ+z3fCAOK5cL/vmqZPxElvl0Isw KZSFV674Ydvpz5LKMN9nEQIrOf+4pJfiAexz44bDP2xfrLy380stAe4stD4XSePzYec2 EYaLL+K+RIGfOanHr5FE19B1+4CTi537xcuq6qIwtJpSY4tRGlf2xPWvxDd6tcDeaai5 PF1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jTyThLa2RdTidCaK6ZnvwG2dGK8uxe6mP5yc9aNhWjU=; b=FZqlI9h0d0ptPBh8heR/BGONCmVzeWCnfA6V039GRsUUSBcyZKjDigWYZmigfp8MVJ isn6FD+kOByUA8YE0Y3V4PpSMgx+yOsqx3FvmSkMGcpTcC2tEIs7RAzG/Ute5rTXdWiJ 8uTqnHz3h0Z4el0EMf10f4OPXAC3gtxlTtZHqU1E6VXQaYgRjtuSjyQG3AsVRcM8tTop Da0oHcdazlASRpl5LK1U/lJTC9sxyzUMrIZ+n2XGhToF9GXneQzy5Qf77VSn+hGd2I/g 3pzV1vG76hQZsG7g228xQWVRYnZLw6J6ub0HiMTZoGcPvASkoEplRsuY3ExK4Q8mU/xn KiKg== X-Gm-Message-State: AJaThX4N6+hXaqicS7SGgwGAq543eQ8OwZwu6E0GVRGubexFhGAaVjBk TBZbDdBxdR9Dg3GSSPw+8IQe2vajR6OzhubhXbA= X-Received: by 10.36.9.144 with SMTP id 138mr76663itm.106.1510138131176; Wed, 08 Nov 2017 02:48:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.160.73 with HTTP; Wed, 8 Nov 2017 02:48:50 -0800 (PST) In-Reply-To: <20171108.155112.1483404763325763621.davem@davemloft.net> References: <1510050988-17688-1-git-send-email-laoar.shao@gmail.com> <20171108.155112.1483404763325763621.davem@davemloft.net> From: Yafang Shao Date: Wed, 8 Nov 2017 18:48:50 +0800 Message-ID: Subject: Re: [PATCH] net/tcp: track all ipv4/tcp state transition in tcp_set_state To: David Miller Cc: Alexey Kuznetsov , yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-11-08 14:51 GMT+08:00 David Miller : > From: Yafang Shao > 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 > > 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; > } Good idea! I will try to implement it. Thanks Yafang From 1583483572656230933@xxx Wed Nov 08 07:53:33 +0000 2017 X-GM-THRID: 1583410557490242209 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread