Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3935961imj; Tue, 12 Feb 2019 07:10:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ3ukdAgH+B7hFeVMmFz0ocZj0J4tCeWmm50jZscTdG8Slb/N/uTGIwA5iv9uec4OtPt4qH X-Received: by 2002:a63:1544:: with SMTP id 4mr4137930pgv.290.1549984202733; Tue, 12 Feb 2019 07:10:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549984202; cv=none; d=google.com; s=arc-20160816; b=Jce5ocE8pdE4OodOf7rKAJMx3Wqk1RBu2zCN0XaCZeXna5tctiainS8O6kylva3p8A cxNNNqivwutxvfE6NekzBGbxNxovBSA1Kkdtnj1au0rjwUovtRBnXT2FwRlq06YJA5PD pAceH3Zcr+cD0fiTPAg8blp45RMl0y74v7tAdZcdsGa5p7TQOXFQPh/Q/TAJmVbFF/Gn CaUgzg1zyFda8ZxoV0Y3W5Nx9a7N9qQzS8fzdaimBVL+2K7lKybi8iMYHN4tkXP+kmeY IFip/XzJRz9KoBXYuhyuvhFy55suXPlJFf2L+YGp7JW4pZy5ySJggAVuQASj4vv8sXE/ lXNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=HDvAGxIoJenry2A9MarN1qHi3OjHsoI8Z2hcVFAwMIM=; b=YCulfU5PQNWwqOynmiF7bAAFRERBZ5jOjolhFhbwHvf6zikxmhfY3m5piJKTHpw46o gzU0ln2FwjYUgkLg8CP43BGE1RbJEOEId01OsKCZbMOKZE2rAE/Xccc+dSrdyuR4l8kK GzkjJEnQmlfr1JUlH8zvsHwk+6Yc60ZXnqE3fEdrQLlq8qB0SoS4YcbbjvJKeCysdVbv xbv2Rgkn/Q6bHntQhyemdAwwkdBaw6tlStFRRLG6ah8VASNx2LtoYKJ9ll92+Wgamfj1 1nPz3x7OWOtwUx34dPiT2v1e4kDTCcqAVLKgX+/LHHYTnwU5tYuu7mCVEH/HqhEglZx+ skyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dP9v4Cus; 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=QUARANTINE 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 m22si11817072pgv.188.2019.02.12.07.09.40; Tue, 12 Feb 2019 07:10:02 -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=dP9v4Cus; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729681AbfBLPHb (ORCPT + 99 others); Tue, 12 Feb 2019 10:07:31 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:38801 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbfBLPHa (ORCPT ); Tue, 12 Feb 2019 10:07:30 -0500 Received: by mail-yb1-f195.google.com with SMTP id x9so1143265ybj.5; Tue, 12 Feb 2019 07:07:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HDvAGxIoJenry2A9MarN1qHi3OjHsoI8Z2hcVFAwMIM=; b=dP9v4CuskASrxW01o/z7hyGY/rezEd+7Hfpnx4OO/9pB8em42dxBqb9EALvMtcT9Px eLeFd6bebmnbsp4i6YWjO1caqvk9OYE0X+OOu/jv/AZJAWidC6tto5RvQwy32p/Rehup vn2sAmI+3uTFDXHrLHgY8S5MJ5jEc7pzFrOL8cjFMauQUY4kcpyZQfqtYlezdpU8Jdn9 yFetKWsIKJCIIVuZEK4LqklBaXZP3l3HhEalkDbkwDjjw0Endpm3ODjPqkS5qkdT5gF3 IL0vUip99350qy4Dxmy35whNx0ZcGRzmmQnEv/FACfWh3Z2rcgLT4eQz5O3G2AuFmIBV +pCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HDvAGxIoJenry2A9MarN1qHi3OjHsoI8Z2hcVFAwMIM=; b=fdEFF88pEJfuOpDbIKdkLTqcoeKtMYKqdkwRP0d+pT4VikdWEAN5Nwdj4RIm0pF4Qr cQnI6H9DGIToJ+ecpUMi6o1CNAvCsBDU3uBCsXcl+81q1gZTv6wf6Lf/vdvztGyZKO12 Gx0Baz5IhMlV18YbLR8uIYltzmwNPimq1IZBz+GVpwHAvs51XOSDv/lrq8ql96o2/N46 UrtUysK+hVmp9i2d303HSC3ElCI8Z4J8XyXKozQPc9yAul5QjRBsRFJ1JNHZVuRGtpYB NCBQ8AM07Y5vLxdQi+2gtFa+3PjAFQZySnDXJjH5A7/CgmIlqxH/Yi5MRU5YcgROCDMY Gp8Q== X-Gm-Message-State: AHQUAuaidz+f3JQSj9mYwG3mX0XeqhjvqqXJbMK5Rlvm6mu7PyYHimDy yztX5MgsniteE6eTOkFXKa0= X-Received: by 2002:a25:d6ce:: with SMTP id n197mr3162655ybg.313.1549984049638; Tue, 12 Feb 2019 07:07:29 -0800 (PST) Received: from [192.168.86.235] (c-73-241-150-70.hsd1.ca.comcast.net. [73.241.150.70]) by smtp.gmail.com with ESMTPSA id r124sm4811471ywb.39.2019.02.12.07.07.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 07:07:28 -0800 (PST) Subject: Re: [bpf-next 1/2] tcp: replace SOCK_DEBUG() with tcp_stats() To: Yafang Shao , daniel@iogearbox.net, ast@kernel.org Cc: yhs@fb.com, brakmo@fb.com, edumazet@google.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, shaoyafang@didiglobal.com References: <1549971097-12627-1-git-send-email-laoar.shao@gmail.com> <1549971097-12627-2-git-send-email-laoar.shao@gmail.com> From: Eric Dumazet Message-ID: <38d07cb3-b767-bfc4-9ae5-48367971d839@gmail.com> Date: Tue, 12 Feb 2019 07:07:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1549971097-12627-2-git-send-email-laoar.shao@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/12/2019 03:31 AM, Yafang Shao wrote: > SOCK_DEBUG is a very ancient debugging interface, and it's not very useful > for debugging. > So this patch removes the SOCK_DEBUG() and introduce a new function > tcp_stats() to trace this kind of events. > Some MIBs are added for these events. > > Regarding the SO_DEBUG in sock_{s,g}etsockopt, I think it is better to > keep as-is, because if we return an errno to tell the application that > this optname isn't supported for TCP, it may break the application. > The application still can use this option but don't take any effect for > TCP. > > Signed-off-by: Yafang Shao > --- > include/uapi/linux/snmp.h | 3 +++ > net/ipv4/proc.c | 3 +++ > net/ipv4/tcp_input.c | 26 +++++++++++--------------- > net/ipv6/tcp_ipv6.c | 2 -- > 4 files changed, 17 insertions(+), 17 deletions(-) > > diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h > index 86dc24a..fd5c09c 100644 > --- a/include/uapi/linux/snmp.h > +++ b/include/uapi/linux/snmp.h > @@ -283,6 +283,9 @@ enum > LINUX_MIB_TCPACKCOMPRESSED, /* TCPAckCompressed */ > LINUX_MIB_TCPZEROWINDOWDROP, /* TCPZeroWindowDrop */ > LINUX_MIB_TCPRCVQDROP, /* TCPRcvQDrop */ > + LINUX_MIB_TCPINVALIDACK, /* TCPInvalidAck */ > + LINUX_MIB_TCPOLDACK, /* TCPOldAck */ > + LINUX_MIB_TCPPARTIALPACKET, /* TCPPartialPacket */ > __LINUX_MIB_MAX > }; > > diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c > index c3610b3..1b0320a 100644 > --- a/net/ipv4/proc.c > +++ b/net/ipv4/proc.c > @@ -291,6 +291,9 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) > SNMP_MIB_ITEM("TCPAckCompressed", LINUX_MIB_TCPACKCOMPRESSED), > SNMP_MIB_ITEM("TCPZeroWindowDrop", LINUX_MIB_TCPZEROWINDOWDROP), > SNMP_MIB_ITEM("TCPRcvQDrop", LINUX_MIB_TCPRCVQDROP), > + SNMP_MIB_ITEM("TCPInvalidAck", LINUX_MIB_TCPINVALIDACK), > + SNMP_MIB_ITEM("TCPOldAck", LINUX_MIB_TCPOLDACK), > + SNMP_MIB_ITEM("TCPPartialPacket", LINUX_MIB_TCPPARTIALPACKET), > SNMP_MIB_SENTINEL > }; > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 7a027dec..88deb1f 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -3554,6 +3554,11 @@ static u32 tcp_newly_delivered(struct sock *sk, u32 prior_delivered, int flag) > return delivered; > } > > +static void tcp_stats(struct sock *sk, int mib_idx) > +{ > + NET_INC_STATS(sock_net(sk), mib_idx); > +} This is not a very descriptive name. Why is it static, and in net/ipv4/tcp_input.c ??? > + > /* This routine deals with incoming acks, but not outgoing ones. */ > static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) > { > @@ -3715,7 +3720,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) > return 1; > > invalid_ack: > - SOCK_DEBUG(sk, "Ack %u after %u:%u\n", ack, tp->snd_una, tp->snd_nxt); > + tcp_stats(sk, LINUX_MIB_TCPINVALIDACK); > return -1; > > old_ack: > @@ -3731,7 +3736,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) > tcp_xmit_recovery(sk, rexmit); > } > > - SOCK_DEBUG(sk, "Ack %u before %u:%u\n", ack, tp->snd_una, tp->snd_nxt); > + tcp_stats(sk, LINUX_MIB_TCPOLDACK); > return 0; > } > These counters will add noise to an already crowded MIB space. What bug do you expect to track and fix with these ? I see many TCP patches coming adding icache pressure, enabling companies to build their own modified TCP stack, but no real meat.